OPENDJ-3096 Fix incorrect response status code
In the case where rest2ldap were not able to resolve the authzIdTemplate with an access token we were returned a 403 (forbidden) error response.
As Matt pointed out, this is not a client application here so we now return a 500 (internal server error) with no error message.
| | |
| | | try { |
| | | authz.put(template.getSecurityContextID(), template.formatAsAuthzId(token.asJsonValue())); |
| | | } catch (final IllegalArgumentException e) { |
| | | return newResultPromise(new Response().setStatus(Status.FORBIDDEN) |
| | | .setCause(e) |
| | | .setEntity(ERR_AUTHZID_DECODER_RESPONSE.get().toString())); |
| | | return newResultPromise(new Response().setStatus(Status.INTERNAL_SERVER_ERROR) |
| | | .setCause(e)); |
| | | } |
| | | final Context securityContext = new SecurityContext(context, token.getToken(), authz); |
| | | return next.handle(securityContext, request); |
| | |
| | | security principal '%s' could not be determined |
| | | ERR_AUTHZID_DECODER_PRINCIPAL_INVALID_DATA_TYPE_18=The request could not be authorized because the required \ |
| | | security principal '%s' had an invalid data type |
| | | ERR_AUTHZID_DECODER_RESPONSE_19=Invalid configuration |
| | | ERR_RESOLVING_AUTHZID_TEMPLATE_20=Unable to resolve oauthzid template placeholders for access token '%s': '%s' |
| | | # Runtime errors > OAuth2 > CTS Resolver |
| | | ERR_OAUTH2_CTS_INVALID_TOKEN_TYPE_21=The token '%s' must be an access token, but it is a '%s' |