Class SignInMethodExceptionHandler
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
com.irurueta.authserver.authorization.api.web.ProblemJsonExceptionHandler
com.irurueta.authserver.authorization.api.web.social.SignInMethodExceptionHandler
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.MessageSourceAware
- Direct Known Subclasses:
CertificateExceptionHandler,IdentityExceptionHandler
Base of the exception handlers of the APIs that remove a sign-in method of the account (the linked identities, the
bound certificates): both refuse to remove the last way to sign in and both need a recent multi-factor sign-in, so
both answer those failures the same way. The step-up challenge is the one the rest of the account API gives
(
MfaExceptionHandler), so a client handles the same 401 everywhere. Each subclass is the
@RestControllerAdvice of its own API and names the base of its problem types.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MfaExceptionHandlerBuilds the step-up challenge.private final StringBase of the problem type URNs of the API, for exampleurn:problem:identity:.Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSignInMethodExceptionHandler(String typeBase, MfaExceptionHandler mfaExceptionHandler) Creates the handler. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> Answers a token whose sign-in is not recent or strong enough:401with the RFC 9470 challenge.org.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> handleLastSignInMethod(LastSignInMethodException exception) Answers a sign-in method that is the last way to sign in to the account.protected org.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> Builds a problem response whose type is below the base of the API.Methods inherited from class com.irurueta.authserver.authorization.api.web.ProblemJsonExceptionHandler
createResponseEntity, problemResponse, problemResponseMethods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
createProblemDetail, getMessageSource, handleAsyncRequestNotUsableException, handleAsyncRequestTimeoutException, handleConversionNotSupported, handleErrorResponseException, handleException, handleExceptionInternal, handleHandlerMethodValidationException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMaxUploadSizeExceededException, handleMethodArgumentNotValid, handleMethodValidationException, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleNoResourceFoundException, handleServletRequestBindingException, handleTypeMismatch, setMessageSource
-
Field Details
-
typeBase
Base of the problem type URNs of the API, for exampleurn:problem:identity:. -
mfaExceptionHandler
Builds the step-up challenge.
-
-
Constructor Details
-
SignInMethodExceptionHandler
Creates the handler.- Parameters:
typeBase- base of the problem type URNs of the API.mfaExceptionHandler- builds the step-up challenge.
-
-
Method Details
-
handleLastSignInMethod
@ExceptionHandler(LastSignInMethodException.class) public org.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> handleLastSignInMethod(LastSignInMethodException exception) Answers a sign-in method that is the last way to sign in to the account.- Parameters:
exception- the failure.- Returns:
- the
409problem detail.
-
handleInsufficientUserAuthentication
@ExceptionHandler(InsufficientUserAuthenticationException.class) public org.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> handleInsufficientUserAuthentication(InsufficientUserAuthenticationException exception) Answers a token whose sign-in is not recent or strong enough:401with the RFC 9470 challenge.- Parameters:
exception- the failure.- Returns:
- the
401problem detail with theWWW-Authenticatechallenge.
-
respond
protected org.springframework.http.ResponseEntity<org.springframework.http.ProblemDetail> respond(org.springframework.http.HttpStatus status, String type, String title, String detail) Builds a problem response whose type is below the base of the API.- Parameters:
status- HTTP status.type- last segment of the problem type.title- short summary.detail- explanation.- Returns:
- the response.
-