Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Propolis's avatar

SSO / SAML 2.0

I am trying to make an SSO solution. I have a separate login server with a central user database. I want to authenticate users through this server and redirect them to another server with the application on it.

I was pointed out the SAML 2.0 that allows this. For example. https://github.com/aacotroneo/laravel-saml2

However, the above can only be configured as a service provider. Reference is made to onelogin for the identity provider. However, I am looking for a solution that I can install on my laravel environment. Preferably with a clear step by step instruction.

I also came across these: https://github.com/codegreencreative/laravel-samlidp With this, an identity provider can be created. But which service provider package can communicate well with this?

Has someone experience with both an identity provider and service provider in a laravel environment? Which packages did you use for this? Is there anything like a description, instruction where both IdP and SP are properly described and how they are linked to each other in a PHP or Laravel environment?

0 likes
3 replies
ken-mills's avatar

Hello, Did you ever figure out how to implement IDP and SP in Laravel? Any recommendations?

Propolis's avatar

Hi Ken, I did not manage how it is described above. I have found another solution. On both Laravel servers I have set the app key in the .env file to the same value. This leads to the desired result for me.

Propolis's avatar

On the login server I provide a redirect to the application server after logging in. On the application server I redirect to the login server when not logged in. On the application server I made a DB connection to the login server in the user model. I have added this line in User.php

protected $connection = 'auth_db';

In the config/database.php I have added an extra database connection auth_db that refers to the login server database.

On the login server I work with a whitelist of IP addresses that may access the database. There I added the IP address of the application server. Via secure connection of course.

2 likes

Please or to participate in this conversation.