final String samlResponse = ((String[])params.get(SAMLPluginConstants.SAML_RESPONSE))[0]; Response processedSAMLResponse = SAMLUtils.decodeSAMLResponse(samlResponse); String statusCode = processedSAMLResponse.getStatus().getStatusCode().getValue(); if (!statusCode.equals(StatusCode.SUCCESS_URI)) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, _apiServer.getSerializedApiError(ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
/** {@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()); } }
final String samlResponse = ((String[])params.get(SAMLPluginConstants.SAML_RESPONSE))[0]; Response processedSAMLResponse = this.processSAMLResponse(samlResponse); String statusCode = processedSAMLResponse.getStatus().getStatusCode().getValue(); if (!statusCode.equals(StatusCode.SUCCESS_URI)) { throw new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, apiServer.getSerializedApiError(ApiErrorCode.ACCOUNT_ERROR.getHttpCode(),
/** * Validates the Value attribute * * @param sc * @throws ValidationException */ protected void validateValue(StatusCode sc) throws ValidationException { if (DatatypeHelper.isEmpty(sc.getValue())) { throw new ValidationException("Value attribute is required"); } }
protected boolean isNoPassive(Response response) { return response.getStatus() != null && response.getStatus().getStatusCode() != null && response.getStatus().getStatusCode().getValue().equals(StatusCode.RESPONDER_URI) && response.getStatus().getStatusCode().getStatusCode() != null && response.getStatus().getStatusCode().getStatusCode().getValue().equals( StatusCode.NO_PASSIVE_URI); }
protected boolean isNoPassive(Response response) { return response.getStatus() != null && response.getStatus().getStatusCode() != null && response.getStatus().getStatusCode().getValue().equals(StatusCode.RESPONDER_URI) && response.getStatus().getStatusCode().getStatusCode() != null && response.getStatus().getStatusCode().getStatusCode().getValue().equals( StatusCode.NO_PASSIVE_URI); }
private void validateResponse(Response response) throws SamlException { try { new ResponseSchemaValidator().validate(response); } catch (ValidationException ex) { throw new SamlException("The response schema validation failed", ex); } if (!response.getIssuer().getValue().equals(responseIssuer)) { throw new SamlException("The response issuer didn't match the expected value"); } String statusCode = response.getStatus().getStatusCode().getValue(); if (!statusCode.equals("urn:oasis:names:tc:SAML:2.0:status:Success")) { throw new SamlException("Invalid status code: " + statusCode); } }
samlResponse.getStatus().getStatusCode().getValue().equals("urn:oasis:names:tc:SAML:2.0:status:Responder") && samlResponse.getStatus().getStatusCode().getStatusCode() != null && samlResponse.getStatus().getStatusCode().getStatusCode().getValue().equals("urn:oasis:names:tc:SAML:2.0:status:NoPassive")) {
private void validateArtifactResponse(ArtifactResolve artifactResolve, ArtifactResponse artifactResponse) throws ArtifactResolutionException { if (artifactResponse == null) { throw new ArtifactResolutionException("Received artifact response message was null."); } String artifactResolveId = artifactResolve.getID(); String artifactResponseInResponseTo = artifactResponse.getInResponseTo(); if (!artifactResolveId.equals(artifactResponseInResponseTo)) { throw new ArtifactResolutionException("Artifact resolve ID: " + artifactResolveId + " is not equal to " + "artifact response InResponseTo : " + artifactResponseInResponseTo); } String artifactResponseStatus = artifactResponse.getStatus().getStatusCode().getValue(); if (!StatusCode.SUCCESS_URI.equals(artifactResponseStatus)) { throw new ArtifactResolutionException("Unsuccessful artifact response with status: " + artifactResponseStatus); } SAMLObject message = artifactResponse.getMessage(); if (message == null) { throw new ArtifactResolutionException("No SAML response embedded into the artifact response."); } }
request.getParameter(SSOAgentConstants.SAML2SSO.SAML2_ARTIFACT_RESP)); if (!StringUtils.equals(artifactResponse.getStatus().getStatusCode().getValue(), StatusCode.SUCCESS_URI)) { throw new SSOAgentException("Received an invalid SAML response with status code: " + artifactResponse.getStatus().getStatusCode().getValue());
public static Assertion buildAssertion(SAMLPrincipal principal, Status status, String entityId) { Assertion assertion = buildSAMLObject(Assertion.class, Assertion.DEFAULT_ELEMENT_NAME); if (status.getStatusCode().getValue().equals(StatusCode.SUCCESS_URI)) { Subject subject = buildSubject(principal.getNameID(), principal.getNameIDType(), principal.getAssertionConsumerServiceURL(), principal.getRequestID()); assertion.setSubject(subject); } Issuer issuer = buildIssuer(entityId); Audience audience = buildSAMLObject(Audience.class, Audience.DEFAULT_ELEMENT_NAME); audience.setAudienceURI(principal.getServiceProviderEntityID()); AudienceRestriction audienceRestriction = buildSAMLObject(AudienceRestriction.class, AudienceRestriction.DEFAULT_ELEMENT_NAME); audienceRestriction.getAudiences().add(audience); Conditions conditions = buildSAMLObject(Conditions.class, Conditions.DEFAULT_ELEMENT_NAME); conditions.getAudienceRestrictions().add(audienceRestriction); assertion.setConditions(conditions); AuthnStatement authnStatement = buildAuthnStatement(new DateTime(), entityId); assertion.setIssuer(issuer); assertion.getAuthnStatements().add(authnStatement); assertion.getAttributeStatements().add(buildAttributeStatement(principal.getAttributes())); assertion.setID(randomSAMLId()); assertion.setIssueInstant(new DateTime()); return assertion; }
String statusValue = statusCode.getValue(); if (!StatusCode.SUCCESS_URI.equals(statusValue)) { throw new AuthenticationResponseProcessorException(
if (response.getStatus() != null && response.getStatus().getStatusCode() != null && response.getStatus().getStatusCode().getValue().equals(StatusCode.RESPONDER_URI) && response.getStatus().getStatusCode().getStatusCode() != null && response.getStatus().getStatusCode().getStatusCode().getValue().equals(StatusCode.NO_PASSIVE_URI)) { return null;
|| response.getStatus().getStatusCode() == null || !(StatusCode.SUCCESS_URI .equals(response.getStatus().getStatusCode().getValue()))) { throw new ValidationException("Response has an unsuccessful status code");
String statusCode = response.getStatus().getStatusCode().getValue(); if (StatusCode.SUCCESS_URI.equals(statusCode)) { log.debug("Single Logout was successful"); } else { String message1 = response.getStatus().getStatusCode().getValue(); String message2 = "N/A"; StatusMessage status = response.getStatus().getStatusMessage();
String statusCode = response.getStatus().getStatusCode().getValue(); if (!StatusCode.SUCCESS_URI.equals(statusCode)) { StatusMessage statusMessage = response.getStatus().getStatusMessage();
response.getStatus().getStatusCode() == null || !(StatusCode.SUCCESS_URI .equals(response.getStatus().getStatusCode().getValue()))) { throw new ValidationException( "Response has an unsuccessful status code");