11package com .auth0 ;
22
3- import com .auth0 .client .HttpOptions ;
43import com .auth0 .client .auth .AuthAPI ;
54import com .auth0 .jwk .JwkProvider ;
6- import com .auth0 .net .Telemetry ;
5+ import com .auth0 .net .client .Auth0HttpClient ;
6+ import com .auth0 .net .client .DefaultHttpClient ;
77import com .google .common .annotations .VisibleForTesting ;
88import org .apache .commons .lang3 .Validate ;
99
@@ -61,7 +61,6 @@ public static class Builder {
6161 private boolean useLegacySameSiteCookie ;
6262 private String organization ;
6363 private String invitation ;
64- private HttpOptions httpOptions ;
6564 private String cookiePath ;
6665
6766 Builder (String domain , String clientId , String clientSecret ) {
@@ -76,18 +75,6 @@ public static class Builder {
7675 this .useLegacySameSiteCookie = true ;
7776 }
7877
79- /**
80- * Customize certain aspects of the underlying HTTP client networking library, such as timeouts and proxy configuration.
81- *
82- * @param httpOptions a non-null {@code HttpOptions}
83- * @return this same builder instance.
84- */
85- public Builder withHttpOptions (HttpOptions httpOptions ) {
86- Validate .notNull (httpOptions );
87- this .httpOptions = httpOptions ;
88- return this ;
89- }
90-
9178 /**
9279 * Specify that transient authentication-based cookies such as state and nonce are created with the specified
9380 * {@code Path} cookie attribute.
@@ -196,8 +183,7 @@ public Builder withInvitation(String invitation) {
196183 * @throws UnsupportedOperationException if the Implicit Grant is chosen and the environment doesn't support UTF-8 encoding.
197184 */
198185 public AuthenticationController build () throws UnsupportedOperationException {
199- AuthAPI apiClient = createAPIClient (domain , clientId , clientSecret , httpOptions );
200- setupTelemetry (apiClient );
186+ AuthAPI apiClient = createAPIClient (domain , clientId , clientSecret );
201187
202188 final boolean expectedAlgorithmIsExplicitlySetAndAsymmetric = jwkProvider != null ;
203189 final SignatureVerifier signatureVerifier ;
@@ -234,17 +220,15 @@ IdTokenVerifier.Options createIdTokenVerificationOptions(String issuer, String a
234220 }
235221
236222 @ VisibleForTesting
237- AuthAPI createAPIClient (String domain , String clientId , String clientSecret , HttpOptions httpOptions ) {
238- if (httpOptions != null ) {
239- return new AuthAPI (domain , clientId , clientSecret , httpOptions );
240- }
241- return new AuthAPI (domain , clientId , clientSecret );
242- }
223+ AuthAPI createAPIClient (String domain , String clientId , String clientSecret ) {
224+ Auth0HttpClient http = DefaultHttpClient .newBuilder ()
225+ .telemetryEnabled (true )
226+ .build ();
243227
244- @ VisibleForTesting
245- void setupTelemetry ( AuthAPI client ) {
246- Telemetry telemetry = new Telemetry ( "auth0-java-mvc-common" , obtainPackageVersion ());
247- client . setTelemetry ( telemetry );
228+
229+ return AuthAPI . newBuilder ( domain , clientId , clientSecret )
230+ . withHttpClient ( http )
231+ . build ( );
248232 }
249233
250234 @ VisibleForTesting
@@ -265,23 +249,6 @@ private String getIssuer(String domain) {
265249 }
266250 }
267251
268- /**
269- * Whether to enable or not the HTTP Logger for every Request and Response.
270- * Enabling this can expose sensitive information.
271- *
272- * @param enabled whether to enable the HTTP logger or not.
273- */
274- public void setLoggingEnabled (boolean enabled ) {
275- requestProcessor .getClient ().setLoggingEnabled (enabled );
276- }
277-
278- /**
279- * Disable sending the Telemetry header on every request to the Auth0 API
280- */
281- public void doNotSendTelemetry () {
282- requestProcessor .getClient ().doNotSendTelemetry ();
283- }
284-
285252 /**
286253 * Process a request to obtain a set of {@link Tokens} that represent successful authentication or authorization.
287254 *
0 commit comments