Package org.opensaml.ws.message.decoder

Examples of org.opensaml.ws.message.decoder.MessageDecodingException


                        invokeHandlerChain(inboundHandlerChain, messageContext);
                    }
                }
            } catch (HandlerException e) {
                log.error("Encountered pre-SecurityPolicy HandlerException when decoding message: {}", e.getMessage());
                throw new MessageDecodingException("Pre-SecurityPolicy Handler exception while decoding message", e);
            }
        }
    }
View Full Code Here


                        invokeHandlerChain(inboundHandlerChain, messageContext);
                    }
                }
            } catch (HandlerException e) {
                log.error("Encountered post-SecurityPolicy HandlerException when decoding message: {}", e.getMessage());
                throw new MessageDecodingException("Handler exception while decoding message", e);
            }
        }
    }
View Full Code Here

    @Override
    protected String getActualReceiverEndpointURI(final SAMLMessageContext messageContext)
            throws MessageDecodingException {
        InTransport inTransport = messageContext.getInboundMessageTransport();
        if (!(inTransport instanceof SimpleRequestAdapter)) {
            throw new MessageDecodingException("Message context InTransport instance was an unsupported type");
        }
        WebContext webContext = ((SimpleRequestAdapter) inTransport).getWebContext();

        return webContext.getFullRequestURL();
    }
View Full Code Here

    public static IDPSSODescriptor getIDPSSODescriptor(EntityDescriptor idpEntityDescriptor) throws MessageDecodingException {

        IDPSSODescriptor idpSSODescriptor = idpEntityDescriptor.getIDPSSODescriptor(SAMLConstants.SAML20P_NS);
        if (idpSSODescriptor == null) {
            logger.error("Could not find an IDPSSODescriptor in metadata.");
            throw new MessageDecodingException("Could not find an IDPSSODescriptor in metadata.");
        }

        return idpSSODescriptor;

    }
View Full Code Here

    public static ArtifactResolutionService getArtifactResolutionService(IDPSSODescriptor idpssoDescriptor, int endpointIndex) throws MessageDecodingException {

        List<ArtifactResolutionService> artifactResolutionServices = idpssoDescriptor.getArtifactResolutionServices();
        if (artifactResolutionServices == null || artifactResolutionServices.size() == 0) {
            logger.error("Could not find any artifact resolution services in metadata.");
            throw new MessageDecodingException("Could not find any artifact resolution services in metadata.");
        }

        ArtifactResolutionService artifactResolutionService = null;
        for (ArtifactResolutionService ars : artifactResolutionServices) {
            if (ars.getIndex() == endpointIndex) {
                artifactResolutionService = ars;
                break;
            }
        }

        if (artifactResolutionService == null) {
            throw new MessageDecodingException("Could not find artifact resolution service with index " + endpointIndex + " in IDP data.");
        }

        return artifactResolutionService;

    }
View Full Code Here

            log.debug("Sending ArtifactResolution message to {}", uri);
            int responseCode = httpClient.executeMethod(hc, postMethod);
            if (responseCode != 200) {
                String responseBody = postMethod.getResponseBodyAsString();
                throw new MessageDecodingException("Problem communicating with Artifact Resolution service, received response " + responseCode + ", body " + responseBody);
            }

            // Decode artifact response message.
            processor.retrieveMessage(context, SAMLConstants.SAML2_SOAP11_BINDING_URI);

        } catch (IOException e) {

            throw new MessageDecodingException("Error when sending request to artifact resolution service.", e);

        } finally {

            if (postMethod != null) {
                postMethod.releaseConnection();
View Full Code Here

            getArtifactResponse(endpointURI, context);

            ArtifactResponse artifactResponse = (ArtifactResponse) context.getInboundSAMLMessage();

            if (artifactResponse == null) {
                throw new MessageDecodingException("Did not receive an artifact response message.");
            }

            DateTime issueInstant = artifactResponse.getIssueInstant();
            if (!isDateTimeSkewValid(getResponseSkew(), issueInstant)) {
                throw new MessageDecodingException("ArtifactResponse issue time is either too old or with date in the future, skew " + getResponseSkew() + ", time " + issueInstant);
            }

            SAMLObject message = artifactResponse.getMessage();
            if (message == null) {
                throw new MessageDecodingException("No inbound message in artifact response message.");
            }

            return message;

        } catch (MetadataProviderException e) {
            throw new MessageDecodingException("Error processing metadata", e);
        } catch (MessageEncodingException e) {
            throw new MessageDecodingException("Could not encode artifact resolve message", e);
        } catch (MessageDecodingException e) {
            throw new MessageDecodingException("Could not decode artifact response message", e);
        } catch (org.opensaml.xml.security.SecurityException e) {
            throw new MessageDecodingException("Security error when decoding artifact response message", e);
        } catch (SAMLException e) {
            throw new MessageDecodingException("Error during message processing", e);
        }

    }
View Full Code Here

    /** {@inheritDoc} */
    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 deocoder only supports the HTTP POST method");
        }

        log.debug("Unmarshalling SOAP message");
        Envelope soapMessage = (Envelope) unmarshallMessage(inTransport.getIncomingStream());
        samlMsgCtx.setInboundMessage(soapMessage);

        Header messageHeader = soapMessage.getHeader();
        if (messageHeader != null) {
            checkUnderstoodSOAPHeaders(soapMessage.getHeader().getUnknownXMLObjects());
        }

        List<XMLObject> soapBodyChildren = soapMessage.getBody().getUnknownXMLObjects();
        if (soapBodyChildren.size() < 1 || soapBodyChildren.size() > 1) {
            log.error("Unexpected number of children in the SOAP body, " + soapBodyChildren.size()
                    + ".  Unable to extract SAML message");
            throw new MessageDecodingException(
                    "Unexpected number of children in the SOAP body, unable to extract SAML message");
        }

        XMLObject incommingMessage = soapBodyChildren.get(0);
        if (!(incommingMessage instanceof SAMLObject)) {
            log.error("Unexpected SOAP body content.  Expected a SAML request but recieved {}", incommingMessage
                    .getElementQName());
            throw new MessageDecodingException("Unexpected SOAP body content.  Expected a SAML request but recieved "
                    + incommingMessage.getElementQName());
        }

        SAMLObject samlMessage = (SAMLObject) incommingMessage;
        log.debug("Decoded SOAP messaged which included SAML message of type {}", samlMessage.getElementQName());
View Full Code Here

        for (XMLObject header : headers) {
            if (header instanceof AttributeExtensibleXMLObject) {
                attribExtensObject = (AttributeExtensibleXMLObject) header;
                if (DatatypeHelper.safeEquals("1", attribExtensObject.getUnknownAttributes().get(soapMustUnderstand))) {
                    if (!understoodHeaders.contains(header.getElementQName())) {
                        throw new MessageDecodingException("SOAP decoder encountered a  header, "
                                + header.getElementQName()
                                + ", that requires undestanding however this decoder does not understand that header");
                    }
                }
            }
View Full Code Here

    /** {@inheritDoc} */
    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 deocoder only supports the HTTP POST method");
        }

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

TOP

Related Classes of org.opensaml.ws.message.decoder.MessageDecodingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.