Package org.jboss.identity.federation.core.wstrust

Examples of org.jboss.identity.federation.core.wstrust.WSTrustException


   public void validateToken(WSTrustRequestContext context) throws WSTrustException
   {
      // get the SAML assertion that must be validated.
      ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
      if(validateTarget == null)
         throw new WSTrustException("Invalid validate message: missing required ValidateTarget");
    
      String code = WSTrustConstants.STATUS_CODE_VALID;
      String reason = "SAMLV2.0 Assertion successfuly validated";
     
      AssertionType assertion = null;
     
      Object assertionObj = validateTarget.getAny();
      if(assertionObj instanceof JAXBElement)
      {
         JAXBElement<AssertionType> assertionType = (JAXBElement<AssertionType>) validateTarget.getAny();
         assertion = assertionType.getValue();           
      }
      else if(assertionObj instanceof Element)
      {
         Element assertionElement = (Element) assertionObj;
        
         if(!this.isAssertion(assertionElement))
         {
            code = WSTrustConstants.STATUS_CODE_INVALID;
            reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
         }
         else
         {
            try
            {
               assertion = SAMLUtil.fromElement((Element) assertionObj);
            }
            catch (JAXBException e)
            {
               throw new WSTrustException("Unmarshalling error:",e);
            }
         }
      }
    
      // check the assertion lifetime.
View Full Code Here


      {
         assertionElement = SAMLUtil.toElement(assertion);
      }
      catch (Exception e)
      {
         throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
      }

      SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
            assertionElement, assertionID);
      context.setSecurityToken(token);
View Full Code Here

         logger.trace("SAML V2.0 token validation started");
     
      // get the SAML assertion that must be validated.
      ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
      if(validateTarget == null)
         throw new WSTrustException("Invalid validate message: missing required ValidateTarget");
    
      String code = WSTrustConstants.STATUS_CODE_VALID;
      String reason = "SAMLV2.0 Assertion successfuly validated";
     
      AssertionType assertion = null;
     
      Object assertionObj = validateTarget.getAny();
      if(assertionObj instanceof JAXBElement)
      {
         JAXBElement<AssertionType> assertionType = (JAXBElement<AssertionType>) validateTarget.getAny();
         assertion = assertionType.getValue();           
      }
      else if(assertionObj instanceof Element)
      {
         Element assertionElement = (Element) assertionObj;
        
         if(!this.isAssertion(assertionElement))
         {
            code = WSTrustConstants.STATUS_CODE_INVALID;
            reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
         }
         else
         {
            try
            {
               assertion = SAMLUtil.fromElement((Element) assertionObj);
            }
            catch (JAXBException e)
            {
               throw new WSTrustException("Unmarshalling error:",e);
            }
         }
      }
    
      // check the assertion lifetime.
View Full Code Here

      {
         assertionElement = SAMLUtil.toElement(assertion);
      }
      catch (Exception e)
      {
         throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
      }

      SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
            assertionElement, assertionID);
      context.setSecurityToken(token);
View Full Code Here

            else
                nodes = responseDoc.getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE, "RequestedSecurityToken");
        }
        catch (Exception e)
        {
            throw new WSTrustException("Exception in issuing token:", e);
        }

        if (nodes == null)
            throw new WSTrustException("NodeList is null");

        Node rstr = nodes.item(0);

        return (Element) rstr.getFirstChild();
    }
View Full Code Here

            else
                nodes = responseDoc.getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE, "RequestedSecurityToken");
        }
        catch (Exception e)
        {
            throw new WSTrustException("Exception in renewing token:", e);
        }

        if (nodes == null)
            throw new WSTrustException("NodeList is null");

        Node rstr = nodes.item(0);

        return (Element) rstr.getFirstChild();
View Full Code Here

         else if (requestType.equals(WSTrustConstants.CANCEL_REQUEST))
            return this.marshallResponse(handler.cancel(request, this.context.getUserPrincipal()));
         else if (requestType.equals(WSTrustConstants.VALIDATE_REQUEST))
            return this.marshallResponse(handler.validate(request, this.context.getUserPrincipal()));
         else
            throw new WSTrustException("Invalid request type: " + requestType);
      }
      catch (WSTrustException we)
      {
         throw new WebServiceException("Exception in handling token request:", we);
      }
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.core.wstrust.WSTrustException

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.