@@ -102,7 +102,7 @@ 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 ;
105+ this .requestOptions = new RequestOptions . RequestOptionsBuilder (). build () ;
106106
107107 this .requestProviderMetadata ();
108108 }
@@ -192,18 +192,15 @@ private void requestProviderMetadata() throws AuthServerMetadataContentException
192192 InputStream stream ;
193193
194194 try {
195- if (this .requestOptions == null ) stream = wellKnownURL .openStream ();
196- else {
197- HttpURLConnection conn = (HttpURLConnection ) wellKnownURL .openConnection (this .requestOptions .getProxy ());
198- if (conn instanceof HttpsURLConnection ) {
199- HttpsURLConnection sslConn = (HttpsURLConnection ) conn ;
200- sslConn .setHostnameVerifier (this .requestOptions .getHostnameVerifier ());
201- sslConn .setSSLSocketFactory (this .requestOptions .getSslSocketFactory ());
202- }
203-
204- stream = conn .getInputStream ();
195+ HttpURLConnection conn = (HttpURLConnection ) wellKnownURL .openConnection (this .requestOptions .getProxy ());
196+ if (conn instanceof HttpsURLConnection ) {
197+ HttpsURLConnection sslConn = (HttpsURLConnection ) conn ;
198+ sslConn .setHostnameVerifier (this .requestOptions .getHostnameVerifier ());
199+ sslConn .setSSLSocketFactory (this .requestOptions .getSslSocketFactory ());
205200 }
206201
202+ stream = conn .getInputStream ();
203+
207204 final String providerInfo = IOUtils .readInputStreamToString (stream );
208205 this .providerMetadata = OIDCProviderMetadata .parse (providerInfo );
209206 } catch (final ParseException e ) {
@@ -236,11 +233,10 @@ private String fetchAccessToken() throws AccessTokenException, SigningJwsExcepti
236233 final TokenRequest tokenRequest = this .tokenRequestBuilder .signedJwt (signedJwt ).build ();
237234
238235 final HTTPRequest httpRequest = tokenRequest .toHTTPRequest ();
239- if (requestOptions != null ) {
240- httpRequest .setProxy (this .requestOptions .getProxy ());
241- httpRequest .setHostnameVerifier (this .requestOptions .getHostnameVerifier ());
242- httpRequest .setSSLSocketFactory (this .requestOptions .getSslSocketFactory ());
243- }
236+ httpRequest .setProxy (this .requestOptions .getProxy ());
237+ httpRequest .setHostnameVerifier (this .requestOptions .getHostnameVerifier ());
238+ httpRequest .setSSLSocketFactory (this .requestOptions .getSslSocketFactory ());
239+
244240 logTokenRequest (httpRequest );
245241
246242 final HTTPResponse res = httpRequest .send ();
0 commit comments