laravel-saml2 icon indicating copy to clipboard operation
laravel-saml2 copied to clipboard

Using ADFS Issue: The response was received at http://exampleUrl.com instead of https://exampleUrl.com

Open sonu1 opened this issue 7 years ago • 2 comments

Firstly, Thank you so much for this awesome package. The issue I am having is : Getting response was received at http://exampleUrl.com instead of https://exampleUrl.com .ERROR: Saml2 error ["invalid_response"] message while using this package.

Fiddler: SAMLResponse : after decoding : status : success and RelayState is http://exampleUrl.com which should be https://exampleUrl

Another question where do we put the handler function in the laravel project. e.g. this part :

 Event::listen('Aacotroneo\Saml2\Events\Saml2LoginEvent', function (Saml2LoginEvent $event) {
            $messageId = $event->getSaml2Auth()->getLastMessageId();
            // your own code preventing reuse of a $messageId to stop replay attacks
            $user = $event->getSaml2User();
            $userData = [
                'id' => $user->getUserId(),
                'attributes' => $user->getAttributes(),
                'assertion' => $user->getRawSamlAssertion()
            ];
             $laravelUser = //find user by ID or attribute
             //if it does not exist create it and go on  or show an error message
             Auth::login($laravelUser);
        });

What is the best way to get response once the SAML authentication is successful. Thanks you so much for time.

sonu1 avatar Aug 02 '17 04:08 sonu1

http vs https is probably an issue with your IDP. Try pointing to the https endpoint if you have http somewhere. The handler to the event will depend on your project - but it's a basic event. You can read here https://laravel.com/docs/5.4/events Finally, not sure about what do you mean about the response. That event will be called on successful response. And that code is a sample of what you could do to get the user logged in in your Auth service.

aacotroneo avatar Aug 02 '17 12:08 aacotroneo

Thanks for the help @aacotroneo . Appreciated. Another thing how can we change the RelayState of the request and response to https://exampleUrl.com

sonu1 avatar Aug 02 '17 21:08 sonu1