SAML-Toolkits / java-saml

Java SAML toolkit
MIT License
634 stars 396 forks source link

Error thrown when calling auth.processresponse() - SAML response not found #168

Closed shabbeer4a1 closed 6 years ago

shabbeer4a1 commented 6 years ago

In SP initiated SSO - After auth.login() was successful. Error thrown when calling auth.processresponse() - SAML response not found . How can I solve this? Please suggest .

Thanks

pitbulk commented 6 years ago

You need to verify that a POST SAMLResponse parameter was received by your Assertion Consumer Service endpoint.

Possible reasons:

shabbeer4a1 commented 6 years ago

Regarding the 3rd reason, Auth method was not properly initialized. I did initialize it properly, in a sample.jsp page which is my ACS endpoint, I have initialized the Auth method in the scriptlet as below

Code -

<%

Auth auth = new Auth(request, response);
auth.login();

String lastRequestId = auth.getLastRequestId();
auth.processResponse(lastRequestId);

if (!auth.isAuthenticated()) {
    out.println("Not authenticated");
}
......
    .....

%>

Please suggest if I am doing anything wrong there.

pitbulk commented 6 years ago

You can't do in the same view:

auth.login();
auth.processResponse(lastRequestId);

login will send an AuthNRequest to the IdP

Review this login and acs files.

Also on the acs view, print the value of request.getParameter("SAMLResponse");

shabbeer4a1 commented 6 years ago

Sure I will do these changes.

In the onelogin.saml.properties file, I have give the values as below

onelogin.saml2.sp.entityid = https:///Examples/

onelogin.saml2.sp.assertion_consumer_service.url = https:///Examples/sample.jsp

is this the way I need to configure the ACS endpoint?

pitbulk commented 6 years ago

SP acs endpoint = the url that loads the acs view

shabbeer4a1 commented 6 years ago

In the example settings file at java-saml/samples/java-saml-tookit-jspsample/src/main/resources/onelogin.saml.properties in onelogin github,

the entity id was pointing to metadata.jsp.

is it required to validate the metadata as in the metadata.jsp?

as it is here

pitbulk commented 6 years ago

No, you can set as IdP EntityID any URI value