Download the PHP package lumoauth/laravel without Composer

On this page you can find all versions of the php package lumoauth/laravel. 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

lumoauth/laravel

The LumoAuth package for Laravel 11 and 12. It adds four things:

The package builds on the core SDK, lumoauth/lumoauth. That package documents the namespaces, credentials, scopes and errors.

Laravel 11 and 12 need PHP 8.2 or later. The package does not support Laravel 10: Composer refuses to install Laravel 10 because of its security advisories.

Install

The first command installs the latest version. Packagist lists the versions.

Package discovery registers the service provider and the facade alias.

The SDK sends its requests through a PSR-18 client and finds one by itself. A Laravel application already has guzzlehttp/guzzle, which is such a client, so nothing else is needed. In an application without it, run composer require guzzlehttp/guzzle.

Configuration

Key in config/lumoauth.php Environment variable Default
url LUMOAUTH_URL https://app.lumoauth.dev (EU: https://eu.app.lumoauth.dev)
org_id LUMOAUTH_ORG_ID none; not needed with custom_domain
custom_domain LUMOAUTH_CUSTOM_DOMAIN none; the organization's own domain, such as auth.acme.com. It replaces url. See Use a custom domain.
api_key LUMOAUTH_API_KEY none; sent as X-API-Key
user_subject_attribute LUMOAUTH_USER_SUBJECT_ATTRIBUTE lumoauth_sub; the user model attribute that holds the LumoAuth user ID
audience LUMOAUTH_AUDIENCE none; the identifier of your API, such as https://api.example.com. When it is set, lumoauth.auth and the lumoauth guard verify access tokens locally and accept only those whose aud names it.
client_id LUMOAUTH_CLIENT_ID none; the client ID of a confidential application whose allowed scopes include poppy:verify
client_secret LUMOAUTH_CLIENT_SECRET none; the client secret of that application
poppy.public_origin LUMOAUTH_POPPY_PUBLIC_ORIGIN none; the address that personal agents call, such as https://shop.example.com. The lumoauth.poppy middleware needs it.

Use a custom domain

An organization can serve LumoAuth on its own domain, for example https://auth.acme.com. Set the domain instead of LUMOAUTH_URL and LUMOAUTH_ORG_ID:

With a custom domain:

A value with a path, a query, a fragment or credentials throws LumoAuthConfigError when Laravel creates the client. If you published config/lumoauth.php before this option existed, the package still reads LUMOAUTH_CUSTOM_DOMAIN.

Use the client

Inject LumoAuth\LumoAuth anywhere that the container resolves classes. The container also binds it as lumoauth.

The SDK exposes its namespaces as properties, and a facade forwards only method calls. To reach a namespace through the facade, get the client first:

The configured client uses the organization API key. A permission check with that key is about the user who created the key. To check a signed-in user, pass the user's LumoAuth user ID as userId:. The API key needs the authz:check scope for this:

The LumoAuth user ID is a UUID: the sub claim of the user's LumoAuth tokens. Your app's own user ID does not work. Store the sub on the user model when the user signs in with LumoAuth, for example in a lumoauth_sub column. You can also call LumoAuth with the user's own access token:

Accept bearer tokens from LumoAuth

For an API, lumoauth.auth authenticates the request with a LumoAuth access token (Authorization: Bearer …, or Authorization: DPoP … with a DPoP proof for a DPoP-bound token). Set LUMOAUTH_AUDIENCE to your API's identifier, the resource that clients ask tokens for: the middleware then verifies each token locally, with no call to LumoAuth per request. It checks the signature against the organization's keys, which it keeps in Laravel's cache, and typ: at+jwt, the issuer, aud, the expiry, test tokens, and the DPoP proof of a bound token. Without LUMOAUTH_AUDIENCE LumoAuth checks the token through its userinfo endpoint, which also accepts tokens for another API.

Situation Response
No token 401 with WWW-Authenticate: Bearer realm="api"
The token is refused, or it is for another API (with audience set) 401 with WWW-Authenticate: Bearer realm="api", error="invalid_token", …
A DPoP-bound token without a valid proof, or sent as Bearer 401 with WWW-Authenticate: DPoP realm="api", error="invalid_token", …
LumoAuth, or its keys, cannot be reached 503 temporarily_unavailable; the cause is logged
The token is valid $request->user() is a LumoAuth\Laravel\Auth\LumoAuthUser and the request continues

LumoAuthUser has sub(), claims() and the attribute lumoauth_sub, which lumoauth.permission reads, so the two middlewares work together. The package also registers the guard lumoauth (auth:lumoauth, Auth::guard('lumoauth')) with the same check. Laravel's own auth middleware answers without the WWW-Authenticate header and may redirect to a login route, so prefer lumoauth.auth for an API.

With LUMOAUTH_AUDIENCE. Only JWT access tokens are accepted: set the access token format of the clients' application to JWT. LumoAuthUser::claims() are then the token's claims (sub, scope, client_id, …), not the profile from userinfo. The DPoP check uses $request->fullUrl(): behind a proxy, configure Laravel's trusted proxies so that it is the address that the client called. A token is not checked for revocation before it expires; introspect it ($lumo->auth->introspect()) where that matters.

Route middleware

The middleware requires every listed permission. It checks the signed-in user's LumoAuth user ID, and it never uses your app's own user ID. It reads that ID from the user model attribute that user_subject_attribute names, lumoauth_sub by default.

Situation Response
Nobody is signed in 401
The user has no LumoAuth user ID 403
LumoAuth does not know the ID (SUBJECT_NOT_FOUND) 403
A listed permission is missing 403
Every listed permission is granted The request continues

The configured API key needs the authz:check scope. Without it, the SDK throws LumoAuthPermissionDeniedError, which Laravel reports as a server error. Treat that as a configuration error.

When the ID lives somewhere else, set a resolver in a service provider's boot() method:

Verify requests from personal agents

A personal agent is an AI assistant that acts for one person, and it sends a Poppy-Session header to your API, as the Personal Agent Protocol defines. The lumoauth.poppy middleware asks LumoAuth to verify that header before the route runs. The route then gets the personal agent, the user, the Session and the account of the request.

The package authenticates these calls as one of your organization's confidential applications. The application needs the poppy:verify scope among its allowed scopes. Set its credentials and the public origin of your API:

If you published config/lumoauth.php before this feature, the package still reads these variables. Publish the file again to see the new keys.

Parameters. Every middleware parameter is a scope that the operation needs. Two parameters have another meaning: resource=<identifier> and allow_replay. Separate parameters with commas. RequirePoppySession::using() builds the same string from named arguments:

Situation What happens
LumoAuth verifies the request The route runs. RequirePoppySession::verification($request) returns the PoppyVerification. The result is also in the request attribute lumoauth.poppy.
LumoAuth rejects the request The route does not run. The personal agent gets the response that LumoAuth gave: its status, every header and its body.
The SDK throws an error The route does not run, and nothing is relayed. The personal agent gets 503 temporarily_unavailable with Cache-Control: no-store, and the cause is logged as a warning in the application log. This happens when LumoAuth cannot be reached, when the protocol is switched off for the organization (404), and when LumoAuth rejects your own application with 401, 403 or 429.
poppy.public_origin is missing or malformed The middleware throws LumoAuthConfigError when Laravel creates it, and Laravel answers 500

To verify a request yourself, call the core SDK and relay a rejection with PoppyRefusalResponse:

The core SDK also looks up and ends Sessions: $lumo->poppy->getSessionStatus() and $lumo->poppy->endSession(). See the full guide and the LumoAuth documentation: Session verification.

Upgrading from 1.0.x

The lumoauth.permission middleware now checks the user's LumoAuth user ID. Version 1.0.x sent your app's own user ID (getAuthIdentifier()) as userId:. LumoAuth does not know that ID. The check then failed with SUBJECT_NOT_FOUND, or it asked about a different subject.

What changed:

A user passes the middleware only after your app has stored the user's LumoAuth user ID. To upgrade, add a column, and store the sub claim when the user signs in.

1. Add the column.

2. Store the sub claim in the sign-in callback. The example uses the SDK's authorization code flow with PKCE. It reads sub from the userinfo response. Put your OAuth client's ID and secret in config/services.php under lumoauth.

Existing users get their LumoAuth user ID on their next sign-in. Until then, the middleware answers 403 for them.

More

Licence

MIT


All versions of laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^11.0 || ^12.0
illuminate/http Version ^11.0 || ^12.0
illuminate/support Version ^11.0 || ^12.0
lumoauth/lumoauth Version ^1.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 lumoauth/laravel contains the following files

Loading the files please wait ...