Package org.apache.rahas

Examples of org.apache.rahas.Token


        OMElement tokenTypeElem = TrustUtil.createTokenTypeElement(version, rst);
        tokenTypeElem.setText(tokenType);
       
        TokenStorage store = TrustUtil.getTokenStore(configCtx);
       
        Token token = store.getToken(tokenId);
       
        if ( token != null) {
           
            OMElement str = token.getUnattachedReference();    
           
            if (str == null) {
                str = token.getAttachedReference();
            }
           
            TrustUtil.createRenewTargetElement(this.version, rst,str);
           
           
View Full Code Here


   
    stsClient.setRstTemplate(getRSTTemplate());
    String action = TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTION_ISSUE);
    stsClient.setAction(action);
   
    Token responseToken = stsClient.requestSecurityToken(loadPolicy("sample05/policy.xml"), "http://localhost:8080/axis2/services/STS", loadPolicy("sample05/sts_policy.xml"), null);
   
          System.out.println("\n############################# Requested Token ###################################\n");
          System.out.println(responseToken.getToken().toString());
   
          TokenStorage store = TrustUtil.getTokenStore(ctx);
          store.add(responseToken);
   
   
          ServiceClient client = new ServiceClient(ctx, null);
   
          Options options = new Options();
          options.setAction("urn:echo");
          options.setTo(new EndpointReference(args[0]));
          options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,  loadPolicy("sample05/policy.xml"));
          options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, responseToken.getId());
          client.setOptions(options);
         
          client.engageModule("addressing");
                client.engageModule("rampart");
               
View Full Code Here

            // Create the RequestedSecurityToken element and add the SAML token
            // to it
            OMElement reqSecTokenElem = TrustUtil
                    .createRequestedSecurityTokenElement(wstVersion, rstrElem);
            Token assertionToken;
            try {
                Node tempNode = assertion.toDOM();
                reqSecTokenElem.addChild((OMNode) ((Element) rstrElem)
                        .getOwnerDocument().importNode(tempNode, true));

                // Store the token
                assertionToken = new Token(assertion.getId(),
                        (OMElement) assertion.toDOM(), creationTime,
                        expirationTime);

                // At this point we definitely have the secret
                // Otherwise it should fail with an exception earlier
                assertionToken.setSecret(data.getEphmeralKey());
                TrustUtil.getTokenStore(inMsgCtx).add(assertionToken);

            } catch (SAMLException e) {
                throw new TrustException("samlConverstionError", e);
            }
View Full Code Here

   
    stsClient.setRstTemplate(getRSTTemplate());
    String action = TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTION_ISSUE);
    stsClient.setAction(action);
   
    Token responseToken = stsClient.requestSecurityToken(loadPolicy("sample08/policy.xml"), "http://localhost:8080/axis2/services/STS", loadPolicy("sample08/sts_policy.xml"), null);
   
          System.out.println("\n############################# Requested SAML 2.0 Token ###################################\n");
          System.out.println(responseToken.getToken().toString());
    System.out.println("\n##########################################################################################\n");
                

  }
View Full Code Here

   
    stsClient.setRstTemplate(getRSTTemplate());
    String action = TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTION_ISSUE);
    stsClient.setAction(action);
   
    Token responseToken = stsClient.requestSecurityToken(loadPolicy("sample05/policy.xml"), "http://localhost:8080/axis2/services/STS", loadPolicy("sample05/sts_policy.xml"), null);
   
          System.out.println("\n############################# Requested Token ###################################\n");
          System.out.println(responseToken.getToken().toString());
   
          TokenStorage store = TrustUtil.getTokenStore(ctx);
          store.add(responseToken);
   
   
          ServiceClient client = new ServiceClient(ctx, null);
   
          Options options = new Options();
          options.setAction("urn:echo");
          options.setTo(new EndpointReference(args[0]));
          options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,  loadPolicy("sample05/policy.xml"));
          options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, responseToken.getId());
          client.setOptions(options);
         
          client.engageModule("addressing");
                client.engageModule("rampart");
               
View Full Code Here

                  .getBasetokenId();
              //Get the token that matches the id
              SecurityToken recoveredToken = this
                  .recoverSecurityToken(baseTokenId);
              if (recoveredToken != null) {
                Token rahasToken = ((RampartSecurityToken) recoveredToken)
                    .getToken();
                //check whether the SCT used in the message is
                //similar to the one given into the method
                String recoverdTokenId = rahasToken.getId();
                String attRefId = null;
                String unattrefId = null;
                if (rahasToken.getAttachedReference() != null) {
                  attRefId = this.getUriFromSTR(rahasToken
                      .getAttachedReference());
                }
                if (rahasToken.getUnattachedReference() != null) {
                  unattrefId = this.getUriFromSTR(rahasToken
                      .getUnattachedReference());
                }

                String id = ((RampartSecurityToken) token)
                    .getToken().getId();
View Full Code Here

          client.setCryptoInfo(RampartUtil.getEncryptionCrypto(rpd
              .getRampartConfig(), message.getAxisService()
              .getClassLoader()), RampartUtil.getPasswordCB(
              message, rpd));
          String address = message.getTo().getAddress();
          Token tok = client.requestSecurityToken(servicePolicy,
              address, issuerPolicy, null);

          tok.setState(Token.ISSUED);
          this.storage.add(tok);

          contextIdentifierKey = RampartUtil
              .getContextIdentifierKey(message);
          RampartUtil.getContextMap(message).put(
              contextIdentifierKey, tok.getId());
          identifier = tok.getId();

        } else {
          String msg = SandeshaMessageHelper
              .getMessage(SandeshaMessageKeys.noSecConvTokenInPolicy);
          log.debug(msg);
View Full Code Here

   * @see org.apache.sandesha2.security.SecurityManager#recoverSecurityToken(java.lang.String)
   */
  public SecurityToken recoverSecurityToken(String tokenData)
      throws SandeshaException {
    try {
      Token token = this.storage.getToken(tokenData);
      if (token != null) {
        return new RampartSecurityToken(token);
      } else {
        String msg = SandeshaMessageHelper
            .getMessage(SandeshaMessageKeys.errorRetrievingSecurityToken);
View Full Code Here

                            //Get the id of the SCT that was used to create the DKT
                            String baseTokenId = ((WSDerivedKeyTokenPrincipal)principal).getBasetokenId();
                            //Get the token that matches the id
                            SecurityToken recoveredToken = this.recoverSecurityToken(baseTokenId);
                            if(recoveredToken != null) {
                                Token rahasToken = ((RampartSecurityToken)recoveredToken).getToken();
                                //check whether the SCT used in the message is
                                //similar to the one given into the method
                                String recoverdTokenId = rahasToken.getId();
                                String attRefId = null;
                                String unattrefId = null;
                                if(rahasToken.getAttachedReference() != null) {
                                    attRefId = this.getUriFromSTR(rahasToken.getAttachedReference());
                                }
                                if(rahasToken.getUnattachedReference() != null) {
                                    unattrefId = this.getUriFromSTR(rahasToken.getUnattachedReference());
                                }
                               
                                String id = ((RampartSecurityToken)token).getToken().getId();
                                if(recoverdTokenId.equals(id) || attRefId.equals(id) || unattrefId.equals(id)) {
                                    //Token matched with a token that signed the message part
View Full Code Here

                    client.setCryptoInfo(RampartUtil.getEncryptionCrypto(rpd
                            .getRampartConfig(), message.getAxisService()
                            .getClassLoader()), RampartUtil.getPasswordCB(
                            message, rpd));
                    String address = message.getTo().getAddress();
                    Token tok = client.requestSecurityToken(servicePolicy,
                            address, issuerPolicy, null);
                   
                    tok.setState(Token.ISSUED);
                    this.storage.add(tok);
                   
                    contextIdentifierKey = RampartUtil.getContextIdentifierKey(message);
                    RampartUtil.getContextMap(message).put(
                                                        contextIdentifierKey,
                                                        tok.getId());
                    identifier = tok.getId();
                   
                } else {
                    String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noSecConvTokenInPolicy);
                  log.debug (msg);
                  return null;
View Full Code Here

TOP

Related Classes of org.apache.rahas.Token

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.