Examples of AuthnRequestType


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

      String samlMessage = getSAMLMessage(request);
      InputStream is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
      SAML2Request saml2Request = new SAML2Request();
     
      AuthnRequestType authnRequestType = null;
      try
      {
         authnRequestType = saml2Request.getAuthnRequestType(is);
      }
      catch (JAXBException e2)
      {
         throw new ParsingException(e2);
      }
      catch (SAXException e2)
      {
         throw new ParsingException(e2);
      }
      if(authnRequestType == null)
         throw new IllegalStateException("AuthnRequest is null");

      if(log.isTraceEnabled())
      {
         StringWriter sw = new StringWriter();
         try
         {
            saml2Request.marshall(authnRequestType, sw);
         }
         catch (SAXException e)
         {
            log.trace(e);
         }
         catch (JAXBException e)
         {
            log.trace(e);
         }
         log.trace("IDPRedirectValve::AuthnRequest="+sw.toString());
      }
      SAML2Response saml2Response = new SAML2Response();
           
      //Create a response type
      String id = IDGenerator.create("ID_");

      IssuerInfoHolder issuerHolder = new IssuerInfoHolder(this.identityURL);
      issuerHolder.setStatusCode(JBossSAMLURIConstants.STATUS_SUCCESS.get());

      IDPInfoHolder idp = new IDPInfoHolder();
      idp.setNameIDFormatValue(userPrincipal.getName());
      idp.setNameIDFormat(JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get());

      SPInfoHolder sp = new SPInfoHolder();
      sp.setResponseDestinationURI(authnRequestType.getAssertionConsumerServiceURL());
      responseType = saml2Response.createResponseType(id, sp, idp, issuerHolder);
      //Add information on the roles
      List<String> roles = rg.generateRoles(userPrincipal);
      AssertionType assertion = (AssertionType) responseType.getAssertionOrEncryptedAssertion().get(0);
View Full Code Here

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

         throw new ServletException("serviceURL is not configured");

      SAML2Request saml2Request = new SAML2Request();
     
      SPUtil spUtil = new SPUtil();
      AuthnRequestType authnRequest = spUtil.createSAMLRequest(serviceURL, identityURL);
      
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      saml2Request.marshall(authnRequest, baos);
      String base64Request = RedirectBindingUtil.deflateBase64URLEncode(baos.toByteArray());
      String destination = authnRequest.getDestination() + getDestination(base64Request, relayState);
      if(trace)
         log.trace("Sending to destination="+destination);
        
      return destination;
   }
View Full Code Here

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

      {
         principal = (GenericPrincipal) process(request,response);
        
         if(principal == null)
         {
            AuthnRequestType authnRequest = spUtil.createSAMLRequest(serviceURL, identityURL);
            sendRequestToIDP(authnRequest, relayState, response);
            return false;
         }
        
         String username = principal.getName();
         String password = ServiceProviderSAMLContext.EMPTY_PASSWORD;
        
         //Map to JBoss specific principal
         if(spConfiguration.getServerEnvironment().equalsIgnoreCase("JBOSS") || jbossEnv)
         {
            GenericPrincipal gp = (GenericPrincipal) principal;
            //Push a context
            ServiceProviderSAMLContext.push(username, Arrays.asList(gp.getRoles()));
            principal = context.getRealm().authenticate(username, password);
            ServiceProviderSAMLContext.clear();
        
        
         session.setNote(Constants.SESS_USERNAME_NOTE, username);
         session.setNote(Constants.SESS_PASSWORD_NOTE, password);
         request.setUserPrincipal(principal);
         register(request, response, principal, Constants.FORM_METHOD, username, password);
        
         return true;
      }
      catch(AssertionExpiredException aie)
      {
         if(trace)
            log.trace("Assertion has expired. Issuing a new saml2 request to the IDP");
         try
         {
            AuthnRequestType authnRequest = spUtil.createSAMLRequest(serviceURL, identityURL);
            sendRequestToIDP(authnRequest, relayState, response);
         }
         catch (Exception e)
         {
            if(trace) log.trace("Exception:",e);
View Full Code Here

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

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

                  AuthnRequestType art = (AuthnRequestType) requestAbstractType;
                  destination = art.getAssertionConsumerServiceURL();
                 
                  samlResponse =
                     webRequestUtil.getResponse(destination,
                           userPrincipal, roles,
                           this.identityURL, this.assertionValidity, this.signOutgoingMessages);
View Full Code Here

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

        try {
            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 {
View Full Code Here

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

        return response;
    }

    public AuthnRequestType createAuthnRequest() {
        AuthnRequestType authnRequest = objectFactory.createAuthnRequestType();

        fillRequestAbstractTypeFields(authnRequest);

        // Fill in the optional fields that indicate where and how the response
        // should be delivered.
        authnRequest.setAssertionConsumerServiceURL(samlEntityBean.get().getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));
        authnRequest.setProtocolBinding(SamlConstants.HTTP_POST_BINDING);

        return authnRequest;
    }
View Full Code Here

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

            samlServiceProviderSpi.get().loginSucceeded(session, responseHandler.createResponseHolder(response));
        }
    }

    public void sendAuthenticationRequestToIDP(SamlExternalIdentityProvider idp, HttpServletResponse response) {
        AuthnRequestType authnRequest = samlMessageFactory.createAuthnRequest();

        samlDialogue.setExternalProvider(idp);

        samlMessageSender.sendRequest(idp, SamlProfile.SINGLE_SIGN_ON, authnRequest, response);
    }
View Full Code Here

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

        sendAuthenticationResponse(samlDialogue.getExternalProvider(), null, true, response);
    }

    @Dialogued
    public void sendAuthenticationResponseToIDP(SamlExternalIdentityProvider idp, HttpServletResponse response) {
        AuthnRequestType authnRequest = samlMessageFactory.createAuthnRequest();

        samlDialogue.setExternalProvider(idp);

        samlMessageSender.sendRequest(idp, SamlProfile.SINGLE_SIGN_ON, authnRequest, response);
    }
View Full Code Here

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

   }

   @Dialogued
   public void sendAuthenticationResponseToIDP(SamlExternalIdentityProvider idp, HttpServletResponse response)
   {
      AuthnRequestType authnRequest = samlMessageFactory.createAuthnRequest();

      samlDialogue.setExternalProvider(idp);

      samlMessageSender.sendRequest(idp, SamlProfile.SINGLE_SIGN_ON, authnRequest, response);
   }
View Full Code Here

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

      }
   }

   public void sendAuthenticationRequestToIDP(SamlExternalIdentityProvider idp, HttpServletResponse response)
   {
      AuthnRequestType authnRequest = samlMessageFactory.createAuthnRequest();

      samlDialogue.setExternalProvider(idp);

      samlMessageSender.sendRequest(idp, SamlProfile.SINGLE_SIGN_ON, authnRequest, response);
   }
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.