Package org.apache.sandesha2.security

Examples of org.apache.sandesha2.security.SecurityToken


    ConfigurationContext configCtx = message.getConfigurationContext();

    if(rmBean.getSecurityTokenData() != null) {
      if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Securing outbound message");
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      SecurityToken token = secManager.recoverSecurityToken(rmBean.getSecurityTokenData());
      secManager.applySecurityToken(token, message);
    }

    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: RMMsgCreator::secureOutboundMessage");
  }
View Full Code Here


            if (principal instanceof WSDerivedKeyTokenPrincipal) {
              //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
View Full Code Here

   
    // If the inbound CreateSequence includes a SecurityTokenReference then
    // ask the security manager to resolve that to a token for us. We also
    // check that the Create was secured using the token.
    OMElement theSTR = createSeqPart.getSecurityTokenReference();
    SecurityToken token = null;
    if(theSTR != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(context);
      MessageContext msgcontext = createSeqRMMsg.getMessageContext();
      token = secManager.getSecurityToken(theSTR, msgcontext);
     
View Full Code Here

    // Check that the sender of this TerminateSequence holds the correct token
    SequencePropertyBean tokenBean = sequencePropertyBeanMgr.retrieve(sequencePropertyKey, Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
    if(tokenBean != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(context);
      OMElement body = terminateSeqRMMsg.getSOAPEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenBean.getValue());
      secManager.checkProofOfPossession(token, body, terminateSeqRMMsg.getMessageContext());
    }

    FaultManager faultManager = new FaultManager();
    SandeshaException fault = faultManager.checkForUnknownSequence(terminateSeqRMMsg, sequenceId,
View Full Code Here

    // Check that the sender of this TerminateSequence holds the correct token
    SequencePropertyBean tokenBean = sequencePropertyBeanMgr.retrieve(sequencePropertyKey, Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
    if(tokenBean != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(context);
      OMElement body = terminateResRMMsg.getSOAPEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenBean.getValue());
      secManager.checkProofOfPossession(token, body, msgContext);
    }

    ConfigurationContext configContext = msgContext.getConfigurationContext();
View Full Code Here

                        Principal principal = wser.getPrincipal();
                        if(principal instanceof WSDerivedKeyTokenPrincipal) {
                            //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();
View Full Code Here

     
      SOAPEnvelope envelope = msgCtx.getEnvelope();
      OMElement body = envelope.getBody();
      OMElement seqHeader = envelope.getHeader().getFirstChildWithName(seqName);
     
      SecurityToken token = secManager.recoverSecurityToken(tokenBean.getValue());
     
      secManager.checkProofOfPossession(token, seqHeader, msgCtx);
      secManager.checkProofOfPossession(token, body, msgCtx);
    }
   
View Full Code Here

   
//    //if PollingMode is true, starting the pollingmanager.
//    if (pollingMode)
//      SandeshaUtil.startPollingManager(configCtx);
   
    SecurityToken token = (SecurityToken) createSeqRMMessage.getProperty(Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
    if(token != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      rmsBean.setSecurityTokenData(secManager.getTokenRecoveryData(token));
     
      // If we are using token based security, and the 1.1 spec level, then we
View Full Code Here

    // Open a connection to the endpoint
    HttpURLConnection connection =
      FaultTestUtils.getHttpURLConnection("http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService",
          pingAction);

    StorageManager storageManager =
      SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
   
    RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
   
    String seqID = SandeshaUtil.getUUID();
   
    // Mockup an RMDBean
    RMDBean rmdBean = new RMDBean();
    rmdBean.setSequenceID(seqID);
    rmdBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmdBean.setServerCompletedMessages(new RangeString());
    // Flag that the sequence is closed.
    rmdBean.setClosed(true);
   
    // Create a transaction and insert the RMSBean
    Transaction tran = storageManager.getTransaction();
   
    rmdBeanMgr.insert(rmdBean);
   
    tran.commit();
View Full Code Here

     
      // Check that the sequence has been deleted.
      StorageManager storageManager =
        SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
     
      Transaction tran = storageManager.getTransaction();
     
      RMDBean finderBean = new RMDBean();
      List rmdBeans = storageManager.getRMDBeanMgr().find(finderBean);
     
      tran.commit();
     
      lastError = null;
     
      if (rmdBeans.isEmpty())
        lastError = new Error("rmdBeans empty " + rmdBeans);
      else {
        RMDBean bean = (RMDBean)rmdBeans.get(0);
        if (bean.isTerminated())
          break;
       
        lastError = new Error("RMDBean not deleted " + bean);
      }
    }

    if(lastError != null) throw lastError;

    while(System.currentTimeMillis() < limit) {
      Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
     
      // Check that the sequence has been deleted.
      StorageManager storageManager =
        SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
     
      Transaction tran = storageManager.getTransaction();
     
      RMDBean finderBean = new RMDBean();
      List rmdBeans = storageManager.getRMDBeanMgr().find(finderBean);
     
      tran.commit();
     
      lastError = null;
     
      if (!rmdBeans.isEmpty())
        lastError = new Error("rmdBeans not empty " + rmdBeans);
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.security.SecurityToken

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.