Download the PHP package visin/laravel-entra-auth without Composer
On this page you can find all versions of the php package visin/laravel-entra-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-entra-auth
laravel-entra-auth
Microsoft Entra ID client-credentials auth for Laravel services — both halves in one tested implementation, so every service authenticates the same way:
- Resource server: validate incoming Entra JWTs — signature via tenant
JWKS, expiry, audience (both
api://<guid>and bare guid forms), tenant pinning, issuer, and app roles. Discovery and JWKS responses are cached, and tokens with unknown key ids trigger a throttled JWKS refresh for Entra key rotation. - Client: acquire app-only tokens with the client credentials flow, cached per scope until shortly before expiry.
Installation
The service provider is auto-discovered. Publish the config to override defaults:
Configuration
The protected API's app registration must issue v2 access tokens
("api": { "requestedAccessTokenVersion": 2 } in the app manifest).
Protecting routes
entra.auth validates the bearer token; entra.role:<role> requires an app
role from the token's roles claim:
The validated token is available on the request:
Services with their own caller mapping (client registries, audit logging) can skip the middleware and use the validator directly:
To restrict which roles are passed through, set allowed_roles in
config/entra-auth.php.
Calling another Entra-protected API
Pass a scope to target a different API: ->token('api://other-api/.default').
Testing your app
Bind a fake validator instead of faking HTTP:
Requirements
PHP 8.3+ · Laravel 12 or 13 · firebase/php-jwt 6.10+ or 7.x
License
MIT — see LICENSE.md. Contributions welcome, see CONTRIBUTING.md.
All versions of laravel-entra-auth with dependencies
ext-json Version *
ext-openssl Version *
firebase/php-jwt Version ^6.10|^7.0
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0