[EXTERNAL MESSAGE] Re: [cf-dev] Using SAML 2 Bearer token with our own UAA Server #uaa
Thanks. I digged into this a little deeper. During the SAML verification, confirmed is never TRUE and that’s why it gives the following error
2019-12-10T16:45:24.58-0500 [APP/PROC/WEB/1] OUT Caused by: org.opensaml.common.SAMLException: Assertion invalidated by subject confirmation - can't be confirmed by the bearer method
SPSSODescriptor spssoDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata(); for (AssertionConsumerService service : spssoDescriptor.getAssertionConsumerServices()) { if (context.getCommunicationProfileId().equals(service.getBinding()) && service.getLocation().equals(data.getRecipient())) { confirmed = true; } }
Here are the consumer assertion services defined in my UAA metadata.
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https:///saml/SSO/alias/cloudfoundry-saml-login-dev" index="0" isDefault="true" /> <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:URI" Location="https:///oauth/token/alias/cloudfoundry-saml-login-dev" index="1" />
The SAML Assertion that comes in – has the following
<Subject> <NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">HIDDEN</NameID> <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> <SubjectConfirmationData InResponseTo="" NotOnOrAfter="" Recipient="https:///saml/SSO/alias/cloudfoundry-saml-login-dev" /> </SubjectConfirmation> </Subject>
See that the recipient matches with https:///saml/SSO/alias/cloudfoundry-saml-login-dev but I think the Binding does not match (in the code I am not sure what binding is matched to. Is it Method ?) .
Do I have to change my uaa.yml to somehow add a new Assertion Consumer Service ?
Viraj Shetty
From: cf-dev@... <cf-dev@...> On Behalf Of Filip Hanik
Sent: Tuesday, December 10, 2019 6:49 PM To: CF Developers Mailing List <cf-dev@...> Subject: [EXTERNAL MESSAGE] Re: [cf-dev] Using SAML 2 Bearer token with our own UAA Server #uaa
1. Take a look at the endpoint `/saml/metadata` on your server. For example https://login.run.pivotal.io/saml/metadata
In the metadata, take a look at: urn:oasis:names:tc:SAML:2.0:bindings:URI binding, for the exact location to POST your Assertion https://login.run.pivotal.io/oauth/token/alias/login.run.pivotal.io" index="1"/>
2. You can have the NameID encrypted, not the assertion itself.
Correct: Incorrect: Incorrect:
3. A fully working example you can run in your Debugger can be viewed here (no server required)
On Tue, Dec 10, 2019 at 2:07 PM vshetty via Lists.Cloudfoundry.Org <vshetty=fdic.gov@...> wrote:
|
|
Filip Hanik
See that the recipient matches with https://<HIDDEN>/saml/SSO/alias/cloudfoundry-saml-login-dev but I think the Binding does not match (in the code I am not sure what binding is matched to. Is it Method ?) . It's been a while since I dug into that code, but I think the Recipient should match the URL you're posting the message to, which is: http://<host>/uaa/oauth/token/alias/cloudfoundry-saml-login-dev Filip |
|
Filip Hanik
probably https:// and not http:// |
|
Shetty, Viraj S [CTR]
Thanks. |
|