php-sso

One sign-in for everything you run

php-sso is an OpenID Connect provider written in PHP. It signs your people in, asks for a second factor, lets staff of other companies in through SAML, and tells your apps who they are. It needs one container and no other services.

DR
Dana ReyesGoogle account
Email
dana.reyes@example.org
Groups
customers
Roles
viewer

"amr": ["fed"]

SO
Sam OkaforAcme's identity provider (SAML)
Email
sam@acme.com
Groups
acme-partners
Roles
editor

"amr": ["fed"]

AS
Alice SmithPassword and authenticator code
Email
alice@example.com
Groups
staff, finance
Roles
editor, admin

"amr": ["pwd", "otp", "mfa"]

Three people, three ways in. Each app learns who they are, which groups and roles they have, and how they signed in.

What you get

All of this is built and managed from the admin panel.

Signing in

Identifier first
Ask who someone is, then how they prove it. Sign in by username, email address, or either.
Two-step verification
An authenticator app with a QR code to scan, and recovery codes. Make it optional, required for administrators, or required for everyone.
Social sign-in
Google, GitHub, or any OpenID Connect provider. People are matched on the provider's own id, never on the email address alone.
Steps before sign-in
Make someone choose a new password, or accept a notice you link to, before they can continue. Existing sessions are stopped too.

Companies

SAML
Staff of a customer or partner sign in through their own identity provider, such as Okta or Entra. Their email domain sends them there.
SCIM
The company's system creates, updates and deactivates people and groups here. Deactivating someone ends their sessions at once.

Your apps

OpenID Connect
Authorization code with PKCE, refresh tokens that rotate, device flow, client credentials, and logout that reaches your apps.
Groups and roles
Apps receive the groups a person is in and the roles you give them, per app.
Who may use an app
Restrict an app to chosen people or groups, and to chosen network addresses.
How they signed in
Every ID token says whether a password, an outside account or a second factor was used, so an app can require one.

Running it

Admin panel
Users, groups, apps, company connections, notices and sign-in settings, in one place.
Sign-in protection
See failed attempts as they happen, reset them for one person, and set the limits yourself. Lock accounts and restrict addresses.
Your look
Sign-in and account pages are templates you mount as a folder. Change them without rebuilding.
One container
Apache and PHP with a SQLite file on a volume. There is no database server, queue or cache to run.

See how a sign-in is decided

php-sso asks different things of different people. Try your own team, then a company address, and switch on the second step. What your app receives changes with how the person signed in.

Use alice@example.com to be asked for a password, or sam@acme.com to be sent to a company's identity provider.

A simulation in your browser. Nothing is sent anywhere, and the claims are an example, not a signed token.

Your apps need only OpenID Connect

Point any OpenID Connect library at the discovery address and register the app in the admin panel. There is no SDK to install.

The ID token says who signed in and how: sub, email, groups, roles, auth_time and amr. An app that needs a second factor checks that amr contains mfa.

Each app lists the scopes it may ask for. Signing out of one app can end the session in the others.

Issuer
https://sso.example.com
Discovery
https://sso.example.com/.well-known/openid-configuration
Flow
Authorization code with PKCE (S256), required for every app
Scopes
openid profile email groups roles, and any you add
Logout
RP-initiated, plus back-channel logout to apps that support it

Let other companies' people in

A customer or partner signs in with their own identity provider. You add the connection and the email domains it speaks for. Their system can also keep the list of people up to date, so someone who leaves the company is out of your apps too.

SAML sign-in

  • Someone who types an address at the company's domain goes straight to their provider, with no password page.
  • A company can only speak for addresses at its own domains. It cannot vouch for anyone else's.
  • Answers from the provider must be signed, meant for you, recent, and a reply to a sign-in you started.

SCIM provisioning

  • Tokens are shown once, kept as hashes, and limited to the domains you choose.
  • A SCIM client never touches administrators or people it did not create.
  • Deactivating a person locks the account and ends their sessions at once.

Where it stands

php-sso is young: the application is at version 0.1 and the libraries it is built on are at 1.0. It is open source under the MIT license. It has hundreds of automated tests and ships as a production Docker image, but it has not had an independent security review, so treat it that way. SAML and SCIM have been tested against simulated providers, not yet against Okta or Entra.

Not there yet

  • No password reset by email.
  • No general audit log. Sign-in history and SCIM requests are kept.
  • Back-channel logout is sent once, with no retry queue.
  • Signing keys are created once and do not rotate by themselves.
  • No consent screen: it is made for your own apps.
  • SAML requests are not signed, and there is no single logout.
  • SCIM covers users and groups, not bulk operations.
  • No pushing people out to your apps (SCIM client).

Documentation

How to install, configure and run php-sso is in its own documentation, which lives with the code. The three libraries it is built on each have theirs, and you can use them in your own PHP applications. All four are open source under the MIT license.

php-sso
The identity provider: installing it, setting it up, connecting your apps, SAML, SCIM and changing how it looks.
oauth-server
The OAuth 2.0 and OpenID Connect library underneath, for building your own server.
composer require php-sso/oauth-server
scim-server
SCIM 2.0 provisioning of users and groups, with your own accounts and storage behind it.
composer require php-sso/scim-server
saml
SAML 2.0 sign-in through a company's identity provider, for any PHP application.
composer require php-sso/saml