issuer = ((RequestAbstractType) message).getIssuer(); } else if (message instanceof StatusResponseType) { issuer = ((StatusResponseType) message).getIssuer(); } else { throw new SamlException("invalid message type: " + message.getClass().getSimpleName());
StatusResponseType sr = (StatusResponseType) samlObject; if (sr.getVersion() != null) { domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); if (sr.getID() != null) { domElement.setAttributeNS(null, StatusResponseType.ID_ATTRIB_NAME, sr.getID()); domElement.setIdAttributeNS(null, StatusResponseType.ID_ATTRIB_NAME, true); if (sr.getInResponseTo() != null) { domElement.setAttributeNS(null, StatusResponseType.IN_RESPONSE_TO_ATTRIB_NAME, sr.getInResponseTo()); if (sr.getVersion() != null) { domElement.setAttributeNS(null, StatusResponseType.VERSION_ATTRIB_NAME, sr.getVersion().toString()); if (sr.getIssueInstant() != null) { String iiStr = SAMLConfigurationSupport.getSAMLDateFormatter().print(sr.getIssueInstant()); domElement.setAttributeNS(null, StatusResponseType.ISSUE_INSTANT_ATTRIB_NAME, iiStr); if (sr.getDestination() != null) { domElement.setAttributeNS(null, StatusResponseType.DESTINATION_ATTRIB_NAME, sr.getDestination()); if (sr.getConsent() != null) { domElement.setAttributeNS(null, StatusResponseType.CONSENT_ATTRIB_NAME, sr.getConsent());
/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { StatusResponseType sr = (StatusResponseType) samlObject; if (attribute.getLocalName().equals(StatusResponseType.VERSION_ATTRIB_NAME)) { sr.setVersion(SAMLVersion.valueOf(attribute.getValue())); } else if (attribute.getLocalName().equals(StatusResponseType.ID_ATTRIB_NAME)) { sr.setID(attribute.getValue()); attribute.getOwnerElement().setIdAttributeNode(attribute, true); } else if (attribute.getLocalName().equals(StatusResponseType.IN_RESPONSE_TO_ATTRIB_NAME)) { sr.setInResponseTo(attribute.getValue()); } else if (attribute.getLocalName().equals(StatusResponseType.ISSUE_INSTANT_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { sr.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(StatusResponseType.DESTINATION_ATTRIB_NAME)) { sr.setDestination(attribute.getValue()); } else if (attribute.getLocalName().equals(StatusResponseType.CONSENT_ATTRIB_NAME)) { sr.setConsent(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } }
org.opensaml.saml.saml2.core.StatusResponseType response = (org.opensaml.saml.saml2.core.StatusResponseType) samlMessage; return response.getID();
/** {@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; }
/** {@inheritDoc} */ @Override @Nullable public String apply(@Nullable final ProfileRequestContext input) { final SAMLObject response = responseLookupStrategy.apply(input); if (response != null) { if (response instanceof ResponseAbstractType) { return ((ResponseAbstractType) response).getInResponseTo(); } else if (response instanceof StatusResponseType) { return ((StatusResponseType) response).getInResponseTo(); } } return null; }
/** * Sets the destination attribute on an outbound message if it is either a * {@link org.opensaml.saml.saml2.core.RequestAbstractType} or a * {@link org.opensaml.saml.saml2.core.StatusResponseType} message. * * @param outboundMessage outbound SAML message * @param endpointURL destination endpoint */ public static void setSAML2Destination(@Nonnull final SAMLObject outboundMessage, @Nonnull @NotEmpty final String endpointURL) { if (outboundMessage instanceof org.opensaml.saml.saml2.core.RequestAbstractType) { ((org.opensaml.saml.saml2.core.RequestAbstractType) outboundMessage).setDestination(endpointURL); } else if (outboundMessage instanceof org.opensaml.saml.saml2.core.StatusResponseType) { ((org.opensaml.saml.saml2.core.StatusResponseType) outboundMessage).setDestination(endpointURL); } }
org.opensaml.saml.saml2.core.StatusResponseType response = (org.opensaml.saml.saml2.core.StatusResponseType) samlMessage; return response.getIssueInstant();
org.opensaml.saml.saml2.core.StatusResponseType response = (org.opensaml.saml.saml2.core.StatusResponseType) samlMessage; messageDestination = StringSupport.trimOrNull(response.getDestination());
messageStorage.storeMessage(((RequestAbstractType) request).getID(), request); } else if (request instanceof StatusResponseType) { messageStorage.storeMessage(((StatusResponseType) request).getID(), request);
/** {@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.StatusMessage msg = ((Response) response).getStatus() != null ? ((Response) response).getStatus().getStatusMessage() : null; if (msg != null) { return msg.getMessage(); } } else if (response instanceof StatusResponseType) { final org.opensaml.saml.saml2.core.StatusMessage msg = ((StatusResponseType) response).getStatus() != null ? ((StatusResponseType) response).getStatus().getStatusMessage() : null; if (msg != null) { return msg.getMessage(); } } } return null; }
/** * Resolve the SAML entity ID from a SAML 2 response. * * @param response the response * * @return the entity ID, or null if it could not be resolved */ @Nullable protected String processSaml2Response( @Nonnull final org.opensaml.saml.saml2.core.StatusResponseType response) { if (response.getIssuer() != null) { return processSaml2Issuer(response.getIssuer()); } 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; }
/** * Gets issuer from saml response. * * @param response the response * @return the issuer from saml response */ private static String getIssuerFromSamlResponse(final StatusResponseType response) { return response.getIssuer().getValue(); }
/** * Gets issuer from saml object. * * @param object the object * @return the issuer from saml object */ public static String getIssuerFromSamlObject(final SAMLObject object) { if (object instanceof RequestAbstractType) { return RequestAbstractType.class.cast(object).getIssuer().getValue(); } if (object instanceof StatusResponseType) { return StatusResponseType.class.cast(object).getIssuer().getValue(); } return null; }
issuer = ((RequestAbstractType) message).getIssuer(); } else if (message instanceof StatusResponseType) { issuer = ((StatusResponseType) message).getIssuer(); } else { throw new SamlException("invalid message type: " + message.getClass().getSimpleName());