Package org.picketlink.identity.federation.api.saml.v2.request

Examples of org.picketlink.identity.federation.api.saml.v2.request.SAML2Request


   }
  
   protected void sendRequestToIDP(AuthnRequestType authnRequest, String relayState, Response response)
   throws IOException, SAXException, JAXBException, GeneralSecurityException
   {
      SAML2Request saml2Request = new SAML2Request();
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      saml2Request.marshall(authnRequest, baos);
      String samlMessage = PostBindingUtil.base64Encode(baos.toString())
      String destination = authnRequest.getDestination();
     
      PostBindingUtil.sendPost(new DestinationInfoHolder(destination, samlMessage, relayState),
View Full Code Here


   {
      public void generateSAMLRequest(SAML2HandlerRequest request,
            SAML2HandlerResponse response) throws ProcessingException
      {
         //Generate the LogOut Request
         SAML2Request samlRequest = new SAML2Request();
         try
         {
            LogoutRequestType lot =
               samlRequest.createLogoutRequest(request.getIssuer().getValue());
            response.setResultingDocument(samlRequest.convert(lot));
         }
         catch (Exception e)
         {
            throw new ProcessingException(e);
         }
View Full Code Here

      public void generateSAMLRequest(SAML2HandlerRequest request,
            SAML2HandlerResponse response) throws ProcessingException
      {
         String issuerValue = request.getIssuer().getValue();
        
         SAML2Request samlRequest = new SAML2Request();
         String id = IDGenerator.create("ID_");
         try
         {
            AuthnRequestType authn = samlRequest.createAuthnRequestType(id,
                issuerValue, response.getDestination(), issuerValue);
           
            response.setResultingDocument(samlRequest.convert(authn));
         }
         catch (Exception e)
         {
            throw new ProcessingException(e);
        
View Full Code Here

      if(serviceURL == null)
         throw new IllegalArgumentException("serviceURL is null");
      if(identityURL == null)
         throw new IllegalArgumentException("identityURL is null");
     
      SAML2Request saml2Request = new SAML2Request();
      String id = IDGenerator.create("ID_");
      return saml2Request.createAuthnRequestType(id, serviceURL, identityURL, serviceURL);
   }
View Full Code Here

  
   protected void sendRequestToIDP(AuthnRequestType authnRequest, String relayState,
         HttpServletResponse response)
   throws IOException, SAXException, JAXBException,GeneralSecurityException
   {
      SAML2Request saml2Request = new SAML2Request();
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      saml2Request.marshall(authnRequest, baos);
      String samlMessage = PostBindingUtil.base64Encode(baos.toString())
      String destination = authnRequest.getDestination();
      PostBindingUtil.sendPost(new DestinationInfoHolder(destination, samlMessage, relayState),
             response, true);
View Full Code Here

  
   public SAML2Object getSAMLObject(String samlMessage)
   throws ParsingException, IOException
   {
      InputStream is = null;
      SAML2Request saml2Request = new SAML2Request()
      if(redirectProfile)
      {
         is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
      }
      else
      {
         try
         {
            byte[] samlBytes = PostBindingUtil.base64Decode(samlMessage);
            if(trace) log.trace("SAMLRequest=" + new String(samlBytes));
            is = new ByteArrayInputStream(samlBytes);
         }
         catch(Exception rte)
         {
            if(trace)
               log.trace("Error in base64 decoding saml message: "+rte);
            throw new ParsingException(rte);
         }
      }
      return saml2Request.getSAML2ObjectFromStream(is);
   }
View Full Code Here

  
   public RequestAbstractType getSAMLRequest(String samlMessage)
   throws ParsingException, IOException
   {
      InputStream is = null;
      SAML2Request saml2Request = new SAML2Request()
      if(redirectProfile)
      {
         is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
      }
      else
      {
         byte[] samlBytes = PostBindingUtil.base64Decode(samlMessage);
         if(trace) log.trace("SAMLRequest=" + new String(samlBytes));
         is = new ByteArrayInputStream(samlBytes);
      }
      return saml2Request.getRequestType(is);
   }
View Full Code Here

            //send logout request to participant with relaystate to orig
            response.setRelayState(relayState);
           
            response.setDestination(nextParticipant);
           
            SAML2Request saml2Request = new SAML2Request();
            try
            {
               LogoutRequestType lort = saml2Request.createLogoutRequest(request.getIssuer().getValue());
               response.setResultingDocument(saml2Request.convert(lort));
            }
            catch(Exception e)
            {
               throw new ProcessingException(e);
            }
View Full Code Here

         LogoutRequestType logOutRequest = (LogoutRequestType) request.getSAML2Object();
         String issuer = logOutRequest.getIssuer().getValue();
         try
         {
            SAML2Response saml2Response = new SAML2Response();
            SAML2Request saml2Request = new SAML2Request();
           
            ServletContext servletCtx = httpContext.getServletContext();
            IdentityServer server = (IdentityServer)servletCtx.getAttribute("IDENTITY_SERVER");
           
            if(server == null)
               throw new ProcessingException("Identity Server not found");
           
            String originalIssuer = (relayState == null) ? issuer : relayState;
           
            String participant = this.getParticipant(server, sessionID, originalIssuer);
          
            if(participant == null || participant.equals(originalIssuer))
            {
               //All log out is done
               session.invalidate();
               server.stack().pop(sessionID);
              
               generateSuccessStatusResponseType(logOutRequest.getID(),
                     request, response, originalIssuer);
            }
            else
            {
               //Put the participant in transit mode
               server.stack().registerTransitParticipant(sessionID, participant);
              
               if(relayState == null)
                  relayState = originalIssuer;
              
               //send logout request to participant with relaystate to orig
               response.setRelayState(originalIssuer);
              
               response.setDestination(participant);
              
              
               LogoutRequestType lort = saml2Request.createLogoutRequest(request.getIssuer().getValue());
               response.setResultingDocument(saml2Request.convert(lort));
            }
         }
         catch(ParserConfigurationException pe)
         {
            throw new ProcessingException(pe);
View Full Code Here

    * @throws MarshalException
    * @throws GeneralSecurityException
    */
   public Document sign(RequestAbstractType request, KeyPair keypair) throws SAXException, IOException, JAXBException, ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException 
   {
      SAML2Request saml2Request = new SAML2Request();
      Document doc = saml2Request.convert(request);
      doc.normalize();
     
      String referenceURI = "#" + request.getID();
      
      return XMLSignatureUtil.sign(doc,
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.api.saml.v2.request.SAML2Request

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.