Examples of RequestAbstractType


Examples of org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType

        
         //Send valid saml response after processing the request
         if(samlMessage != null)
         {
            //Get the SAML Request Message
            RequestAbstractType requestAbstractType =  null;
            Document samlResponse = null;
            String destination = null;
               try
               {
                  requestAbstractType = webRequestUtil.getSAMLRequest(samlMessage);
                  boolean isPost = webRequestUtil.hasSAMLRequestInPostProfile();
                  boolean isValid = validate(request.getRemoteAddr(),
                        request.getQueryString(),
                        new SessionHolder(samlMessage, signature, sigAlg), isPost);
                  if(!isValid)
                     throw new GeneralSecurityException("Validation check failed");
                 
                  webRequestUtil.isTrusted(requestAbstractType.getIssuer().getValue());

                  List<String> roles = rg.generateRoles(userPrincipal);
                 
                  log.trace("Roles have been determined:Creating response");
View Full Code Here

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.RequestAbstractType

            is = new InflaterInputStream(bais, new Inflater(true));
        }

        Document document = getDocument(is);
        String issuerEntityId;
        RequestAbstractType samlRequestMessage = null;
        StatusResponseType samlResponseMessage = null;
        if (samlRequestOrResponse.isRequest()) {
            samlRequestMessage = getSamlRequest(document);
            issuerEntityId = samlRequestMessage.getIssuer().getValue();
        } else {
            samlResponseMessage = getSamlResponse(document);
            issuerEntityId = samlResponseMessage.getIssuer().getValue();
        }
        log.debug("Received: " + SamlUtils.getDocumentAsString(document));

        try {
            if (samlRequestOrResponse.isRequest() || samlResponseMessage.getInResponseTo() == null) {
                // Request or unsolicited response

                String destination = samlRequestOrResponse.isRequest() ? samlRequestMessage.getDestination() : samlResponseMessage.getDestination();
                if (!samlEntityBean.get().getServiceURL(service).equals(destination)) {
                    throw new InvalidRequestException("Destination (" + destination + ") is not valid.");
                }

                dialogueManager.beginDialogue();
                samlDialogue.get().setExternalProviderMessageId(samlRequestOrResponse.isRequest() ? samlRequestMessage.getID() : samlResponseMessage.getID());
                SamlExternalEntity externalProvider = samlEntityBean.get().getExternalSamlEntityByEntityId(issuerEntityId);
                if (externalProvider == null) {
                    throw new InvalidRequestException("Received message from unknown entity id " + issuerEntityId);
                }
                samlDialogue.get().setExternalProvider(externalProvider);
View Full Code Here

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.RequestAbstractType

    private RequestAbstractType getSamlRequest(Document document) throws InvalidRequestException {
        try {
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            @SuppressWarnings("unchecked")
            JAXBElement<RequestAbstractType> jaxbRequest = (JAXBElement<RequestAbstractType>) unmarshaller.unmarshal(document);
            RequestAbstractType request = jaxbRequest.getValue();
            return request;
        } catch (JAXBException e) {
            throw new InvalidRequestException("SAML message could not be parsed", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.RequestAbstractType

         is = new InflaterInputStream(bais, new Inflater(true));
      }

      Document document = getDocument(is);
      String issuerEntityId;
      RequestAbstractType samlRequestMessage = null;
      StatusResponseType samlResponseMessage = null;
      if (samlRequestOrResponse.isRequest())
      {
         samlRequestMessage = getSamlRequest(document);
         issuerEntityId = samlRequestMessage.getIssuer().getValue();
      }
      else
      {
         samlResponseMessage = getSamlResponse(document);
         issuerEntityId = samlResponseMessage.getIssuer().getValue();
      }
      log.debug("Received: " + SamlUtils.getDocumentAsString(document));

      try
      {
         if (samlRequestOrResponse.isRequest() || samlResponseMessage.getInResponseTo() == null)
         {
            // Request or unsolicited response

            String destination = samlRequestOrResponse.isRequest() ? samlRequestMessage.getDestination() : samlResponseMessage.getDestination();
            if (!samlEntityBean.get().getServiceURL(service).equals(destination))
            {
               throw new InvalidRequestException("Destination (" + destination + ") is not valid.");
            }

            dialogueManager.beginDialogue();
            samlDialogue.get().setExternalProviderMessageId(samlRequestOrResponse.isRequest() ? samlRequestMessage.getID() : samlResponseMessage.getID());
            SamlExternalEntity externalProvider = samlEntityBean.get().getExternalSamlEntityByEntityId(issuerEntityId);
            if (externalProvider == null)
            {
               throw new InvalidRequestException("Received message from unknown entity id " + issuerEntityId);
            }
View Full Code Here

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.RequestAbstractType

      try
      {
         Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
         @SuppressWarnings("unchecked")
         JAXBElement<RequestAbstractType> jaxbRequest = (JAXBElement<RequestAbstractType>) unmarshaller.unmarshal(document);
         RequestAbstractType request = jaxbRequest.getValue();
         return request;
      }
      catch (JAXBException e)
      {
         throw new InvalidRequestException("SAML message could not be parsed", e);
View Full Code Here

Examples of org.opensaml.saml1.core.RequestAbstractType

*/
public class RequestAbstractTypeMarshaller extends AbstractSAMLObjectMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
        RequestAbstractType request = (RequestAbstractType) samlElement;

        if (request.getID() != null) {
            domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, request.getID());
            if (request.getMinorVersion() != 0) {
                domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
            }
        }

        if (request.getIssueInstant() != null) {
            String date = Configuration.getSAMLDateFormatter().print(request.getIssueInstant());
            domElement.setAttributeNS(null, RequestAbstractType.ISSUEINSTANT_ATTRIB_NAME, date);
        }
        if (request.getMinorVersion() != 0) {
            domElement.setAttributeNS(null, RequestAbstractType.MAJORVERSION_ATTRIB_NAME, "1");
            domElement.setAttributeNS(null, RequestAbstractType.MINORVERSION_ATTRIB_NAME, Integer.toString(request
                    .getMinorVersion()));
        }
    }
View Full Code Here

Examples of org.opensaml.saml1.core.RequestAbstractType

    private final Logger log = LoggerFactory.getLogger(RequestAbstractType.class);

    /** {@inheritDoc} */
    public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
        // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
        RequestAbstractType request = (RequestAbstractType) super.unmarshall(domElement);
        if (request.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(request.getID())) {
            domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
        }
        return request;
    }
View Full Code Here

Examples of org.opensaml.saml1.core.RequestAbstractType

    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
            throws UnmarshallingException {
        RequestAbstractType request = (RequestAbstractType) parentSAMLObject;

        if (childSAMLObject instanceof Signature) {
            request.setSignature((Signature) childSAMLObject);
        } else if (childSAMLObject instanceof RespondWith) {
            request.getRespondWiths().add((RespondWith) childSAMLObject);
        } else {
            super.processChildElement(parentSAMLObject, childSAMLObject);
        }
    }
View Full Code Here

Examples of org.opensaml.saml1.core.RequestAbstractType

        }
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlElement, Attr attribute) throws UnmarshallingException {
        RequestAbstractType request = (RequestAbstractType) samlElement;

        if (RequestAbstractType.ID_ATTRIB_NAME.equals(attribute.getLocalName())) {
            request.setID(attribute.getValue());
        } else if (RequestAbstractType.ISSUEINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
                && !DatatypeHelper.isEmpty(attribute.getValue())) {
            DateTime cal = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
            request.setIssueInstant(cal);
        } else if (RequestAbstractType.MINORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
            int minor;
            try {
                minor = Integer.parseInt(attribute.getValue());
            } catch (NumberFormatException n) {
                log.error("Unable to parse minor version string", n);
                throw new UnmarshallingException(n);
            }
            if (minor == 0) {
                request.setVersion(SAMLVersion.VERSION_10);
            } else if (minor == 1) {
                request.setVersion(SAMLVersion.VERSION_11);
            }
        } else {
            super.processAttribute(samlElement, attribute);
        }
    }
View Full Code Here

Examples of org.opensaml.saml1.core.RequestAbstractType

    }

    /** {@inheritDoc} */
    public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
        // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
        RequestAbstractType request = (RequestAbstractType) super.unmarshall(domElement);
        if (request.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(request.getID())) {
            domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
        }
        return request;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.