Package org.jboss.identity.federation.saml.v2.protocol

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


     
      subjectType.getContent().add(jaxbSubjectConfirmationType);
     
      assertionType.setSubject(subjectType);
     
      ResponseType responseType = createResponseType(ID, issuerInfo, assertionType);
      //InResponseTo ID
      responseType.setInResponseTo(sp.getRequestID());
      //Destination
      responseType.setDestination(responseDestinationURI);
      
      return responseType;
   }
View Full Code Here


    * @throws ConfigurationException
    */
   public static ResponseType createResponseType(String ID, IssuerInfoHolder issuerInfo, AssertionType assertionType)
   throws ConfigurationException
   {
      ResponseType responseType = SAMLProtocolFactory.getObjectFactory().createResponseType();
      responseType.setVersion(issuerInfo.getSamlVersion());
     
      //ID
      responseType.setID(ID);
     
      //Issuer
      NameIDType issuer = issuerInfo.getIssuer();
      responseType.setIssuer(issuer);
     
      //Status
      String statusCode = issuerInfo.getStatusCode();
      if(statusCode == null)
         throw new IllegalArgumentException("issuerInfo missing status code");
     
      responseType.setStatus(createStatusType(statusCode) );
     
      XMLGregorianCalendar issueInstant = XMLTimeUtil.getIssueInstant();
     
      //IssueInstant
      responseType.setIssueInstant(issueInstant);
      if(assertionType.getIssueInstant() == null)
         assertionType.setIssueInstant(issueInstant);
   
      responseType.getAssertionOrEncryptedAssertion().add(assertionType);
      return responseType;
   }
View Full Code Here

    * @param statusCodeURI
    * @return
    */
   public static StatusType createStatusType(String statusCodeURI)
   {
      StatusCodeType sct = SAMLProtocolFactory.getObjectFactory().createStatusCodeType();
      sct.setValue(statusCodeURI);
     
      StatusType statusType = SAMLProtocolFactory.getObjectFactory().createStatusType();
      statusType.setStatusCode(sct);
      return statusType;
   }
View Full Code Here

      if(request == null)
         throw new IllegalArgumentException("request is null");
      if(responseType == null)
         throw new IllegalArgumentException("response type is null");
     
      StatusType statusType = responseType.getStatus();
      if(statusType == null)
         throw new IllegalArgumentException("Status Type from the IDP is null");

      String statusValue = statusType.getStatusCode().getValue();
      if(JBossSAMLURIConstants.STATUS_SUCCESS.get().equals(statusValue) == false)
         throw new SecurityException("IDP forbid the user");

      List<Object> assertions = responseType.getAssertionOrEncryptedAssertion();
      if(assertions.size() == 0)
View Full Code Here

      if(request == null)
         throw new IllegalArgumentException("request is null");
      if(responseType == null)
         throw new IllegalArgumentException("response type is null");
     
      StatusType statusType = responseType.getStatus();
      if(statusType == null)
         throw new IllegalArgumentException("Status Type from the IDP is null");

      String statusValue = statusType.getStatusCode().getValue();
      if(JBossSAMLURIConstants.STATUS_SUCCESS.get().equals(statusValue) == false)
         throw new SecurityException("IDP forbid the user");

      List<Object> assertions = responseType.getAssertionOrEncryptedAssertion();
      if(assertions.size() == 0)
View Full Code Here

   public static StatusType createStatusType(String statusCodeURI)
   {
      StatusCodeType sct = SAMLProtocolFactory.getObjectFactory().createStatusCodeType();
      sct.setValue(statusCodeURI);
     
      StatusType statusType = SAMLProtocolFactory.getObjectFactory().createStatusType();
      statusType.setStatusCode(sct);
      return statusType;
   }
View Full Code Here

            samlRequest.setDestination(endpoint.getLocation());

            JAXBElement<?> requestElement;
            if (samlRequest instanceof AuthnRequestType) {
                AuthnRequestType authnRequest = (AuthnRequestType) samlRequest;
                requestElement = new ObjectFactory().createAuthnRequest(authnRequest);
            } else if (samlRequest instanceof LogoutRequestType) {
                LogoutRequestType logoutRequest = (LogoutRequestType) samlRequest;
                requestElement = new ObjectFactory().createLogoutRequest(logoutRequest);
            } else {
                throw new RuntimeException("Currently only authentication and logout requests can be sent");
            }

            Binder<Node> binder = jaxbContext.createBinder();
View Full Code Here

        try {
            samlResponse.setDestination(endpoint.getResponseLocation());

            JAXBElement<? extends StatusResponseType> responseElement;
            if (endpoint.getService().getProfile().equals(SamlProfile.SINGLE_LOGOUT)) {
                responseElement = new ObjectFactory().createLogoutResponse(samlResponse);
            } else {
                responseElement = new ObjectFactory().createResponse((ResponseType) samlResponse);
            }

            Binder<Node> binder = jaxbContext.createBinder();

            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
View Full Code Here

         JAXBElement<?> requestElement;
         if (samlRequest instanceof AuthnRequestType)
         {
            AuthnRequestType authnRequest = (AuthnRequestType) samlRequest;
            requestElement = new ObjectFactory().createAuthnRequest(authnRequest);
         }
         else if (samlRequest instanceof LogoutRequestType)
         {
            LogoutRequestType logoutRequest = (LogoutRequestType) samlRequest;
            requestElement = new ObjectFactory().createLogoutRequest(logoutRequest);
         }
         else
         {
            throw new RuntimeException("Currently only authentication and logout requests can be sent");
         }
View Full Code Here

         samlResponse.setDestination(endpoint.getResponseLocation());

         JAXBElement<? extends StatusResponseType> responseElement;
         if (endpoint.getService().getProfile().equals(SamlProfile.SINGLE_LOGOUT))
         {
            responseElement = new ObjectFactory().createLogoutResponse(samlResponse);
         }
         else
         {
            responseElement = new ObjectFactory().createResponse((ResponseType) samlResponse);
         }

         Binder<Node> binder = jaxbContext.createBinder();

         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.saml.v2.protocol.ObjectFactory

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.