If the deserializeAsModel()
method detects an error while deserializing
the model, it throws an AuthnErrorException
. If the added validation checks
in validateSubmittedAttributes
detect an error, they also throw this
exception.
The adapter should catch this exception and send an API error response using the method
AuthnApiSupport.writeErrorResponse()
.
try
{
...
}
catch (AuthnErrorException e)
{
// A validation error occurred while processing an API request, return an error response to the API client
apiSupport.writeErrorResponse(req, resp, e.getValidationError());
authnAdapterResponse.setAuthnStatus(AUTHN_STATUS.IN_PROGRESS);
return authnAdapterResponse;
}