Skip to content

Commit ad39fbd

Browse files
authored
Remove deprecated methods (#489)
* remove deprecated list APIs in favor of paginated APIs * remove deprecated EnrollmentTicket methods * remove deprecated SNSFactorProvider methods * remove TwilioProviderFactor deprecated methods * Deprecate HttpOptions in favor of DefaultHttpClient config * deprecate HttpOptions in favor of http client config * fix ManagementAPI deprecation compiler warning
1 parent a4834e9 commit ad39fbd

24 files changed

Lines changed: 26 additions & 702 deletions

src/main/java/com/auth0/client/HttpOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/**
44
* Used to configure additional configuration options when customizing the API client instance.
5+
* @deprecated use the {@link com.auth0.net.client.DefaultHttpClient} to configure HTTP client behavior
56
*/
7+
@Deprecated
68
public class HttpOptions {
79

810
private ProxyOptions proxyOptions;

src/main/java/com/auth0/client/auth/AuthAPI.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.auth0.client.auth;
22

3-
import com.auth0.client.HttpOptions;
43
import com.auth0.client.mgmt.ManagementAPI;
54
import com.auth0.json.auth.PasswordlessEmailResponse;
65
import com.auth0.json.auth.PasswordlessSmsResponse;
@@ -71,7 +70,7 @@ public class AuthAPI {
7170
/**
7271
* Create a new instance with the given tenant's domain, application's client id and client secret.
7372
* These values can be obtained at {@code https://manage.auth0.com/#/applications/{YOUR_CLIENT_ID}/settings}.
74-
* In addition, accepts an {@link HttpOptions} that will be used to configure the networking client.
73+
* In addition, accepts an {@link com.auth0.client.HttpOptions} that will be used to configure the networking client.
7574
*
7675
* @deprecated Use the {@link Builder} to configure and create instances.
7776
*
@@ -82,7 +81,8 @@ public class AuthAPI {
8281
* @see #AuthAPI(String, String, String)
8382
*/
8483
@Deprecated
85-
public AuthAPI(String domain, String clientId, String clientSecret, HttpOptions options) {
84+
@SuppressWarnings("deprecation")
85+
public AuthAPI(String domain, String clientId, String clientSecret, com.auth0.client.HttpOptions options) {
8686
this(domain, clientId, clientSecret, buildNetworkingClient(options));
8787
}
8888

@@ -98,7 +98,7 @@ public AuthAPI(String domain, String clientId, String clientSecret, HttpOptions
9898
*/
9999
@Deprecated
100100
public AuthAPI(String domain, String clientId, String clientSecret) {
101-
this(domain, clientId, clientSecret, new HttpOptions());
101+
this(domain, clientId, clientSecret, new com.auth0.client.HttpOptions());
102102
}
103103

104104
/**
@@ -145,7 +145,8 @@ private AuthAPI(String domain, String clientId, String clientSecret, Auth0HttpCl
145145
* @param options the options to set to the client.
146146
* @return a new networking client instance configured as requested.
147147
*/
148-
private static Auth0HttpClient buildNetworkingClient(HttpOptions options) {
148+
@SuppressWarnings("deprecation")
149+
private static Auth0HttpClient buildNetworkingClient(com.auth0.client.HttpOptions options) {
149150
Asserts.assertNotNull(options, "Http options");
150151
return DefaultHttpClient.newBuilder()
151152
.withLogging(options.getLoggingOptions())

src/main/java/com/auth0/client/mgmt/ClientGrantsEntity.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,6 @@ public Request<ClientGrantsPage> list(ClientGrantsFilter filter) {
5151
});
5252
}
5353

54-
/**
55-
* Request all the Client Grants. A token with scope read:client_grants is needed.
56-
* See https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants
57-
*
58-
* @return a Request to execute.
59-
* @deprecated Calling this method will soon stop returning the complete list of client grants and instead, limit to the first page of results.
60-
* Please use {@link #list(ClientGrantsFilter)} instead as it provides pagination support.
61-
*/
62-
@Deprecated
63-
public Request<List<ClientGrant>> list() {
64-
String url = baseUrl
65-
.newBuilder()
66-
.addPathSegments("api/v2/client-grants")
67-
.build()
68-
.toString();
69-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<ClientGrant>>() {
70-
});
71-
}
72-
7354
/**
7455
* Create a Client Grant. A token with scope create:client_grants is needed.
7556
* See https://auth0.com/docs/api/management/v2#!/Client_Grants/post_client_grants

src/main/java/com/auth0/client/mgmt/ClientsEntity.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,6 @@ public class ClientsEntity extends BaseManagementEntity {
3131
super(client, baseUrl, tokenProvider);
3232
}
3333

34-
/**
35-
* Request all the Applications. A token with scope read:clients is needed. If you also need the client_secret and encryption_key attributes the token must have read:client_keys scope.
36-
* See https://auth0.com/docs/api/management/v2#!/Clients/get_clients
37-
*
38-
* @return a Request to execute.
39-
* @deprecated Calling this method will soon stop returning the complete list of clients and instead, limit to the first page of results.
40-
* Please use {@link #list(ClientFilter)} instead as it provides pagination support.
41-
*/
42-
@Deprecated
43-
public Request<List<Client>> list() {
44-
String url = baseUrl
45-
.newBuilder()
46-
.addPathSegments("api/v2/clients")
47-
.build()
48-
.toString();
49-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<Client>>() {
50-
});
51-
}
52-
5334
/**
5435
* Request all the Applications. A token with scope read:clients is needed. If you also need the client_secret and encryption_key attributes the token must have read:client_keys scope.
5536
* See https://auth0.com/docs/api/management/v2#!/Clients/get_clients

src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,6 @@ public Request<ConnectionsPage> listAll(ConnectionFilter filter) {
5252
}
5353

5454

55-
/**
56-
* Request all the ConnectionsEntity. A token with scope read:connections is needed.
57-
* See https://auth0.com/docs/api/management/v2#!/Connections/get_connections
58-
*
59-
* @param filter the filter to use. Can be null.
60-
* @return a Request to execute.
61-
* @deprecated Calling this method will soon stop returning the complete list of connections and instead, limit to the first page of results.
62-
* Please use {@link #listAll(ConnectionFilter)} instead as it provides pagination support.
63-
*/
64-
@Deprecated
65-
public Request<List<Connection>> list(ConnectionFilter filter) {
66-
HttpUrl.Builder builder = baseUrl
67-
.newBuilder()
68-
.addPathSegments("api/v2/connections");
69-
if (filter != null) {
70-
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
71-
//This check below is to prevent JSON parsing errors
72-
if (!e.getKey().equalsIgnoreCase("include_totals")) {
73-
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
74-
}
75-
}
76-
}
77-
String url = builder.build().toString();
78-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<Connection>>() {
79-
});
80-
}
81-
8255
/**
8356
* Request a Connection. A token with scope read:connections is needed.
8457
* See https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id

src/main/java/com/auth0/client/mgmt/GrantsEntity.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,6 @@ public Request<GrantsPage> list(String userId, GrantsFilter filter) {
5555
});
5656
}
5757

58-
/**
59-
* Request all Grants. A token with scope read:grants is needed
60-
* See https://auth0.com/docs/api/management/v2#!/Grants/get_grants
61-
*
62-
* @param userId The user id of the grants to retrieve
63-
* @return a Request to execute.
64-
* @deprecated Calling this method will soon stop returning the complete list of grants and instead, limit to the first page of results.
65-
* Please use {@link #list(String, GrantsFilter)} instead as it provides pagination support.
66-
*/
67-
@Deprecated
68-
public Request<List<Grant>> list(String userId) {
69-
Asserts.assertNotNull(userId, "user id");
70-
71-
String url = baseUrl
72-
.newBuilder()
73-
.addPathSegments("api/v2/grants")
74-
.addQueryParameter("user_id", userId)
75-
.build()
76-
.toString();
77-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<Grant>>() {
78-
});
79-
}
80-
8158
/**
8259
* Delete an existing Grant. A token with scope delete:grants is needed.
8360
* See https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id<br>

src/main/java/com/auth0/client/mgmt/ManagementAPI.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.auth0.client.mgmt;
22

3-
import com.auth0.client.HttpOptions;
43
import com.auth0.net.client.Auth0HttpClient;
54
import com.auth0.net.client.DefaultHttpClient;
65
import com.auth0.utils.Asserts;
@@ -25,7 +24,7 @@ public class ManagementAPI {
2524

2625
/**
2726
* Create an instance with the given tenant's domain and API token.
28-
* In addition, accepts an {@link HttpOptions} that will be used to configure the networking client.
27+
* In addition, accepts an {@link com.auth0.client.HttpOptions} that will be used to configure the networking client.
2928
* See the Management API section in the readme or visit https://auth0.com/docs/api/management/v2/tokens
3029
* to learn how to obtain a token.
3130
*
@@ -37,7 +36,8 @@ public class ManagementAPI {
3736
* @see #ManagementAPI(String, String)
3837
*/
3938
@Deprecated
40-
public ManagementAPI(String domain, String apiToken, HttpOptions options) {
39+
@SuppressWarnings("baz")
40+
public ManagementAPI(String domain, String apiToken, com.auth0.client.HttpOptions options) {
4141
this(domain, SimpleTokenProvider.create(apiToken), buildNetworkingClient(options));
4242
}
4343

@@ -86,7 +86,8 @@ private ManagementAPI(String domain, TokenProvider tokenProvider, Auth0HttpClien
8686
* @param options the options to set to the client.
8787
* @return a new networking client instance configured as requested.
8888
*/
89-
private static DefaultHttpClient buildNetworkingClient(HttpOptions options) {
89+
@SuppressWarnings("deprecation")
90+
private static DefaultHttpClient buildNetworkingClient(com.auth0.client.HttpOptions options) {
9091
Asserts.assertNotNull(options, "Http options");
9192
return DefaultHttpClient.newBuilder()
9293
.withLogging(options.getLoggingOptions())

src/main/java/com/auth0/client/mgmt/ResourceServerEntity.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ public Request<ResourceServersPage> list(ResourceServersFilter filter) {
5151
});
5252
}
5353

54-
/**
55-
* Creates request to fetch all resource servers.
56-
* See <a href=https://auth0.com/docs/api/management/v2#!/Resource_Servers/get_resource_servers>API documentation</a>
57-
*
58-
* @return request to execute
59-
* @deprecated Calling this method will soon stop returning the complete list of resource servers and instead, limit to the first page of results.
60-
* Please use {@link #list(ResourceServersFilter)} instead as it provides pagination support.
61-
*/
62-
@Deprecated
63-
public Request<List<ResourceServer>> list() {
64-
HttpUrl.Builder builder = baseUrl
65-
.newBuilder()
66-
.addPathSegments("api/v2/resource-servers");
67-
68-
String url = builder.build().toString();
69-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET,
70-
new TypeReference<List<ResourceServer>>() {
71-
});
72-
}
73-
7454
/**
7555
* Cretes request for fetching single resource server by it's ID.
7656
* See <a href=https://auth0.com/docs/api/management/v2#!/Resource_Servers/get_resource_servers_by_id>API documentation</a>

src/main/java/com/auth0/client/mgmt/RulesEntity.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,6 @@ public Request<RulesPage> listAll(RulesFilter filter) {
5050
});
5151
}
5252

53-
/**
54-
* Request all the Rules. A token with scope read:rules is needed.
55-
* See https://auth0.com/docs/api/management/v2#!/Rules/get_rules
56-
*
57-
* @param filter the filter to use. Can be null.
58-
* @return a Request to execute.
59-
* @deprecated Calling this method will soon stop returning the complete list of rules and instead, limit to the first page of results.
60-
* Please use {@link #listAll(RulesFilter)} instead as it provides pagination support.
61-
*/
62-
@Deprecated
63-
public Request<List<Rule>> list(RulesFilter filter) {
64-
HttpUrl.Builder builder = baseUrl
65-
.newBuilder()
66-
.addPathSegments("api/v2/rules");
67-
if (filter != null) {
68-
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
69-
//This check below is to prevent JSON parsing errors
70-
if (!e.getKey().equalsIgnoreCase("include_totals")) {
71-
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
72-
}
73-
}
74-
}
75-
String url = builder.build().toString();
76-
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<Rule>>() {
77-
});
78-
}
79-
8053
/**
8154
* Request a Rule. A token with scope read:rules is needed.
8255
* See https://auth0.com/docs/api/management/v2#!/Rules/get_rules_by_id

src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,6 @@ public String getUserId() {
7474
return userId;
7575
}
7676

77-
/**
78-
* Setter for the id of the user this ticket is meant to.
79-
*
80-
* @param userId the user id to set.
81-
* @deprecated use the constructor instead
82-
*/
83-
@Deprecated
84-
@JsonProperty("user_id")
85-
public void setUserId(String userId) {
86-
this.userId = userId;
87-
}
88-
8977
/**
9078
* Whether to send and email for enrollment or not.
9179
*
@@ -96,18 +84,6 @@ public Boolean willSendEmail() {
9684
return sendEmail;
9785
}
9886

99-
/**
100-
* Sets whether to send and email for enrollment or not.
101-
*
102-
* @param sendEmail whether this ticket will send an email upon enrollment or not.
103-
* @deprecated use the constructor instead
104-
*/
105-
@Deprecated
106-
@JsonProperty("send_mail")
107-
public void setSendEmail(Boolean sendEmail) {
108-
this.sendEmail = sendEmail;
109-
}
110-
11187
/**
11288
* Getter for the email to which the ticket will be sent.
11389
*
@@ -118,18 +94,6 @@ public String getEmail() {
11894
return email;
11995
}
12096

121-
/**
122-
* Setter for the email to which the ticket will be sent.
123-
*
124-
* @param email the email to sent the ticket to.
125-
* @deprecated use the constructor instead
126-
*/
127-
@Deprecated
128-
@JsonProperty("email")
129-
public void setEmail(String email) {
130-
this.email = email;
131-
}
132-
13397
/**
13498
* Getter for the ticket id.
13599
*

0 commit comments

Comments
 (0)