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

Examples of org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType


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

                  AuthnRequestType art = (AuthnRequestType) requestAbstractType;
                  responseType =
                     webRequestUtil.getResponse(art.getAssertionConsumerServiceURL(),
                           userPrincipal, roles,
                           this.identityURL, this.assertionValidity);
               }
               catch (IssuerNotTrustedException e)
               {
View Full Code Here


         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);
      log.debug("Sending to destination="+destination);
        
      return destination;
   }
View Full Code Here

      {
         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"))
         {
            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)
      {
         log.debug("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)
         {
            log.trace("Exception:",e);
View Full Code Here

         if(userPrincipal == null)
         {
            String relayState = null;
            try
            {
               AuthnRequestType authnRequest = createSAMLRequest(serviceURL, identityURL);
               sendRequestToIDP(authnRequest, relayState, response);
            }
            catch (Exception e)
            {
               throw new ServletException(e);
View Full Code Here

                 

               if(trace)
                  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

    * Create a AuthnRequestType
    * @return
    */
   public static AuthnRequestType createAuthnRequestType()
   {
      AuthnRequestType authnRequestType = SAMLProtocolFactory.getObjectFactory().createAuthnRequestType();
      return authnRequestType;
   }
View Full Code Here

   public static AuthnRequestType createAuthnRequestType(String id,
         String assertionConsumerURL, String destination, String issuerValue) throws ConfigurationException 
   {
      XMLGregorianCalendar issueInstant = XMLTimeUtil.getIssueInstant();
     
      AuthnRequestType authnRequest = SAMLProtocolFactory.getObjectFactory().createAuthnRequestType();
      authnRequest.setID(id);
      authnRequest.setVersion(JBossSAMLConstants.VERSION_2_0.get());
      authnRequest.setAssertionConsumerServiceURL(assertionConsumerURL);
      authnRequest.setProtocolBinding(JBossSAMLConstants.HTTP_POST_BINDING.get());
      authnRequest.setDestination(destination);
      authnRequest.setIssueInstant(issueInstant);
     
      //Create an issuer
      NameIDType issuer = JBossSAMLBaseFactory.createNameID();
      issuer.setValue(issuerValue);
     
      authnRequest.setIssuer(issuer);
     
      return authnRequest;
     
   }
View Full Code Here

            if(userPrincipal != null)
            {
               //Send valid saml response after processing the request
               if(containsSAMLRequestMessage)
               {
                  RequestAbstractType requestAbstractType =  null;
                  try
                  {
                     requestAbstractType = getSAMLRequest(request);
                     boolean isValid = this.validate(request);
                     if(!isValid)
                        throw new GeneralSecurityException("Validity Checks Failed");
                    
                     this.isTrusted(requestAbstractType.getIssuer().getValue());
                    
                     ResponseType responseType = this.getResponse(request, userPrincipal);
                     send(responseType, request.getParameter("RelayState"), response);
                  }
                  catch (Exception e)
                  {
                     log.error("Exception:" ,e);
                     if(requestAbstractType != null)
                        referer = requestAbstractType.getIssuer().getValue();
                     ResponseType errorResponseType = this.getErrorResponse(referer, JBossSAMLURIConstants.STATUS_RESPONDER.get());
                     try
                     {
                        send(errorResponseType, request.getParameter("RelayState"), response);
                     }
View Full Code Here

        
         //Send valid saml response after processing the request
         if(samlMessage != null)
         {
            //Get the SAML Request Message
            RequestAbstractType requestAbstractType =  null;
            ResponseType responseType = null;
           
               try
               {
                  requestAbstractType = webRequestUtil.getSAMLRequest(samlMessage);
                  boolean isValid = validate(request.getRemoteAddr(),
                        new SessionHolder(samlMessage, signature, sigAlg));
                  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

         //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, null, null), isPost);
              
               if(!isValid)
                  throw new GeneralSecurityException("Validation check failed");

               webRequestUtil.isTrusted(requestAbstractType.getIssuer().getValue());

              
               List<String> roles = (List<String>) session.getAttribute(ROLES_ID);
               if(roles == null)
               {
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType

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.