/** {@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); } }
/** {@inheritDoc} */ @Override protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException { final Object response = messageContext.getMessage(); if (response == null) { throw new MessageHandlerException("Message not found"); } else if (!(response instanceof StatusResponseType)) { throw new MessageHandlerException("Message was not a StatusResponseType"); } final SAMLConsentContext consentContext = consentContextStrategy.apply(messageContext); if (consentContext == null || consentContext.getConsent() == null) { throw new MessageHandlerException("Consent value not found"); } ((StatusResponseType) response).setConsent(consentContext.getConsent()); }