GenerateSAMLassertionpolicy sample throwing error 'Invalid media type'

samlsamplespproxy-rev1-2017-06-07.zipI am implementing use case given in ‘SAML Assertion Policies Study - Google Cloud Community’. When testing I am getting error ‘Invalid media type’. I did 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 error ‘Invalid media type’.

To explain more about this sample there are two proxies ‘SAMLsampleIdPproxy’ is to generate SAML assertions by looking into keystore and generate OAuth token ‘OAuthV2’ grant type ‘GenerateAccessTokenImplicitGrant’ ,but while testing proxy is throwing error.

Attaching certificate and proxy codes.samlsampleidpproxy-rev1-2017-06-07.zip

I don’t know the details of the proxy, but you need to set the Content-Type to “application/xml” before calling the SAML Policy. Either you set that in the request or use an Assign Message policy.

Hi @Srinandan Sridhar ,‘Invalid media type’ issue is resolved after changing to “application/xml”. Request received by proxy’SAMLsampleIdPproxy’, but throwing 302(url redirect) error. When I check in the trace SAML ‘assertion.content’ is not set, but bearer token got generated ‘http://example-callback.com#scope=&expires_in=1799&access_token=IarQaaJwS1QQu4mddVqTXpQmjr3T’ .

I have tested another proxy ‘SAMLsampleSPproxy’ with this token to ensure that token is valid or not. I am getting error ‘Invalid token’.

I am having two issues here.

1)SAML assertions are not set and redirect URL(I am not sure what to set).

2)Bearer token received is not correct one.

Policy code has already attached and I have used ‘freetrail’ keystore.

Could you please look into this and suggest me that right approach.