Package org.apache.sandesha2.security

Examples of org.apache.sandesha2.security.SecurityManager


      storageManager.storeMessageContext(clonedMsgStoreKey, clonedMessage);
      rmsBean.setReferenceMessageStoreKey(clonedMsgStoreKey);
     
      SecurityToken token = (SecurityToken) createSeqRMMessage.getProperty(Sandesha2Constants.MessageContextProperties.SECURITY_TOKEN);
      if(token != null) {
        SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
        rmsBean.setSecurityTokenData(secManager.getTokenRecoveryData(token));
      }

      // Update the RMSBean
      storageManager.getRMSBeanMgr().update(rmsBean);
      SenderBean createSeqEntry = new SenderBean();
View Full Code Here


        FaultManager.makeUnsupportedSelectionFault(rmMsgCtx, makeConnection.getUnexpectedElement());

      //some initial setup
      ConfigurationContext configurationContext = rmMsgCtx.getConfigurationContext();
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configurationContext);
      SecurityToken token = secManager.getSecurityToken(rmMsgCtx.getMessageContext());

      //we want to find valid sender beans
      List<RMSequenceBean> possibleBeans = new ArrayList<RMSequenceBean>();
      int possibleBeanIndex = -10;
      SenderBean findSenderBean = new SenderBean();
      boolean secured = false;
      if (token != null && identifier == null) {
        secured = true;
        if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("token found " + token);
        //this means we have to scope our search for sender beans that belong to sequences that own the same token
        String data = secManager.getTokenRecoveryData(token);
        //first look for RMS beans
        RMSBean finderRMS = new RMSBean();
        finderRMS.setSecurityTokenData(data);
        finderRMS.setToEPR(address);
        List<RMSBean> tempList2 = storageManager.getRMSBeanMgr().find(finderRMS);
View Full Code Here

    if(bean!=null){
      tokenData = bean.getSecurityTokenData();
    }
    if(tokenData != null) {
      if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("debug:" + tokenData);
      SecurityManager secManager = SandeshaUtil.getSecurityManager(context.getConfigurationContext());
      SecurityToken token = secManager.recoverSecurityToken(tokenData);
      secManager.checkProofOfPossession(token, elementToCheck, context); //this will exception if there is no proof
    }
   
    if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled())
      log.debug("Exit: SandeshaUtil::assertProofOfPossession");
  }
View Full Code Here

    return null; //could not find the sequenceKey
  }
 

  public static SecurityManager getSecurityManager(ConfigurationContext context) throws SandeshaException {
    SecurityManager util = null;
    AxisConfiguration config = context.getAxisConfiguration();
    Parameter p = config.getParameter(Sandesha2Constants.SECURITY_MANAGER);
    if(p != null) util = (SecurityManager) p.getValue();
    if (util != null) return util;
View Full Code Here

    createSeqRMMsg.setCreateSequence(createSequencePart);

    // Find the token that should be used to secure this new sequence. If there is a token, then we
    // save it in the properties so that the caller can store the token within the create sequence
    // bean.
    SecurityManager secMgr = SandeshaUtil.getSecurityManager(context);
    SecurityToken token = secMgr.getSecurityToken(applicationMsgContext);
    if(token != null) {
      OMElement str = secMgr.createSecurityTokenReference(token, createSeqmsgContext);
      createSequencePart.setSecurityTokenReference(str);
      createSeqRMMsg.setProperty(Sandesha2Constants.MessageContextProperties.SECURITY_TOKEN, token);
     
      // If we are using token based security, and the 1.1 spec level, then we
      // should introduce a UsesSequenceSTR header into the message.
      if(createSequencePart.getNamespaceValue().equals(Sandesha2Constants.SPEC_2007_02.NS_URI)) {
        UsesSequenceSTR usesSeqStr = new UsesSequenceSTR();
        usesSeqStr.toHeader(createSeqmsgContext.getEnvelope().getHeader());
      }

      // Ensure that the correct token will be used to secure the outbound create sequence message.
      // We cannot use the normal helper method as we have not stored the token into the sequence bean yet.
      secMgr.applySecurityToken(token, createSeqRMMsg.getMessageContext());
    }

    createSeqRMMsg.setAction(SpecSpecificConstants.getCreateSequenceAction(rmsBean.getRMVersion()));
    createSeqRMMsg.setSOAPAction(SpecSpecificConstants.getCreateSequenceSOAPAction(rmsBean.getRMVersion()));
View Full Code Here

    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

    }
   
    // Reset the security manager, and then load it
    parameter = config.getParameter(Sandesha2Constants.SECURITY_MANAGER);
    if(parameter != null) config.removeParameter(parameter);
    SecurityManager util = SandeshaUtil.getSecurityManager(configContext);
    util.initSecurity(module);

    // Mark the config context so that we can run sync 2-way interations over
    // RM, but at the same time switch it off for unreliable messages.
    // We do a similar trick with the code that does an early HTTP 202 for
    // messages that don't need their backchannel.
View Full Code Here

    // 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);
     
      // The create must be the body part of this message, so we check the
      // security of that element.
      OMElement body = msgcontext.getEnvelope().getBody();
      secManager.checkProofOfPossession(token, body, msgcontext);
    }

    MessageContext outMessage = null;
    try {
      outMessage = Utils.createOutMessageContext(createSeqMsg); // createing
View Full Code Here

    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropertyBeanMgr();
   
    // 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,
        storageManager);
View Full Code Here

    String sequencePropertyKey = SandeshaUtil.getSequencePropertyKey(terminateResRMMsg);

    // 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();

    //shedulling a polling request for the response side.
View Full Code Here

TOP

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

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.