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