Update the metainformation for a given client.
276 ClientDetailsEntity newClient = null;
278 newClient = ClientDetailsEntityJsonProcessor.parse(jsonString);
279 }
catch (JsonSyntaxException e) {
282 logger.error(
"updateProtectedResource failed; submitted JSON is malformed");
283 m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
284 return HttpCodeView.VIEWNAME;
289 if (newClient != null && oldClient != null
290 && oldClient.getClientId().equals(auth.getOAuth2Request().getClientId())
291 && oldClient.getClientId().equals(newClient.getClientId())
297 newClient.setCreatedAt(oldClient.getCreatedAt());
300 newClient.setGrantTypes(
new HashSet<String>());
301 newClient.setResponseTypes(
new HashSet<String>());
302 newClient.setRedirectUris(
new HashSet<String>());
305 newClient.setAccessTokenValiditySeconds(0);
306 newClient.setIdTokenValiditySeconds(0);
307 newClient.setRefreshTokenValiditySeconds(0);
310 newClient.setDefaultACRvalues(
new HashSet<String>());
311 newClient.setDefaultMaxAge(null);
312 newClient.setIdTokenEncryptedResponseAlg(null);
313 newClient.setIdTokenEncryptedResponseEnc(null);
314 newClient.setIdTokenSignedResponseAlg(null);
315 newClient.setInitiateLoginUri(null);
316 newClient.setPostLogoutRedirectUris(null);
317 newClient.setRequestObjectSigningAlg(null);
318 newClient.setRequireAuthTime(null);
319 newClient.setReuseRefreshToken(
false);
320 newClient.setSectorIdentifierUri(null);
321 newClient.setSubjectType(null);
322 newClient.setUserInfoEncryptedResponseAlg(null);
323 newClient.setUserInfoEncryptedResponseEnc(null);
324 newClient.setUserInfoSignedResponseAlg(null);
327 newClient.setDynamicallyRegistered(
true);
330 newClient.setAllowIntrospection(
true);
336 }
catch (ValidationException ve) {
338 m.addAttribute(JsonErrorView.ERROR, ve.getError());
339 m.addAttribute(JsonErrorView.ERROR_MESSAGE, ve.getErrorDescription());
340 m.addAttribute(HttpCodeView.CODE, ve.getStatus());
341 return JsonErrorView.VIEWNAME;
352 RegisteredClient registered =
new RegisteredClient(savedClient, token.getValue(),
config.
getIssuer() +
"resource/" + UriUtils.encodePathSegment(savedClient.getClientId(),
"UTF-8"));
355 m.addAttribute(
"client", registered);
356 m.addAttribute(HttpCodeView.CODE, HttpStatus.OK);
358 return ClientInformationResponseView.VIEWNAME;
359 }
catch (UnsupportedEncodingException e) {
360 logger.error(
"Unsupported encoding", e);
361 m.addAttribute(HttpCodeView.CODE, HttpStatus.INTERNAL_SERVER_ERROR);
362 return HttpCodeView.VIEWNAME;
363 }
catch (IllegalArgumentException e) {
364 logger.error(
"Couldn't save client", e);
366 m.addAttribute(JsonErrorView.ERROR,
"invalid_client_metadata");
367 m.addAttribute(JsonErrorView.ERROR_MESSAGE,
"Unable to save client due to invalid or inconsistent metadata.");
368 m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
370 return JsonErrorView.VIEWNAME;
374 logger.error(
"updateProtectedResource" +
375 " failed, client ID mismatch: " 376 + clientId +
" and " + auth.getOAuth2Request().getClientId() +
" do not match.");
377 m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
379 return HttpCodeView.VIEWNAME;
ConfigurationPropertiesBean config
Definition: ProtectedResourceRegistrationEndpoint.java:77
OAuth2AccessTokenEntity fetchValidRegistrationToken(OAuth2Authentication auth, ClientDetailsEntity client)
Definition: ProtectedResourceRegistrationEndpoint.java:440
void setClientSecret(String clientSecret)
Definition: ClientDetailsEntity.java:425
ClientDetailsEntity validateAuth(ClientDetailsEntity newClient)
Definition: ProtectedResourceRegistrationEndpoint.java:413
ClientDetailsEntityService clientService
Definition: ProtectedResourceRegistrationEndpoint.java:68
static final Logger logger
Definition: ProtectedResourceRegistrationEndpoint.java:85
ClientDetailsEntity updateClient(ClientDetailsEntity oldClient, ClientDetailsEntity newClient)
ClientDetailsEntity loadClientByClientId(String clientId)
ClientDetailsEntity validateScopes(ClientDetailsEntity newClient)
Definition: ProtectedResourceRegistrationEndpoint.java:203
String getIssuer()
Definition: ConfigurationPropertiesBean.java:100