hypervel / passport
The Hypervel Passport OAuth2 server package.
0.4.x-dev
2026-10-19 05:16 UTC
Requires
- php: ^8.4
- ext-openssl: *
- defuse/php-encryption: ^2.4
- firebase/php-jwt: ^7.0
- guzzlehttp/psr7: ^3.1
- hypervel/auth: ^0.4
- hypervel/cache: ^0.4
- hypervel/collections: ^0.4
- hypervel/config: ^0.4
- hypervel/console: ^0.4
- hypervel/container: ^0.4
- hypervel/context: ^0.4
- hypervel/contracts: ^0.4
- hypervel/cookie: ^0.4
- hypervel/core: ^0.4
- hypervel/database: ^0.4
- hypervel/encryption: ^0.4
- hypervel/events: ^0.4
- hypervel/filesystem: ^0.4
- hypervel/foundation: ^0.4
- hypervel/http: ^0.4
- hypervel/macroable: ^0.4
- hypervel/rate-limiter: ^0.4
- hypervel/routing: ^0.4
- hypervel/session: ^0.4
- hypervel/support: ^0.4
- lcobucci/jwt: ^5.6
- league/oauth2-server: ^9.4
- nesbot/carbon: ^3.13.1
- nyholm/psr7: ^1.0
- psr/clock: ^1.0
- psr/http-message: ^2.0
- symfony/console: ^8.1.2
- symfony/http-foundation: ^8.1
- symfony/psr-http-message-bridge: ^8.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-27 07:31:06 UTC
README
Documentation: https://hypervel.org/docs/passport
Differences From Laravel
- Implicit and password grants are omitted in line with the OAuth security best current practice: they expose tokens in authorization responses or require applications to collect users' passwords. Use authorization code with PKCE or the device grant. PKCE requires
S256so the authorization request does not expose the verifier. - Deprecated JSON API routes, their controllers and validation rules, and
TokenRepositoryare omitted. Define application-owned management routes usingClientRepository::create*Client(),$user->oauthApps()and$user->tokens(). ClientRepository::findForUser(),forUser(),update()anddelete()are omitted. Use$user->oauthApps(), update client models directly, and revoke clients withClient::revoke().HasApiTokens::clients()is replaced byoauthApps(), andClient::user()byowner(). DeprecatedClient::authCodes(),Token::user()andAuthCode::client()relations are omitted. UsePassport::defaultScopes()instead ofsetDefaultScope().- Pre-13 client schemas,
Passport::$clientUuidsandpassport:hashare omitted. Clients use UUIDs,redirect_urisandgrant_types; migrate legacy data before importing it. - Hypervel ships a
passportguard.actingAs()andactingAsClient()default to it, and personal access clients without a provider use its provider. The API cookie is namedhypervel_token;POST /oauth/token,POST /oauth/device/codeandGET /oauth/device/authorizeuse the namedpassportrate limiter. - Tokens record their user provider. Only a guard of that provider can authenticate the user, and a client's configured provider restricts who can authorize it. Use Hypervel's migrations.
- Import Laravel data into Hypervel's schema using its migrations; adding a few columns to Laravel's schema is insufficient. Clients have a
third_partyflag so externally registered clients cannot gain first-party trust merely by having no owner. Classify imported external clients accordingly; see consent. - Access tokens require a separate
client_idclaim;audidentifies their intended resources, or the client when resources are absent.client_idandcnfare reserved claims. Reissue Laravel access tokens, including personal access tokens, and update custom issuers/consumers; see resource indicators. HasApiTokens::getProviderName()requires an unambiguous provider. If multiple configured providers use the model, override it to select the intended provider rather than relying on configuration order.- Remembered approval lives in
oauth_consents, independently of access-token expiry.forget()expires approval; instancerevoke()/delete()revokes linked credentials and deletes the approval. See remembering consent. - Consent forms submit to POST/DELETE
/oauth/authorize/consent, retaining the upstream route names. Submitauth_tokenand CSRF protection; Passport retains the protocol parameters. POST/oauth/authorizeaccepts protocol form requests. Server-side sessions and shared session locks are required for concurrent-tab and replay guarantees. See authorization. prompt=loginrequires confirmation instead of logout; providepassword.confirmor bindReauthenticationResponse.prompt=nonecannot be combined with another prompt, andprompt=consentalso applies to trusted clients. Account selection requires explicitaccountSelectionView()registration. See authorization interactions.- Protected
hasGrantedScopes()gains an optional fourth permissions argument and is only a pre-check. OverrideConsent::covers()for remembered coverage orClient::skipsAuthorization()for trusted approval. Synchronous authorization events support additional policy and attributes; see authorization attributes. - Client secrets use SHA-256: generated secrets already have high entropy, so bcrypt adds CPU cost without useful protection against guessing. Regenerate Laravel's hashed client secrets when porting. Authorization codes and refresh tokens use a key derived from the app key, avoiding password stretching on every encryption and decryption. Laravel-issued codes and refresh tokens must be reissued.
encryptTokensUsing()must return random key material that remains constant for the worker lifetime. - Refresh-token reuse revokes the grant. Clients must not refresh concurrently with the same token. Rotation can only be disabled for confidential clients or public clients using DPoP-bound refresh tokens. See proof-bound tokens.
- Authorization-code reuse revokes its issued access token and refresh family after client, callback, PKCE and proof validation. Codes retain those links until expiry; refresh rows remain while their access tokens are live. Exchange each code once; if the exchange outcome is unknown, start a new authorization.
- File and environment signing keys are loaded once per worker. Changes require a full restart of processes that issue or verify tokens. The optional database key store supports rotation without restarts.
- Token redemption cannot run inside an application database transaction. Token, consent, authorization-code, device-code, refresh-token, refresh-token-family, pushed-authorization-request and database signing-key models must share a connection; the client model may use another connection.
- Token events dispatch after issuance commits. Subsequent listener or cache invalidation failures are reported without withholding the issued tokens. Laravel dispatches token events immediately after saving each record, and listener exceptions fail the request.
- Token responses report the final granted
scope, including partial consent. Custom League response types remain supported; subclasses ofBridge\BearerTokenResponseshould merge the parent's extra parameters. See token responses. - Guards read the coroutine's request;
TokenGuard::setRequest()is omitted. UseRequestContext::set()orvalidate(['request' => $request]). Guard constructors and protected request helpers differ, as doCreateFreshApiToken's protected methods, which receive the guard explicitly.PassportServiceProvider::makeGuard()takes$namebefore$config. ApiTokenCookieFactorytakesConfig,ServerFactory,AuthManagerandContainerinstead ofConfigandEncrypter, so it uses the derived cookie key and resolves auth/request state per call. Its protectedcreateToken()takes a required nullable provider after the expiration argument; update subclass overrides to carry that provider without falling back to another one. Existing two-argumentmake()calls still work, and an optional third argument selects the guard.- Server-building extension methods live on
ServerFactory, which selects the current request's settings while reusing configured servers and parsed keys across requests. Controllers, guards, middleware and personal access token factories resolve their current servers through it, so long-lived consumers follow settings changes and key rotation. Authorization controllers takeAuthManagerand resolve the approving guard per request. Custom controllers usingRetrievesAuthRequestFromSessionorRetrievesDeviceCodeFromSessionalso needResolvesApprovingGuardand the services used by their traits:$auth,$config,$clients,$pending, and$authorizationsor$deviceCodesrespectively. Existing approve/deny and retrieval method signatures are retained; constructors inject the new services. Bridge\ClientRepositoryno longer takes a hasher.HandlesOAuthErrors::withErrorHandling()and theOAuthServerExceptionconstructor no longer take the implicit grant's fragment argument.- Token and client relations return
TokenRelationandClientRelation, subclasses of their upstream relation types.personalAccessClient()filters grant types in SQL; override that repository method if a custom model stores grant types differently.
See the Passport porting guide for migration guidance.
Ported from: https://github.com/laravel/passport