protected void doDecode(MessageContext messageContext) throws MessageDecodingException {
        if (!(messageContext instanceof SAMLMessageContext)) {
            log.error("Invalid message context type, this decoder only support SAMLMessageContext");
            throw new MessageDecodingException(
                "Invalid message context type, this decoder only support SAMLMessageContext");
        }

        if (!(messageContext.getInboundMessageTransport() instanceof HTTPInTransport)) {
            log.error("Invalid inbound message transport type, this decoder only support HTTPInTransport");
            throw new MessageDecodingException(
                "Invalid inbound message transport type, this decoder only support HTTPInTransport");
        }

        SAMLMessageContext samlMsgCtx = (SAMLMessageContext) messageContext;

        HTTPInTransport inTransport = (HTTPInTransport) samlMsgCtx.getInboundMessageTransport();
        if (!inTransport.getHTTPMethod().equalsIgnoreCase("POST")) {
            throw new MessageDecodingException("This message decoder only supports the HTTP POST method");
        }

        String relayState = inTransport.getParameterValue("RelayState");
        samlMsgCtx.setRelayState(relayState);
        log.debug("Decoded SAML relay state of: {}", relayState);

        InputStream base64DecodedMessage = getBase64DecodedMessage(inTransport);
        Assertion inboundMessage = (Assertion) unmarshallMessage(base64DecodedMessage);
        Response response = SamlRedirectUtils.wrapAssertionIntoResponse(inboundMessage, inboundMessage.getIssuer().getValue());
        samlMsgCtx.setInboundMessage(response);
        samlMsgCtx.setInboundSAMLMessage(response);
        log.debug("Decoded SAML message");

        populateMessageContext(samlMsgCtx);
    }
protected void doDecode ( MessageContext messageContext ) throws MessageDecodingException { if ( ! ( messageContext instanceof SAMLMessageContext ) ) { log . error ( "Invalid message context type, this decoder only support SAMLMessageContext" ) ; throw new MessageDecodingException ( "Invalid message context type, this decoder only support SAMLMessageContext" ) ; } if ( ! ( messageContext . getInboundMessageTransport ( ) instanceof HTTPInTransport ) ) { log . error ( "Invalid inbound message transport type, this decoder only support HTTPInTransport" ) ; throw new MessageDecodingException ( "Invalid inbound message transport type, this decoder only support HTTPInTransport" ) ; } SAMLMessageContext samlMsgCtx = ( SAMLMessageContext ) messageContext ; HTTPInTransport inTransport = ( HTTPInTransport ) samlMsgCtx . getInboundMessageTransport ( ) ; if ( ! inTransport . getHTTPMethod ( ) . equalsIgnoreCase ( "POST" ) ) { throw new MessageDecodingException ( "This message decoder only supports the HTTP POST method" ) ; } String relayState = inTransport . getParameterValue ( "RelayState" ) ; samlMsgCtx . setRelayState ( relayState ) ; log . debug ( "Decoded SAML relay state of: {}" , relayState ) ; InputStream base64DecodedMessage = getBase64DecodedMessage ( inTransport ) ; Assertion inboundMessage = ( Assertion ) unmarshallMessage ( base64DecodedMessage ) ; Response response = SamlRedirectUtils . wrapAssertionIntoResponse ( inboundMessage , inboundMessage . getIssuer ( ) . getValue ( ) ) ; samlMsgCtx . setInboundMessage ( response ) ; samlMsgCtx . setInboundSAMLMessage ( response ) ; log . debug ( "Decoded SAML message" ) ; populateMessageContext ( samlMsgCtx ) ; }
{@inheritDoc}