Search code examples
javajava-metro-frameworksts-securitytokenservicewsit

Can you change the SecurityTokenService's AlgorithmSuite programmatically?


I have to consume a service which has this snippet in the documentation:

...you may need to release an update that changes the configured STS URL to the v1.3 production end point, and changes the AlgorithmSuite on the STS binding to SecurityAlgorithmSuite.Basic256Sha256Rsa15

Here's how I do my request:

IService service = new Service(new URL(getServiceWSDL())).getWS2007FederationHttpBindingIService();

((WSBindingProvider) service).getRequestContext().put(CERTIFICATE_PROPERTY, getCertificate());
((WSBindingProvider) service).getRequestContext().put(PRIVATEKEY_PROPERTY, getPrivateKey());
((WSBindingProvider) service).getRequestContext().put(STS_NAMESPACE, getSTSNamespace());
((WSBindingProvider) service).getRequestContext().put(STS_PORT_NAME, getSTSPortName());
((WSBindingProvider) service).getRequestContext().put(STS_SERVICE_NAME, getSTSServiceName());
((WSBindingProvider) service).getRequestContext().put(STS_ENDPOINT, getSTSEndpoint());
((WSBindingProvider) service).getRequestContext().put(STS_WSDL_LOCATION, getSTSWDSLLocation());

service.operation(...);

When the request executes, it authenticates first with the STS then does the actual request. How do I change the AlgorithmSuite for the STS part of the request?

I tried declaring it in the WSDL of the STS but I don't think the request actually loads anything using that WSDL.


Solution

  • You can't change it programmatically. If you have to change it, you have to modify the WSDL before it is loaded. I just manually modified the actual WSDL that I was using but you can do that programmatically.