143 RestTemplate restTemplate =
new RestTemplate(
httpFactory);
146 ServerConfiguration conf =
new ServerConfiguration();
149 String url = issuer +
"/.well-known/openid-configuration";
152 String jsonString = restTemplate.getForObject(url, String.class);
154 JsonElement parsed =
parser.parse(jsonString);
155 if (parsed.isJsonObject()) {
157 JsonObject o = parsed.getAsJsonObject();
160 if (!o.has(
"issuer")) {
161 throw new IllegalStateException(
"Returned object did not have an 'issuer' field");
164 if (!issuer.equals(o.get(
"issuer").getAsString())) {
165 logger.info(
"Issuer used for discover was " + issuer +
" but final issuer is " + o.get(
"issuer").getAsString());
168 conf.setIssuer(o.get(
"issuer").getAsString());
171 conf.setAuthorizationEndpointUri(getAsString(o,
"authorization_endpoint"));
172 conf.setTokenEndpointUri(getAsString(o,
"token_endpoint"));
173 conf.setJwksUri(getAsString(o,
"jwks_uri"));
174 conf.setUserInfoUri(getAsString(o,
"userinfo_endpoint"));
175 conf.setRegistrationEndpointUri(getAsString(o,
"registration_endpoint"));
176 conf.setIntrospectionEndpointUri(getAsString(o,
"introspection_endpoint"));
177 conf.setAcrValuesSupported(getAsStringList(o,
"acr_values_supported"));
178 conf.setCheckSessionIframe(getAsString(o,
"check_session_iframe"));
179 conf.setClaimsLocalesSupported(getAsStringList(o,
"claims_locales_supported"));
180 conf.setClaimsParameterSupported(getAsBoolean(o,
"claims_parameter_supported"));
181 conf.setClaimsSupported(getAsStringList(o,
"claims_supported"));
182 conf.setDisplayValuesSupported(getAsStringList(o,
"display_values_supported"));
183 conf.setEndSessionEndpoint(getAsString(o,
"end_session_endpoint"));
184 conf.setGrantTypesSupported(getAsStringList(o,
"grant_types_supported"));
185 conf.setIdTokenSigningAlgValuesSupported(getAsJwsAlgorithmList(o,
"id_token_signing_alg_values_supported"));
186 conf.setIdTokenEncryptionAlgValuesSupported(getAsJweAlgorithmList(o,
"id_token_encryption_alg_values_supported"));
187 conf.setIdTokenEncryptionEncValuesSupported(getAsEncryptionMethodList(o,
"id_token_encryption_enc_values_supported"));
188 conf.setOpPolicyUri(getAsString(o,
"op_policy_uri"));
189 conf.setOpTosUri(getAsString(o,
"op_tos_uri"));
190 conf.setRequestObjectEncryptionAlgValuesSupported(getAsJweAlgorithmList(o,
"request_object_encryption_alg_values_supported"));
191 conf.setRequestObjectEncryptionEncValuesSupported(getAsEncryptionMethodList(o,
"request_object_encryption_enc_values_supported"));
192 conf.setRequestObjectSigningAlgValuesSupported(getAsJwsAlgorithmList(o,
"request_object_signing_alg_values_supported"));
193 conf.setRequestParameterSupported(getAsBoolean(o,
"request_parameter_supported"));
194 conf.setRequestUriParameterSupported(getAsBoolean(o,
"request_uri_parameter_supported"));
195 conf.setResponseTypesSupported(getAsStringList(o,
"response_types_supported"));
196 conf.setScopesSupported(getAsStringList(o,
"scopes_supported"));
197 conf.setSubjectTypesSupported(getAsStringList(o,
"subject_types_supported"));
198 conf.setServiceDocumentation(getAsString(o,
"service_documentation"));
199 conf.setTokenEndpointAuthMethodsSupported(getAsStringList(o,
"token_endpoint_auth_methods"));
200 conf.setTokenEndpointAuthSigningAlgValuesSupported(getAsJwsAlgorithmList(o,
"token_endpoint_auth_signing_alg_values_supported"));
201 conf.setUiLocalesSupported(getAsStringList(o,
"ui_locales_supported"));
202 conf.setUserinfoEncryptionAlgValuesSupported(getAsJweAlgorithmList(o,
"userinfo_encryption_alg_values_supported"));
203 conf.setUserinfoEncryptionEncValuesSupported(getAsEncryptionMethodList(o,
"userinfo_encryption_enc_values_supported"));
204 conf.setUserinfoSigningAlgValuesSupported(getAsJwsAlgorithmList(o,
"userinfo_signing_alg_values_supported"));
208 throw new IllegalStateException(
"Couldn't parse server discovery results for " + url);
JsonParser parser
Definition: DynamicServerConfigurationService.java:135
HttpComponentsClientHttpRequestFactory httpFactory
Definition: DynamicServerConfigurationService.java:134
static final Logger logger
Definition: DynamicServerConfigurationService.java:64