You could take a look at the following unit tests which shows how to call the STS in code using the STSClient:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java?view=markup Colm. On Tue, Feb 11, 2014 at 5:30 PM, Mishra, Praveen <[email protected] > wrote: > > Hi, > > We are using STS sample to evaluate how we can use the dispatch API to > achieve WS-trust support in CXF and facing problem in setting the effective > policy. > The stsclient properties and request context properties as follows: > > Policy wsaPolicy = PolicyHelper.parsePolicy(client, "/wsa-policy.xml"); > dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES,createMaps()); > dispatch.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE, > wsaPolicy); Map<String,Object> stsmap = setSTSMaps(); > client.getRequestContext().putAll(stsmap); > STSClient sts = new STSClient(client.getBus()); sts.setServiceQName(new > QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/ > ","SecurityTokenService")); > sts.setEndpointName("{ > http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port"); > client.getRequestContext().put("ws-security.sts.client", sts ); > Map<String, Object> stsprop = new HashMap<String, Object>() ; > stsprop.put("ws-security.username","alice"); > stsprop.put("ws-security.callback-handler","ClientCallbackHandler"); > > stsprop.put("ws-security.encryption.properties","clientKeystore.properties"); > stsprop.put("ws-security.encryption.username","mystskey"); > stsprop.put("ws-security.sts.token.username","myclientkey"); > > stsprop.put("ws-security.sts.token.properties","clientKeystore.properties"); > stsprop.put("ws-security.sts.token.usecert","true"); > sts.getProperties().putAll(stsprop); > > We are trying to evaluate the Apache CXf STS Sample comes with Sample > examples. We are trying to setup Dynamically through properties. > > Please let us know what are the required properties needs to be set. Or if > we are missing anything above. > > > Thanks, > Praveen > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
