private Assertion getValidatedAssertion(Response response, String endpointUri) { final Status status = response.getStatus(); final String statusCode = status.getStatusCode().getValue(); if (!StatusCode.SUCCESS.equals(statusCode)) { throw new SamlException("response status code: " + statusCode +
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException { StatusCode statusCode = (StatusCode) samlObject; if (statusCode.getValue() != null) { domElement.setAttributeNS(null, StatusCode.VALUE_ATTRIB_NAME, statusCode.getValue()); } }
/** * Validates that the response is a success. * * @param status the response status. */ protected final void validateSuccess(final Status status) { String statusValue = status.getStatusCode().getValue(); if (!StatusCode.SUCCESS.equals(statusValue)) { final StatusMessage statusMessage = status.getStatusMessage(); if (statusMessage != null) { statusValue += " / " + statusMessage.getMessage(); } throw new SAMLException("Response is not success ; actual " + statusValue); } }
/** {@inheritDoc} */ @Override @Nullable public String apply(@Nullable final ProfileRequestContext input) { final SAMLObject response = responseLookupStrategy.apply(input); if (response != null) { if (response instanceof Response) { final org.opensaml.saml.saml1.core.StatusCode sc = ((Response) response).getStatus() != null ? ((Response) response).getStatus().getStatusCode() : null; if (sc != null && sc.getValue() != null) { return sc.getValue().getLocalPart(); } } else if (response instanceof StatusResponseType) { final org.opensaml.saml.saml2.core.StatusCode sc = ((StatusResponseType) response).getStatus() != null ? ((StatusResponseType) response).getStatus().getStatusCode() : null; if (sc != null) { return sc.getValue(); } } } return null; }
/** * Get whether the message is a SAML response containing an error status. * * @param message message to check * * @return true iff the message is a SAML response containing an error status */ private boolean isErrorResponse(@Nullable final Object message) { if (message != null) { if (message instanceof Response) { if (((Response) message).getStatus() != null) { final org.opensaml.saml.saml1.core.StatusCode s1 = ((Response) message).getStatus().getStatusCode(); return s1 != null && s1.getValue() != null && !org.opensaml.saml.saml1.core.StatusCode.SUCCESS.equals(s1.getValue()); } } else if (message instanceof StatusResponseType) { if (((StatusResponseType) message).getStatus() != null) { final org.opensaml.saml.saml2.core.StatusCode s2 = ((StatusResponseType) message).getStatus().getStatusCode(); return s2 != null && s2.getValue() != null && !org.opensaml.saml.saml2.core.StatusCode.SUCCESS.equals(s2.getValue()); } } } return false; }
/** * Returns true if the identity provider cannot authenticate the principal passively, as requested, else false. * * @param response the SAML 2.0 Response to be evaluated * @return true if the identity provider cannot authenticate the principal passively, as requested, else false */ private boolean isNoPassive(Response response) { return (response.getStatus() != null) && (response.getStatus().getStatusCode() != null) && (response.getStatus().getStatusCode().getValue().equals(StatusCode.RESPONDER)) && (response.getStatus().getStatusCode().getStatusCode() != null) && (response.getStatus().getStatusCode().getStatusCode().getValue().equals(StatusCode.NO_PASSIVE)); }
if (StatusCode.SUCCESS.equals(logoutResponse.getStatus().getStatusCode().getValue())) { accessTokenDAO.delete(consumer.getJwtClaims().getTokenId()); } else { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown); if (logoutResponse.getStatus().getStatusMessage() == null) { sce.getElements().add(logoutResponse.getStatus().getStatusCode().getValue()); } else { sce.getElements().add(logoutResponse.getStatus().getStatusMessage().getMessage());
protected Status getStatus(org.opensaml.saml.saml2.core.Status status) { return new Status() .setCode(StatusCode.fromUrn(status.getStatusCode().getValue())) .setMessage(status.getStatusMessage() != null ? status.getStatusMessage().getMessage() : null); }
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity"); if (!SAML2_STATUSCODE_SUCCESS.equals(samlResponse.getStatus().getStatusCode().getValue())) { LOG.fine( "SAML Status code of " + samlResponse.getStatus().getStatusCode().getValue() + "does not equal " + SAML2_STATUSCODE_SUCCESS );
private Assertion getValidatedAssertion(Response response, String endpointUri) { final Status status = response.getStatus(); final String statusCode = status.getStatusCode().getValue(); if (!StatusCode.SUCCESS.equals(statusCode)) { throw new SamlException("response status code: " + statusCode +