Re: STS Issued Token - Get the Saml Explicitly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: STS Issued Token - Get the Saml Explicitly

forums
Hello, I know this is a very old post, but I thought to share my issue here
as it very closely matches with the solution indicated above on this thread.
I am trying to create a direct client that will hit STS and get the token in
return. I have used metro latest jar files for the same. I have also imported
certificates from server in my local JRE\security\lib\cacerts. My client is a
standalone java client. Here's code snippet. STSIssuedTokenConfiguration
stsConfig = null; String stsServiceName="SecurityTokenService"; String
stsPortName="UserNameWSTrustBinding_IWSTrust13Sync"; String
stsNamespace="http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice";
stsConfig = new DefaultSTSIssuedTokenConfiguration(stsEndpoint,
stsWSDLLocation, stsServiceName, stsPortName, stsNamespace);
((DefaultSTSIssuedTokenConfiguration) stsConfig)
.setTokenType("urn:oasis:names:tc:SAML:1.0:assertion");
((DefaultSTSIssuedTokenConfiguration) stsConfig)
.setProtocol(STSIssuedTokenConfiguration.PROTOCOL_13); IssuedTokenManager
manager = IssuedTokenManager.getInstance();
com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true;
stsConfig.getOtherOptions().put(BindingProvider.USERNAME_PROPERTY, userName);
stsConfig.getOtherOptions().put(BindingProvider.PASSWORD_PROPERTY, password);
String appliesTo = "http://testing/test/"; IssuedTokenContext ctx =
manager.createIssuedTokenContext(stsConfig, appliesTo);
manager.getIssuedToken(ctx); Token issuedToken = ctx.getSecurityToken();
Element samlAsser = (Element)issuedToken.getTokenValue();
System.out.println(samlAsser); It shows me response with saml:Assertion in
raw xml format. But when I am printing value on last line of samlAsser, it
prints only this. [saml:Assertion: null] Here's soap response that I get in
return.
http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal
uuid:ecb72221-0d57-4269-a3cb-f423617122bb
2013-05-01T06:40:23.150Z 2013-05-01T06:45:23.150Z 256
2013-05-01T06:40:23.150Z 2013-05-01T08:40:23.150Z http://testing/test/
http://testing/test/ urn:oasis:names:tc:SAML:1.0:cm:holder-of-key
peYYks3BRnEYZv0DHhM8KZifwtp0y75cax0vbpvxRT8= [User name here] System
Administrator 1e836120-7c9b-45f2-9ed3-9bbb1ff495df
7fd4f562-6b80-434b-b223-c6763a498024 System
z/V0ebeBYmVRc2lAHAR2DuQpzeCuA5RST3aN0P9FhXU=
WnAC7PiWFCCp52NyCLSfEd0tdCh2YBBNwjX9AE29fuuZvHwZFT+ld5VQblFMfCs+Yg6j83pwOraF1bHHrRba38kMi7dnEs9EdhW85Sf02qhaK5WWzQhGliGhK0p032oSi2klPraB6lmeXicpOmVWskP7Got2VobQ7YT+p6Lc1EeeCS0Ng87br+gyj6Aeg0dBCD1RMRiYPjXQF8JHBQl82DGVkNLDygd9flrVVnpQAB7fBBBHYGr4qPjVZXllktVrHip6hUojOhV+YkK4RAx1cDSyrReuUzqMq2paVncgrMUitMn4eV3GYJEchJPk4dQb7hiFCvU8yxc1gmz9USTy+g==
MIIDBzCCAe+gAwIBAgIQ0U58Uc3zo5lDnp6y/qaFEzANBgkqhkiG9w0BAQsFADATMREwDwYDVQQDEwhTdXBlciBDQTAeFw0xMzAyMjYxODM3MjZaFw0zOTEyMzEyMzU5NTlaMBQxEjAQBgNVBAMTCVN1cGVyQ2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJgHHvjzTDyu6MTeiqGvBlKcxVwi50BqXAXpZXCks8u/zomMMDonY/Iu+Qe4TQHMM8TfKWah2vEQKTVVwQR4bBrzSb587Jyo8crw2JxtE5G7uLzn4Y5OLgowoMYwhO2pUgCfril4c97UhbcM0Dw/idgqfBAn0n1wRDcI13dxJv9w3rv7pLlpNbhVEWvTB/8xAoYoj3xa62lA2AZTY6UwcQ0vrTcwypF7C3cf7T5Ux2ovj209kicbVPcGIOHDgfkkHbois8eNLy4BZcNXgoqRuFS3Znav7wZA4KV5h9d8RgDiTXViQEzCEn67MBMCuOeLcBZk7zD1Wc9j4V0woDi345sCAwEAAaNWMFQwDAYDVR0TAQH/BAIwADBEBgNVHQEEPTA7gBCUyYSKFDuNUJFUbKDI2igwoRUwEzERMA8GA1UEAxMIU3VwZXIgQ0GCEIZzARODVEqORvB5vxIMPNMwDQYJKoZIhvcNAQELBQADggEBAFUWdVxeIri6iALme2FKMBEfFI41rRVNWkxvczS2SkIDv+47NDbn0Z3oOG1vZY6TUUM4ukZc677fSanu+KzAj9cST35Z4hx5txKG8WToij340iHAT8ltwvnOW7CDJD6NMKyoztCRqtWuDSGM0p3xHeSeMqXI++mP8TkgCMmrDLuYic2Mthsp8L+eEvErAqrqD1AygeMe81zejsnv0cGTgJNDMhDYk1QVBF49eu81I0Iq0R2iAucBjpKNG0F5CbjnQs9A6CqYHca8Ri0XdQk4bEsbQblwr9/eY4zTSO
 HYCT1PPYRCYCWMFl6dQ2fptHscEi9pRgBys7btp0mPCMq3Wlc=

peYYks3BRnEYZv0DHhM8KZifwtp0y75cax0vbpvxRT8=
_9a70953e-e2fd-4e67-9fd5-31e262acc255 _9a70953e-e2fd-4e67-9fd5-31e262acc255
urn:oasis:names:tc:SAML:1.0:assertion
http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue
http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey I am not sure
how should I get this soap response in java object. Any help is very much
appreciated. Thanks.

--

[Message sent by forum member 'sagarshah1983']

View Post: http://forums.java.net/node/683761