MCP PHP SDK

FileCredentialStorage implements PendingAuthorizationStorageInterface

FinalYes

Persists credentials unencrypted in a JSON file with the mode 0600, in a directory with the mode 0700.

Tags
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Interfaces

PendingAuthorizationStorageInterface
Storage must be scoped to the user session that initiated authorization.

Properties

$path  : string

Methods

__construct()  : mixed
consumePendingAuthorization()  : PendingAuthorization|null
Atomically retrieve and remove a pending authorization, including expired entries.
forget()  : void
Drop everything held for one authorization server, or the whole store when null.
getClientRegistration()  : ClientRegistration|null
getToken()  : AccessToken|null
saveClientRegistration()  : void
savePendingAuthorization()  : void
saveToken()  : void
synchronize()  : T
Run an operation while no other process sharing this storage runs one.
read()  : array{registrations: array>, tokens: array>>, pending: array>}
underLock()  : T
update()  : void
Applies a change under an exclusive lock, so another process can't overwrite it.
write()  : void

Properties

Methods

forget()

Drop everything held for one authorization server, or the whole store when null.

public forget([string|null $issuer = null ]) : void
Parameters
$issuer : string|null = null

getToken()

public getToken(string $issuer, string $resource) : AccessToken|null
Parameters
$issuer : string

the authorization server's issuer identifier

$resource : string

the canonical URI of the protected resource the token may be sent to, followed by #, the grant and, for a configured client, its client ID

Return values
AccessToken|null

synchronize()

Run an operation while no other process sharing this storage runs one.

public synchronize(callable $operation) : T
Parameters
$operation : callable
Return values
T

read()

private read() : array{registrations: array>, tokens: array>>, pending: array>}
Return values
array{registrations: array>, tokens: array>>, pending: array>}

underLock()

private underLock(string $suffix, callable(): T $operation) : T
Parameters
$suffix : string
$operation : callable(): T
Return values
T

update()

Applies a change under an exclusive lock, so another process can't overwrite it.

private update(callable(array{registrations: array>, tokens: array>>, pending: array>}): array{registrations: array>, tokens: array>>, pending: array>} $change) : void
Parameters
$change : callable(array{registrations: array>, tokens: array>>, pending: array>}): array{registrations: array>, tokens: array>>, pending: array>}

write()

private write(array{registrations: array>, tokens: array>>, pending: array>} $data) : void
Parameters
$data : array{registrations: array>, tokens: array>>, pending: array>}
On this page

Search results