Download the PHP package postiefs/laravel-sso without Composer

On this page you can find all versions of the php package postiefs/laravel-sso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-sso

postiefs/laravel-sso

Sign in to a Laravel app through the Postiefs SSO portal (Microsoft Entra ID). The portal owns the session: this package trusts its launch token, mirrors its deadline, and signs the user out when an administrator ends the session or removes their access. Local logins keep working next to it.

For a Filament panel add postiefs/laravel-filament-sso on top.

Documentation

How it works

Launch token claims: iss=sso-portal, aud=<app id>, exp (about 60s, the token itself), sexp (the session's absolute deadline, adopted as is and never extended), jti (the portal session id), email, name, sub, roles, department, groups.

If the portal cannot be reached the user stays signed in (fail open): an outage never locks everyone out.

Install

sso:install publishes config/postiefs-sso.php, prints the .env keys and the Callback URL to register in the portal (https://your-app.example.com/sso/callback, exactly). A Callback URL that points anywhere else is the usual reason a sign-in "does nothing"; with postiefs-sso.stray_token.forward on (the default) the package forwards a token that landed on the wrong page, and logs a warning that names the page.

Single sign-on is off until SSO_APP_ID and SSO_JWT_SECRET are set. Test the connection and the secret:

Use

Protect routes with the sso middleware group (sign in through the portal + the portal's session rules), or only the session rules on routes that already have your own auth:

In a Blade layout (no Filament) add the browser guard and, on your login page, the button:

Read the portal session anywhere:

Users

postiefs-sso.user decides how the token's email becomes a local user. By default a user is found by email (case insensitive) or created with a random password; an existing user is never changed, except the columns listed in postiefs-sso.user.sync.

Setting
model, guard, match_on the user model, the auth guard, the column matched against the email
create_missing create a user the first time someone signs in
defaults extra attributes of a created user, for example ['status' => 'active']
attributes column => claim, written when a user is created (columns the table lacks are skipped)
sync column => claim, refreshed on every sign-in

The package ships no migration and adds no columns to users.

Who may sign in

Extend the resolver and point postiefs-sso.user.resolver at it:

Roles stay local (for example spatie/laravel-permission); the package never applies the portal's roles. Give a new user a starting role with an event:

Events: SsoUserCreated, SsoLoggedIn (with created), SsoSessionEnded (reason: expired, revoked, unknown_session, a portal denial reason, logout).

Logging

Every line starts with [sso]. Warnings and errors are always written (token rejected, portal unreachable, secret mismatch, stray token). Set SSO_DEBUG=true to log each step of a sign-in while connecting an app (callback reached, token accepted, user resolved, redirect target), and SSO_LOG_CHANNEL to send them to their own channel.

Testing your app

Bind a fake Postiefs\Sso\Contracts\PortalClient to fake the portal.

Extending

Contract
Contracts\PortalClient talks to the portal (verify the token, check a session)
Contracts\UserResolver identity to local user

Exceptions: InvalidSsoToken, SsoNotConfigured, and SignInFailed (an HttpException, so Laravel renders the error page with the right status). Messages live in resources/lang/en/messages.php (php artisan vendor:publish --tag=postiefs-sso-lang).

Tests


All versions of laravel-sso with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
firebase/php-jwt Version ^6.10|^7.0
illuminate/auth Version ^11.0|^12.0|^13.0
illuminate/cache Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/session Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package postiefs/laravel-sso contains the following files

Loading the files please wait ...