class ServerFactory

Constants

RESOURCE_SERVER_CONTEXT_KEY

protected BEARER_CONTEXT_KEY

Properties

protected ServerEntry|null $defaultEntry
protected ServerEntry> $entries
protected int $nextKeyRefresh
protected list<string> $storedKeyIds
protected Key|null $encryptionKey
protected string|null $cookieSigningKey
protected int $hashSeed

Methods

__construct(Container $app, Repository $config, Encrypter $encrypter, BearerRequestFactory $bearerRequests)

Create the worker's server and key cache.

authorizationServer()

Get the authorization server for the current settings and signing key.

personalAccessServer()

Get the personal access server for the current settings and signing key.

settings()

Get the current server settings, pinned during an issuance.

signingKey(DateInterval $lifetime)

Get the signing key and retain it for the supplied token lifetime.

array
jwks()

Get the public JSON Web Key Set for the current settings.

string
cookieKey()

Get the app-wide cookie signing key.

string
decryptToken(string $token)

Decrypt a grant credential with the same key used during issuance.

void
initializeEncryptionKeys()

Derive separate keys for grant encryption and API cookies once per worker.

makeAuthCodeGrant(ServerSettings $settings)

Create and configure an instance of the Auth Code grant.

buildAuthCodeGrant(ServerSettings $settings)

Build the Auth Code grant instance.

makeRefreshTokenGrant(ServerSettings $settings)

Create and configure a Refresh Token grant instance.

makeDeviceCodeGrant(ServerSettings $settings)

Create and configure an instance of the Device Code grant.

makeAuthorizationServer(SigningCryptKey $key, ResponseTypeInterface|null $responseType = null, bool $personalAccess = false)

Make the authorization service instance.

ResourceServer
resourceServer()

Get the resource server for the current verification keys.

tokenValidator()

Get the token verifier shared by resource requests and credential management.

ServerRequestInterface
validateAuthenticatedRequest(Request $request, bool $cache = true)

Share bearer validation across the current request's guards and middleware.

OAuthServerException|null
authenticationError(Request $request)

Get an already verified authentication failure without validating the credential again.

string
authenticationFingerprint(Request $request)

Identify the request inputs shared by authentication caches.

entry()

Get the current settings entry without changing a pinned issuance.

defaultEntry()

Load default keys once, or refresh database keys at the configured interval.

array
fileKeys()

Get the configured file or PEM keys, including retained verification keys.

makeEntry(ServerSettings $settings)

Build a worker-owned entry with validated, parsed key material.

CryptKey
makeCryptKey(string $type, ServerKey $key)

Create a CryptKey instance.

Details

at line 70
__construct(Container $app, Repository $config, Encrypter $encrypter, BearerRequestFactory $bearerRequests)

Create the worker's server and key cache.

Parameters

Container $app
Repository $config
Encrypter $encrypter
BearerRequestFactory $bearerRequests

at line 82
AuthorizationServer authorizationServer()

Get the authorization server for the current settings and signing key.

Return Value

AuthorizationServer

at line 110
AuthorizationServer personalAccessServer()

Get the personal access server for the current settings and signing key.

Return Value

AuthorizationServer

at line 128
ServerSettings settings()

Get the current server settings, pinned during an issuance.

Return Value

ServerSettings

at line 136
SigningCryptKey signingKey(DateInterval $lifetime)

Get the signing key and retain it for the supplied token lifetime.

Parameters

DateInterval $lifetime

Return Value

SigningCryptKey

at line 154
array jwks()

Get the public JSON Web Key Set for the current settings.

Return Value

array

at line 162
string cookieKey()

Get the app-wide cookie signing key.

Return Value

string

at line 174
string decryptToken(string $token)

internal  shared with token management; callers validate the payload's credential type
 

Decrypt a grant credential with the same key used during issuance.

Parameters

string $token

Return Value

string

at line 184
protected void initializeEncryptionKeys()

Derive separate keys for grant encryption and API cookies once per worker.

Return Value

void

at line 202
protected AuthCodeGrant makeAuthCodeGrant(ServerSettings $settings)

Create and configure an instance of the Auth Code grant.

Parameters

ServerSettings $settings

Return Value

AuthCodeGrant

at line 212
protected AuthCodeGrant buildAuthCodeGrant(ServerSettings $settings)

Build the Auth Code grant instance.

Parameters

ServerSettings $settings

Return Value

AuthCodeGrant

at line 224
protected RefreshTokenGrant makeRefreshTokenGrant(ServerSettings $settings)

Create and configure a Refresh Token grant instance.

Parameters

ServerSettings $settings

Return Value

RefreshTokenGrant

at line 236
protected DeviceCodeGrant makeDeviceCodeGrant(ServerSettings $settings)

Create and configure an instance of the Device Code grant.

Parameters

ServerSettings $settings

Return Value

DeviceCodeGrant

at line 254
protected AuthorizationServer makeAuthorizationServer(SigningCryptKey $key, ResponseTypeInterface|null $responseType = null, bool $personalAccess = false)

Make the authorization service instance.

Parameters

SigningCryptKey $key
ResponseTypeInterface|null $responseType
bool $personalAccess

Return Value

AuthorizationServer

at line 276
ResourceServer resourceServer()

Get the resource server for the current verification keys.

Return Value

ResourceServer

at line 308
BearerTokenValidator tokenValidator()

internal  does not perform request-specific proof or authorization checks
 

Get the token verifier shared by resource requests and credential management.

Return Value

BearerTokenValidator

at line 321
ServerRequestInterface validateAuthenticatedRequest(Request $request, bool $cache = true)

Share bearer validation across the current request's guards and middleware.

Parameters

Request $request
bool $cache

Return Value

ServerRequestInterface

at line 361
OAuthServerException|null authenticationError(Request $request)

internal  used when rendering a resource authentication challenge
 

Get an already verified authentication failure without validating the credential again.

Parameters

Request $request

Return Value

OAuthServerException|null

at line 379
string authenticationFingerprint(Request $request)

internal  used by the guard and resource-server request cache
 

Identify the request inputs shared by authentication caches.

Parameters

Request $request

Return Value

string

at line 397
ServerEntry entry()

internal  shared with the issuance context
 

Get the current settings entry without changing a pinned issuance.

Return Value

ServerEntry

at line 427
protected ServerEntry defaultEntry()

Load default keys once, or refresh database keys at the configured interval.

Return Value

ServerEntry

at line 487
array fileKeys()

internal  shared with the signing-key repository for file imports
 

Get the configured file or PEM keys, including retained verification keys.

Return Value

array

at line 512
protected ServerEntry makeEntry(ServerSettings $settings)

Build a worker-owned entry with validated, parsed key material.

Parameters

ServerSettings $settings

Return Value

ServerEntry

at line 549
protected CryptKey makeCryptKey(string $type, ServerKey $key)

Create a CryptKey instance.

Parameters

string $type
ServerKey $key

Return Value

CryptKey