@@ -102,8 +102,9 @@ public ConfidentialClient(final Configuration config)
102102 Objects .requireNonNull (config , "Configuration object must not be null" );
103103 this .config = config ;
104104 LOGGER .debug ("Finished initialising configuration" );
105+ this .requestOptions = null ;
105106
106- this .requestProviderMetadata (config , null );
107+ this .requestProviderMetadata ();
107108 }
108109
109110 /**
@@ -122,8 +123,9 @@ public ConfidentialClient(final Configuration config, RequestOptions requestOpti
122123 Objects .requireNonNull (config , "Configuration object must not be null" );
123124 this .config = config ;
124125 LOGGER .debug ("Finished initialising configuration" );
126+ this .requestOptions = requestOptions ;
125127
126- this .requestProviderMetadata (config , requestOptions );
128+ this .requestProviderMetadata ();
127129 }
128130
129131 /**
@@ -184,20 +186,20 @@ public String getAccessToken() throws AccessTokenException, SigningJwsException
184186 return this .fetchAccessToken ();
185187 }
186188
187- private void requestProviderMetadata (Configuration config , RequestOptions requestOptions ) throws AuthServerMetadataContentException , AuthServerMetadataException {
189+ private void requestProviderMetadata () throws AuthServerMetadataContentException , AuthServerMetadataException {
188190 LOGGER .debug ("Attempting to get response from Well Known URI" );
189- URL wellKnownURL = config .getWellKnownUrl ();
191+ URL wellKnownURL = this . config .getWellKnownUrl ();
190192 InputStream stream ;
191193
192194 try {
193- if (requestOptions == null ) stream = wellKnownURL .openStream ();
195+ if (this . requestOptions == null ) stream = wellKnownURL .openStream ();
194196 else {
195- HttpURLConnection conn = (HttpURLConnection ) wellKnownURL .openConnection (requestOptions .getProxy ());
197+ HttpURLConnection conn = (HttpURLConnection ) wellKnownURL .openConnection (this . requestOptions .getProxy ());
196198 HttpsURLConnection sslConn = null ;
197199 if (conn instanceof HttpsURLConnection ) {
198200 sslConn = (HttpsURLConnection ) conn ;
199- sslConn .setHostnameVerifier (requestOptions .getHostnameVerifier ());
200- sslConn .setSSLSocketFactory (requestOptions .getSslSocketFactory ());
201+ sslConn .setHostnameVerifier (this . requestOptions .getHostnameVerifier ());
202+ sslConn .setSSLSocketFactory (this . requestOptions .getSslSocketFactory ());
201203 }
202204
203205 stream = conn .getInputStream ();
@@ -207,10 +209,10 @@ private void requestProviderMetadata(Configuration config, RequestOptions reques
207209 this .providerMetadata = OIDCProviderMetadata .parse (providerInfo );
208210 } catch (final ParseException e ) {
209211 throw new AuthServerMetadataContentException ("Content of WellKnownUri has errors: " +
210- config .getWellKnownUrl ().toString (), e );
212+ this . config .getWellKnownUrl ().toString (), e );
211213 } catch (final IOException e ) {
212214 throw new AuthServerMetadataException ("Error retrieving contents from WellKnownUri: " +
213- config .getWellKnownUrl ().toString (), e );
215+ this . config .getWellKnownUrl ().toString (), e );
214216 }
215217 LOGGER .debug ("Response received from Well Known URI" );
216218
0 commit comments