Class DefaultAuthorizationExceptionHandler
- java.lang.Object
-
- io.micronaut.security.authentication.DefaultAuthorizationExceptionHandler
-
- All Implemented Interfaces:
io.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationException,io.micronaut.http.MutableHttpResponse<?>>
@Singleton public class DefaultAuthorizationExceptionHandler extends java.lang.Object implements io.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationException,io.micronaut.http.MutableHttpResponse<?>>
Provides the default behavior for responding to anAuthorizationException.- Since:
- 1.4.0
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthorizationExceptionHandler()Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIDefaultAuthorizationExceptionHandler(RedirectConfiguration redirectConfiguration, RedirectService redirectService, PriorToLoginPersistence priorToLoginPersistence)Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIDefaultAuthorizationExceptionHandler(RedirectConfiguration redirectConfiguration, PriorToLoginPersistence priorToLoginPersistence)Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor API
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.StringgetRedirectUri(io.micronaut.http.HttpRequest<?> request, AuthorizationException exception)io.micronaut.http.MutableHttpResponse<?>handle(io.micronaut.http.HttpRequest request, AuthorizationException exception)protected io.micronaut.http.MutableHttpResponse<?>httpResponseWithStatus(io.micronaut.http.HttpRequest<?> request, AuthorizationException exception)protected io.micronaut.http.MutableHttpResponse<?>httpResponseWithStatus(java.net.URI location)Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIprotected booleanshouldRedirect(io.micronaut.http.HttpRequest<?> request, AuthorizationException exception)Decides whether the request should be handled with a redirect.
-
-
-
Constructor Detail
-
DefaultAuthorizationExceptionHandler
@Deprecated public DefaultAuthorizationExceptionHandler()
Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIDefault constructor.
-
DefaultAuthorizationExceptionHandler
@Deprecated public DefaultAuthorizationExceptionHandler(RedirectConfiguration redirectConfiguration, @Nullable PriorToLoginPersistence priorToLoginPersistence)
Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor API- Parameters:
redirectConfiguration- Redirect configurationpriorToLoginPersistence- Persistence mechanism to redirect to prior login url
-
DefaultAuthorizationExceptionHandler
@Inject @Deprecated public DefaultAuthorizationExceptionHandler(RedirectConfiguration redirectConfiguration, RedirectService redirectService, @Nullable PriorToLoginPersistence priorToLoginPersistence)
Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor API- Parameters:
redirectConfiguration- Redirect configurationredirectService- Redirection ServicepriorToLoginPersistence- Persistence mechanism to redirect to prior login url
-
-
Method Detail
-
handle
public io.micronaut.http.MutableHttpResponse<?> handle(io.micronaut.http.HttpRequest request, AuthorizationException exception)- Specified by:
handlein interfaceio.micronaut.http.server.exceptions.ExceptionHandler<AuthorizationException,io.micronaut.http.MutableHttpResponse<?>>
-
httpResponseWithStatus
protected io.micronaut.http.MutableHttpResponse<?> httpResponseWithStatus(io.micronaut.http.HttpRequest<?> request, AuthorizationException exception)- Parameters:
request- The requestexception- The exception- Returns:
- The response to be used when a redirect is not appropriate
-
shouldRedirect
protected boolean shouldRedirect(io.micronaut.http.HttpRequest<?> request, AuthorizationException 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
-
getRedirectUri
protected java.lang.String getRedirectUri(io.micronaut.http.HttpRequest<?> request, AuthorizationException exception)- Parameters:
request- The requestexception- The exception- Returns:
- The URI to redirect to
-
httpResponseWithStatus
@Deprecated protected io.micronaut.http.MutableHttpResponse<?> httpResponseWithStatus(java.net.URI location)
Deprecated.This will be removed in the next major version, so that this class uses the ErrorProcessor APIBuilds a HTTP Response redirection to the supplied location.- Parameters:
location- The Uri to redirect to- Returns:
- an HTTP response with the Uri as location
-
-