Package org.jboss.identity.federation.api.saml.v2.common

Examples of org.jboss.identity.federation.api.saml.v2.common.SAMLDocumentHolder


            {
               SAML2Response saml2Response = new SAML2Response();
              
               ResponseType responseType = saml2Response.getResponseType(is);
              
               SAMLDocumentHolder samlDocumentHolder = saml2Response.getSamlDocumentHolder();
              
               boolean validSignature = this.verifySignature(samlDocumentHolder);
              
               if(validSignature == false)
                  throw new IssuerNotTrustedException("Signature in saml document is invalid");
View Full Code Here


  
   private RequestAbstractType getSAMLRequest(Request request) throws JAXBException, SAXException
   {
      String samlMessage = getSAMLMessage(request);
      InputStream is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
      SAML2Request saml2Request = new SAML2Request()
      return saml2Request.getRequestType(is);
   }
View Full Code Here

   {
      ResponseType responseType = null;

      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);
         }
View Full Code Here

    * @throws GeneralSecurityException
    */
   public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState,
         PrivateKey signingKey) throws SAXException, JAXBException, IOException, GeneralSecurityException
   {
      SAML2Request saml2Request = new SAML2Request();
      
      // Deal with the original request
      StringWriter sw = new StringWriter();
      saml2Request.marshall(authRequest, sw);
     
      //URL Encode the Request
      String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString());
   
      String urlEncodedRelayState = null;
View Full Code Here

   public static AuthnRequestType getRequestFromSignedURL(String signedURL)
   throws JAXBException, SAXException, IOException 
   {
      String samlRequestTokenValue =  getTokenValue(signedURL, "SAMLRequest");
     
      SAML2Request saml2Request = new SAML2Request();
      return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue));
   }
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

   {
      //create a saml request
      if(this.serviceURL == null)
         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);
        
View Full Code Here

   }
  
   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();
     
      //Get the signing key 
View Full Code Here

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

      try
      {
         return saml2Request.getRequestType(is);
      }
      catch (JAXBException e)
      {
         throw new ParsingException(e);
      }
View Full Code Here

   }
  
   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),
             null,response, true);
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.api.saml.v2.common.SAMLDocumentHolder

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.