use of com.nimbusds.oauth2.sdk.AuthorizationErrorResponse in project Kustvakt by KorAP.
the class OpenIdResponseHandler method createAuthorizationErrorResponse.
/**
* According to OpenID connect core 1.0 specification, all
* authentication errors must be represented through
* AuthenticationErrorResponse. Moreover, for authorization code
* flow, the error response parameters must be added to the
* redirect URI as query parameters, unless a different response
* mode was specified.
*
* {@link AuthorizationErrorResponse} defines specific
* {@link ErrorObject}s regarding OAUTH2 errors.
* {@link AuthenticationErrorResponse} defines additional
* ErrorObjects regarding OpenID connect authenticaition errors.
*
* @param e
* a {@link KustvaktException}
* @param isAuthentication
* @param redirectURI
* @param state
* @param responseMode
* @return a redirect uri with error response parameters as part
* of query parameters
*/
public Response createAuthorizationErrorResponse(KustvaktException e, boolean isAuthentication, URI redirectURI, State state, ResponseMode responseMode) {
ErrorObject errorObject = createErrorObject(e);
errorObject = errorObject.setDescription(e.getMessage());
if (redirectURI == null) {
return Response.status(errorObject.getHTTPStatusCode()).entity(errorObject.toJSONObject()).build();
}
URI uri = null;
if (isAuthentication) {
uri = new AuthenticationErrorResponse(redirectURI, errorObject, state, responseMode).toURI();
} else {
uri = new AuthorizationErrorResponse(redirectURI, errorObject, state, responseMode).toURI();
}
ResponseBuilder builder = Response.temporaryRedirect(uri).type(MediaType.APPLICATION_FORM_URLENCODED);
return builder.build();
}
use of com.nimbusds.oauth2.sdk.AuthorizationErrorResponse in project asgardeo-java-oidc-sdk by asgardeo.
the class DefaultOIDCManager method handleErrorAuthorizationResponse.
private void handleErrorAuthorizationResponse(AuthorizationResponse authorizationResponse) {
AuthorizationErrorResponse errorResponse = authorizationResponse.toErrorResponse();
JSONObject responseObject = errorResponse.getErrorObject().toJSONObject();
logger.log(Level.INFO, "Error response object: " + responseObject);
}
use of com.nimbusds.oauth2.sdk.AuthorizationErrorResponse in project asgardeo-java-oidc-sdk by asgardeo.
the class OIDCRequestResolver method logErrorAuthorizationResponse.
private void logErrorAuthorizationResponse(AuthorizationResponse authzResponse) {
AuthorizationErrorResponse errorResponse = authzResponse.toErrorResponse();
JSONObject responseObject = errorResponse.getErrorObject().toJSONObject();
logger.log(Level.INFO, "Error response object: ", responseObject);
}
Aggregations