baserCMS クラスリファレンス

OAuth2ClientRegistrationService
in package

OAuth2 動的クライアント登録サービス RFC7591 OAuth 2.0 Dynamic Client Registration Protocol の実装

Table of Contents

Properties

$clientRepository  : OAuth2ClientRepository
OAuth2クライアントリポジトリ
$registrationTokenMap  : array<string, string>
In-memory map of registration access tokens for the current PHP process [client_id => registration_access_token]
$supportedAuthMethods  : array<string|int, mixed>
サポートされるトークンエンドポイント認証方法
$supportedGrantTypes  : array<string|int, mixed>
サポートされるグラントタイプ
$supportedResponseTypes  : array<string|int, mixed>
サポートされるレスポンスタイプ
$supportedScopes  : array<string|int, mixed>
サポートされるスコープ

Methods

__construct()  : mixed
コンストラクタ
deleteClient()  : bool
クライアントの削除
getClient()  : Oauth2Client|null
クライアント情報の取得
registerClient()  : Oauth2Client
動的クライアント登録
updateClient()  : Oauth2Client|null
クライアント情報の更新
generateClientId()  : string
クライアントIDを生成
generateRegistrationAccessToken()  : string
登録アクセストークンを生成
parseScopes()  : array<string|int, mixed>
スコープ文字列を配列に変換
validateRegistrationRequest()  : void
登録リクエストの検証

Properties

$registrationTokenMap

In-memory map of registration access tokens for the current PHP process [client_id => registration_access_token]

private static array<string, string> $registrationTokenMap = []

DB に registration_access_token カラムが存在しない / 未保存な環境でも テストを通すためのフォールバック。DBに値があれば常にDBを優先する。 本番運用ではDB保存が前提のため、将来的に削除可能。

$supportedAuthMethods

サポートされるトークンエンドポイント認証方法

private array<string|int, mixed> $supportedAuthMethods = ['none']

動的クライアント登録が無認証で開いているため、誰でも機密クライアントを 作れる状態を避け、PKCE 必須のパブリッククライアントに一本化する。 認可サーバーメタデータの宣言(none のみ)とも一致させる。

$supportedGrantTypes

サポートされるグラントタイプ

private array<string|int, mixed> $supportedGrantTypes = ['authorization_code', 'refresh_token']

MCP はユーザーの同意を前提とするため、ユーザー不在でトークンを 発行できる client_credentials は受け付けない。

$supportedResponseTypes

サポートされるレスポンスタイプ

private array<string|int, mixed> $supportedResponseTypes = ['code']

$supportedScopes

サポートされるスコープ

private array<string|int, mixed> $supportedScopes = ['mcp:read', 'mcp:write']

OAuth2ScopeRepository に実体があるものだけを列挙する。

Methods

deleteClient()

クライアントの削除

public deleteClient(string $clientId, string $registrationAccessToken) : bool
Parameters
$clientId : string
$registrationAccessToken : string
Return values
bool

registerClient()

動的クライアント登録

public registerClient(array<string|int, mixed> $requestData, string $baseUrl) : Oauth2Client
Parameters
$requestData : array<string|int, mixed>

リクエストデータ

$baseUrl : string

ベースURL

Tags
throws
Exception
Return values
Oauth2Client

updateClient()

クライアント情報の更新

public updateClient(string $clientId, string $registrationAccessToken, array<string|int, mixed> $requestData) : Oauth2Client|null
Parameters
$clientId : string
$registrationAccessToken : string
$requestData : array<string|int, mixed>
Tags
throws
Exception
Return values
Oauth2Client|null

generateClientId()

クライアントIDを生成

private generateClientId() : string
Tags
throws
RandomException
Return values
string

generateRegistrationAccessToken()

登録アクセストークンを生成

private generateRegistrationAccessToken() : string
Tags
throws
RandomException
Return values
string

parseScopes()

スコープ文字列を配列に変換

private parseScopes(string $scopeString) : array<string|int, mixed>
Parameters
$scopeString : string
Return values
array<string|int, mixed>

validateRegistrationRequest()

登録リクエストの検証

private validateRegistrationRequest(array<string|int, mixed> $requestData) : void
Parameters
$requestData : array<string|int, mixed>
Tags
throws
Exception
On this page

Search results