Hi,
I am trying to implement SAML assertion policy usecase in my edge. To do that I have referred link:https://community.apigee.com/articles/37587/saml-assertion-policies-study.html. I have followed this and implemented below steps.
1)I have created a certificate 'mockserverKeyrstore' using open ssl.
2)Created a keystore 'mockserverKeystore' and added above certificate.
3)Created proxies 'SAMLsampleIdPproxy'(generate SAML assertions and prepare key) and 'SAMLsampleSPproxy'(validate access token) as API products.
4)Created app 'SAMLAPP' and added above API products. I got consumer key and secret code.
5)Tested proxy with url 'http://apitechbasics-prod.apigee.net/samlsampleidpproxy/GenerateIdPToken?response_type=token&redirection_uri=http://localhost:2999&client_id=4hCaENG9MyJL08T3aOQaLImj8TnlxCKA'
I am getting error401. Attaching code and certificates for your reference. Could you please help me in running this sample.
Also need some more clarification on the article, How SAML assertions are being validated against key store.samlsampleidpproxy-rev1-2017-06-07.zipsamlsamplespproxy-rev1-2017-06-07.zip
Hi ,
Could you please look into this scenario and help me understanding the concept. If you have code already available for usecase :https://community.apigee.com/articles/37587/saml-assertion-policies-study.html, please provide me the link.
Do you get an error at the Verify Access token policy in your preflow? You can see this from the trace in the UI.
Hi @veeraraghavendra
The reason you receive a 401 unauthorized is because your samlsampleidpproxy-rev1-2017-06-07 has the VerifyAccessToken policy in the preflow, which means that your request must include an access token in the Authorization: Bearer token header. The request that you posted does not have that header included in it.
In order for your request to succeed, you have two options:
1) Disable/remove the VerifyAccessToken policy in the preflow.
2) Obtain an access token by sending a client credentials request to your OAuth proxy to generate an access token first. Then include that access token in the Authorization: Bearer token header on the request. So the updated request is shown below. Make sure to include the access_token.
curl -H 'Authorization: Bearer access_token' 'http://apitechbasics-prod.apigee.net/samlsampleidpproxy/GenerateIdPToken?response_type=token&redirection_uri=http://localhost:2999&client_id=4hCaENG9MyJL08T3aOQaLImj8TnlxCKA'
I recommend the first option because the purpose of SAML IDP proxy is to generate a SAML assertion and an access token, given that the OAuth v2 (generate access token) policy is able to verify the client ID and the redirect URI.
All the other steps that you completed seem to be correct.
I'll quickly summarize this community article and explain how it works.
1) The SAML IDP proxy has two policies, a) Generate SAML, b) OAuth v2 - Generate Access Token (implicit grant).
2) The SAML SP proxy is for you to verify the access token generated by the SAML IDP proxy. When the Verify Access Token policy executes, you can see in the trace that the SAML assertion is associated to the access token.