Class AuthorizationErrorResponseExceptionHandler
- java.lang.Object
-
- io.micronaut.security.oauth2.endpoint.authorization.response.AuthorizationErrorResponseExceptionHandler
-
- All Implemented Interfaces:
io.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationErrorResponseException,io.micronaut.http.MutableHttpResponse<?>>
@Singleton public class AuthorizationErrorResponseExceptionHandler extends java.lang.Object implements io.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationErrorResponseException,io.micronaut.http.MutableHttpResponse<?>>
An exception handler forAuthorizationErrorResponseException.- Since:
- 1.2.0
-
-
Constructor Summary
Constructors Constructor Description AuthorizationErrorResponseExceptionHandler()Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIAuthorizationErrorResponseExceptionHandler(io.micronaut.security.config.RedirectConfiguration redirectConfiguration, io.micronaut.security.config.RedirectService redirectService, io.micronaut.http.server.exceptions.response.ErrorResponseProcessor<?> errorResponseProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetRedirectUri(io.micronaut.http.HttpRequest<?> request, AuthorizationErrorResponseException exception)io.micronaut.http.MutableHttpResponse<?>handle(io.micronaut.http.HttpRequest request, AuthorizationErrorResponseException exception)protected io.micronaut.http.MutableHttpResponse<?>httpResponseWithStatus(io.micronaut.http.HttpRequest<?> request, AuthorizationErrorResponseException exception)protected io.micronaut.http.MutableHttpResponse<?>httpResponseWithStatus(java.net.URI location)Builds a HTTP Response redirection to the supplied location.protected booleanshouldRedirect(io.micronaut.http.HttpRequest<?> request, AuthorizationErrorResponseException exception)Decides whether the request should be handled with a redirect.
-
-
-
Constructor Detail
-
AuthorizationErrorResponseExceptionHandler
@Inject public AuthorizationErrorResponseExceptionHandler(@Nullable io.micronaut.security.config.RedirectConfiguration redirectConfiguration, @Nullable io.micronaut.security.config.RedirectService redirectService, @Nullable io.micronaut.http.server.exceptions.response.ErrorResponseProcessor<?> errorResponseProcessor)- Parameters:
redirectConfiguration- Redirect ConfigurationredirectService- Redirect ServiceerrorResponseProcessor- Error Response Processor
-
AuthorizationErrorResponseExceptionHandler
@Deprecated public AuthorizationErrorResponseExceptionHandler()
Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIDefault constructor.
-
-
Method Detail
-
handle
public io.micronaut.http.MutableHttpResponse<?> handle(io.micronaut.http.HttpRequest request, AuthorizationErrorResponseException exception)- Specified by:
handlein interfaceio.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationErrorResponseException,io.micronaut.http.MutableHttpResponse<?>>
-
httpResponseWithStatus
@NonNull protected io.micronaut.http.MutableHttpResponse<?> httpResponseWithStatus(@NonNull java.net.URI location)Builds a HTTP Response redirection to the supplied location.- Parameters:
location- The Uri to redirect to- Returns:
- an HTTP response with the Uri as location
-
httpResponseWithStatus
@NonNull protected io.micronaut.http.MutableHttpResponse<?> httpResponseWithStatus(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull AuthorizationErrorResponseException exception)- Parameters:
request- The requestexception- The exception- Returns:
- The response to be used when a redirect is not appropriate
-
getRedirectUri
@NonNull protected java.lang.String getRedirectUri(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull AuthorizationErrorResponseException exception)- Parameters:
request- The requestexception- The exception- Returns:
- The URI to redirect to
-
shouldRedirect
protected boolean shouldRedirect(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull AuthorizationErrorResponseException exception)Decides whether the request should be handled with a redirect.- Parameters:
request- The HTTP Requestexception- The authorization exception- Returns:
- true if the request accepts text/html
-
-