Java Code Examples for org.opensaml.saml.saml2.core.StatusCode#AUTHN_FAILED

The following examples show how to use org.opensaml.saml.saml2.core.StatusCode#AUTHN_FAILED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatchingResponderCodeTranslator.java    From verify-service-provider with MIT License 6 votes vote down vote up
@Override
public TranslatedResponseBody translateResponderCode(StatusCode statusCode) {
    Optional.ofNullable(statusCode.getStatusCode())
        .orElseThrow(() -> new SamlResponseValidationException("Missing status code for non-Success response"));
    String subStatus = statusCode.getStatusCode().getValue();

    switch (subStatus) {
        case SamlStatusCode.NO_MATCH:
            return new TranslatedMatchingResponseBody(MatchingScenario.NO_MATCH, null, null, null);
        case StatusCode.REQUESTER:
            return new TranslatedMatchingResponseBody(MatchingScenario.REQUEST_ERROR, null, null, null);
        case StatusCode.NO_AUTHN_CONTEXT:
            return new TranslatedMatchingResponseBody(MatchingScenario.CANCELLATION, null, null, null);
        case StatusCode.AUTHN_FAILED:
            return new TranslatedMatchingResponseBody(MatchingScenario.AUTHENTICATION_FAILED, null, null, null);
        default:
            throw new SamlResponseValidationException(String.format("Unknown SAML sub-status: %s", subStatus));
    }
}
 
Example 2
Source File: IdentityResponderCodeTranslator.java    From verify-service-provider with MIT License 6 votes vote down vote up
@Override
public TranslatedNonMatchingResponseBody translateResponderCode(StatusCode statusCode) {
    Optional.ofNullable(statusCode.getStatusCode())
        .orElseThrow(() -> new SamlResponseValidationException("Missing status code for non-Success response"));
    String subStatus = statusCode.getStatusCode().getValue();

    switch (subStatus) {
        case StatusCode.REQUESTER:
            return new TranslatedNonMatchingResponseBody(NonMatchingScenario.REQUEST_ERROR, null, null, null);
        case StatusCode.NO_AUTHN_CONTEXT:
            return new TranslatedNonMatchingResponseBody(NonMatchingScenario.NO_AUTHENTICATION, null, null, null);
        case StatusCode.AUTHN_FAILED:
            return new TranslatedNonMatchingResponseBody(NonMatchingScenario.AUTHENTICATION_FAILED, null, null, null);
        default:
            throw new SamlResponseValidationException(String.format("Unknown SAML sub-status: %s", subStatus));
    }
}