Package org.apache.rahas.client

Examples of org.apache.rahas.client.STSClient


                if(secConvTok != null) {
                   
                    Policy issuerPolicy = secConvTok.getBootstrapPolicy();
                    issuerPolicy.addAssertion(rpd.getRampartConfig());
                   
                    STSClient client = new STSClient(message.getConfigurationContext());
                    Options op = new Options();
                    op.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE, Constants.VALUE_TRUE);
                    client.setOptions(op);
                    client.setAction(action);
                    client.setRstTemplate(rstTmpl);
                    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);
                   
View Full Code Here


                return customTokeId;
            } else {
   
                Axis2Util.useDOOM(false);
               
                STSClient client = new STSClient(rmd.getMsgContext()
                        .getConfigurationContext());
                // Set request action
                client.setAction(action);
               
                client.setVersion(rmd.getWstVersion());
               
                client.setRstTemplate(rstTemplate);
       
                // Set crypto information
                Crypto crypto = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
                        rmd.getMsgContext().getAxisService().getClassLoader());
                CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
                client.setCryptoInfo(crypto, cbh);
       
                // Get service policy
                Policy servicePolicy = rmd.getServicePolicy();
       
                // Get service epr
                String servceEprAddress = rmd.getMsgContext()
                        .getOptions().getTo().getAddress();
       
                //If addressing version can be found set it
                Object addrVersionNs = msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if(addrVersionNs != null) {
                    client.setAddressingNs((String)addrVersionNs);
                }
               
                Options options = new Options();
               
                options.setUserName(rmd.getMsgContext().getOptions().getUserName());
                options.setPassword(rmd.getMsgContext().getOptions().getPassword());
               
                if (msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER) != null) {
                    Protocol protocolHandler =
                        (Protocol)msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);;
                    options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, protocolHandler);                
                }
               
                if (msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF) != null ) {
                    Parameter pwCallback = msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF);
                    client.addParameter(pwCallback);
                }
               
                client.setOptions(options);
               
                //Set soap version
                if (msgContext.isSOAP11()) {
                    client.setSoapVersion(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                } else {
                    client.setSoapVersion(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                }
               
               
                //Make the request
                org.apache.rahas.Token rst =
                    client.requestSecurityToken(servicePolicy,
                                                issuerEpr,
                                                issuerPolicy,
                                                servceEprAddress);
               
                //Add the token to token storage
View Full Code Here

      System.out.println("Usage: $java Client endpoint_address client_repo_path policy_xml_path");
    }

    ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], null);   
   
    STSClient stsClient = new STSClient(ctx);   
   
    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

                return customTokeId;
            } else {
   
                Axis2Util.useDOOM(false);
               
                STSClient client = new STSClient(rmd.getMsgContext()
                        .getConfigurationContext());
                // Set request action
                client.setAction(action);
               
                client.setVersion(rmd.getWstVersion());
               
                client.setRstTemplate(rstTemplate);
       
                // Set crypto information
                Crypto crypto = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
                        rmd.getMsgContext().getAxisService().getClassLoader());
                CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
                client.setCryptoInfo(crypto, cbh);
       
                // Get service policy
                Policy servicePolicy = rmd.getServicePolicy();
       
                // Get service epr
                String servceEprAddress = rmd.getMsgContext()
                        .getOptions().getTo().getAddress();
       
                //If addressing version can be found set it
                Object addrVersionNs = msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if(addrVersionNs != null) {
                    client.setAddressingNs((String)addrVersionNs);
                }
               
                Options options = new Options();
               
                options.setUserName(rmd.getMsgContext().getOptions().getUserName());
                options.setPassword(rmd.getMsgContext().getOptions().getPassword());
               
                if (msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER) != null) {
                    Protocol protocolHandler =
                        (Protocol)msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);;
                    options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, protocolHandler);                
                }
               
                if (msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF) != null ) {
                    Parameter pwCallback = msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF);
                    client.addParameter(pwCallback);
                }
               
                client.setOptions(options);
               
                //Set soap version
                if (msgContext.isSOAP11()) {
                    client.setSoapVersion(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                } else {
                    client.setSoapVersion(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                }
               
               
                //Make the request
                org.apache.rahas.Token rst =
                    client.requestSecurityToken(servicePolicy,
                                                issuerEpr,
                                                issuerPolicy,
                                                servceEprAddress);
               
                //Add the token to token storage
View Full Code Here

            String issuerEpr, String action, Policy issuerPolicy) throws RampartException {

        try {
            Axis2Util.useDOOM(false);
           
            STSClient client = new STSClient(rmd.getMsgContext()
                    .getConfigurationContext());
            // Set request action
            client.setAction(action);
           
            client.setRstTemplate(rstTemplate);
   
            // Set crypto information
            Crypto crypto = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
                    rmd.getMsgContext().getAxisService().getClassLoader());
            CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
            client.setCryptoInfo(crypto, cbh);
   
            // Get service policy
            Policy servicePolicy = rmd.getServicePolicy();
   
            // Get service epr
            String servceEprAddress = rmd.getMsgContext()
                    .getOptions().getTo().getAddress();
   
            //Make the request
            org.apache.rahas.Token rst =
                client.requestSecurityToken(servicePolicy,
                                            issuerEpr,
                                            issuerPolicy,
                                            servceEprAddress);
           
            //Add the token to token storage
View Full Code Here

                return customTokeId;
            } else {
   
                Axis2Util.useDOOM(false);
               
                STSClient client = new STSClient(rmd.getMsgContext()
                        .getConfigurationContext());
                // Set request action
                client.setAction(action);
               
                client.setRstTemplate(rstTemplate);
       
                // Set crypto information
                Crypto crypto = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
                        rmd.getMsgContext().getAxisService().getClassLoader());
                CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
                client.setCryptoInfo(crypto, cbh);
       
                // Get service policy
                Policy servicePolicy = rmd.getServicePolicy();
       
                // Get service epr
                String servceEprAddress = rmd.getMsgContext()
                        .getOptions().getTo().getAddress();
       
                //Make the request
                org.apache.rahas.Token rst =
                    client.requestSecurityToken(servicePolicy,
                                                issuerEpr,
                                                issuerPolicy,
                                                servceEprAddress);
               
                //Add the token to token storage
View Full Code Here

TOP

Related Classes of org.apache.rahas.client.STSClient

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.