Oauth2Controller
extends AppController
in package
OAuth2 Controller
OAuth2認証エンドポイントを提供(認証不要なエンドポイントのみ)
Table of Contents
Properties
- $Authentication : AuthenticationComponent
- $BcMessage : BcMessageComponent
- $_View : View
- View
- $clientRegistrationService : OAuth2ClientRegistrationService|null
- OAuth2クライアント登録サービス
- $oauth2ConfigError : OAuth2ConfigurationException|null
- OAuth2 の設定不備
- $oauth2Service : OAuth2Service|null
- OAuth2サービス
Methods
- __construct() : void|ResponseInterface
- AppController constructor.
- _blackHoleCallback() : void
- Securityコンポーネントのブラックホールからのコールバック
- ajaxError() : void
- Ajax用のエラーを出力する
- authorizationServerMetadata() : Response
- OAuth 2.0 認可サーバーメタデータエンドポイント (RFC 8414)
- beforeFilter() : void
- リクエスト処理前に設定不備を確認する
- beforeRender() : Response|void|null
- Before render
- clientConfiguration() : Response
- クライアント設定エンドポイント (RFC 7591) GET /bc-mcp/oauth2/register/{client_id} PUT /bc-mcp/oauth2/register/{client_id} DELETE /bc-mcp/oauth2/register/{client_id}
- clientInfo() : Response
- クライアント情報取得エンドポイント
- dispatchLayerEvent() : bool|Event
- イベントを発火
- getService() : array<string|int, mixed>|mixed|object
- Get Service
- hasService() : bool
- Has Service
- initialize() : void
- 初期化
- jwks() : Response
- JWKSエンドポイント
- notFound() : void
- NOT FOUNDページを出力する
- options() : Response
- OPTIONSリクエスト対応(CORS対応)
- protectedResourceMetadata() : Response
- OAuth 2.0 保護リソースメタデータエンドポイント (RFC 9728)
- redirectIfIsRequireMaintenance() : Response|void|null
- メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
- register() : Response
- 動的クライアント登録エンドポイント (RFC 7591) POST /bc-mcp/oauth2/register
- requirePermission() : bool
- パーミッションが必要かどうかを確認する
- setTitle() : void
- Set Title
- setupFrontView() : void
- フロント用のViewクラスをセットアップする
- token() : Response
- トークン発行エンドポイント
- verify() : Response
- トークン検証エンドポイント
- loadViewConditions() : void
- 画面の情報をセッションから読み込む
- restrictNonPublicAccess() : void
- 未認証ユーザーによる非公開データへのアクセスを制限する
- saveDblog() : EntityInterface
- データベースログを記録する
- saveViewConditions() : void
- 画面の情報をセッションに保存する
- setViewConditions() : void
- 画面の情報をセットする
Properties
$Authentication
public
AuthenticationComponent
$Authentication
$BcMessage
public
BcMessageComponent
$BcMessage
$_View
View
protected
View
$_View
$clientRegistrationService
OAuth2クライアント登録サービス
private
OAuth2ClientRegistrationService|null
$clientRegistrationService
= null
$oauth2ConfigError
OAuth2 の設定不備
private
OAuth2ConfigurationException|null
$oauth2ConfigError
= null
$oauth2Service
OAuth2サービス
private
OAuth2Service|null
$oauth2Service
= null
Methods
__construct()
AppController constructor.
public
__construct([ServerRequest|null $request = null ][, Response|null $response = null ][, string|null $name = null ][, EventManagerInterface|null $eventManager = null ][, ComponentRegistry|null $components = null ]) : void|ResponseInterface
Parameters
- $request : ServerRequest|null = null
- $response : Response|null = null
- $name : string|null = null
- $eventManager : EventManagerInterface|null = null
- $components : ComponentRegistry|null = null
Tags
Return values
void|ResponseInterface_blackHoleCallback()
Securityコンポーネントのブラックホールからのコールバック
public
_blackHoleCallback(string $err, mixed $exception) : void
フォーム改ざん対策・CSRF対策・SSL制限・HTTPメソッド制限などへの違反が原因で Securityコンポーネントに"ブラックホールされた"場合の動作を指定する
Parameters
- $err : string
-
エラーの種類
- $exception : mixed
Tags
ajaxError()
Ajax用のエラーを出力する
public
ajaxError([int $errorNo = 500 ][, mixed $message = '' ]) : void
since 5.0.5 このメソッドは非推奨です。
Parameters
- $errorNo : int = 500
-
エラーのステータスコード
- $message : mixed = ''
-
エラーメッセージ
Tags
authorizationServerMetadata()
OAuth 2.0 認可サーバーメタデータエンドポイント (RFC 8414)
public
authorizationServerMetadata() : Response
Return values
ResponsebeforeFilter()
リクエスト処理前に設定不備を確認する
public
beforeFilter(EventInterface $event) : void
Parameters
- $event : EventInterface
-
イベント
beforeRender()
Before render
public
beforeRender(EventInterface $event) : Response|void|null
Parameters
- $event : EventInterface
Tags
Return values
Response|void|nullclientConfiguration()
クライアント設定エンドポイント (RFC 7591) GET /bc-mcp/oauth2/register/{client_id} PUT /bc-mcp/oauth2/register/{client_id} DELETE /bc-mcp/oauth2/register/{client_id}
public
clientConfiguration(string $clientId) : Response
Parameters
- $clientId : string
-
クライアントID
Return values
ResponseclientInfo()
クライアント情報取得エンドポイント
public
clientInfo() : Response
Return values
ResponsedispatchLayerEvent()
イベントを発火
public
dispatchLayerEvent(string $name[, array<string|int, mixed> $data = [] ][, mixed $options = [] ]) : bool|Event
Parameters
- $name : string
- $data : array<string|int, mixed> = []
- $options : mixed = []
Tags
Return values
bool|EventgetService()
Get Service
public
getService(mixed $service) : array<string|int, mixed>|mixed|object
Parameters
- $service : mixed
Tags
Return values
array<string|int, mixed>|mixed|objecthasService()
Has Service
public
hasService(mixed $service) : bool
Parameters
- $service : mixed
Tags
Return values
boolinitialize()
初期化
public
initialize() : void
jwks()
JWKSエンドポイント
public
jwks() : Response
Return values
ResponsenotFound()
NOT FOUNDページを出力する
public
notFound() : void
Tags
options()
OPTIONSリクエスト対応(CORS対応)
public
options() : Response
Return values
ResponseprotectedResourceMetadata()
OAuth 2.0 保護リソースメタデータエンドポイント (RFC 9728)
public
protectedResourceMetadata() : Response
Return values
ResponseredirectIfIsRequireMaintenance()
メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
public
redirectIfIsRequireMaintenance() : Response|void|null
Tags
Return values
Response|void|nullregister()
動的クライアント登録エンドポイント (RFC 7591) POST /bc-mcp/oauth2/register
public
register() : Response
Return values
ResponserequirePermission()
パーミッションが必要かどうかを確認する
public
requirePermission(ServerRequest $request) : bool
デフォルトは true であるが、設定ファイルで明示的に false に 設定されている場合は false となる。
Parameters
- $request : ServerRequest
Return values
boolsetTitle()
Set Title
public
setTitle(string $title) : void
Parameters
- $title : string
Tags
setupFrontView()
フロント用のViewクラスをセットアップする
public
setupFrontView() : void
Tags
token()
トークン発行エンドポイント
public
token() : Response
Return values
Responseverify()
トークン検証エンドポイント
public
verify() : Response
Return values
ResponseloadViewConditions()
画面の情報をセッションから読み込む
protected
loadViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed>|string $options = [] ]) : void
初期値が設定されている場合は初期値を設定した上で、セッションで上書きし、 ServerRequestに設定する。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed>|string = []
-
オプション
default: 読み出す初期値(初期値:[])group: 保存するグループ名(初期値:'')post: POSTデータを保存するかどうか(初期値:true)get: GETデータを保存するかどうか(初期値:false)
Tags
restrictNonPublicAccess()
未認証ユーザーによる非公開データへのアクセスを制限する
protected
restrictNonPublicAccess() : void
未認証ユーザーが preview / status を利用して非公開データを閲覧することを防ぐ。 デフォルト(フロント・管理画面)では、未認証時にこれらのパラメータを除去し、 公開データのみに強制する。認証済み(正規のプレビュー機能を含む)はそのまま許可する。 API では BcApiController でオーバーライドし、preview を拒否(Forbidden)する。
Tags
saveDblog()
データベースログを記録する
protected
saveDblog(string $message) : EntityInterface
Parameters
- $message : string
Tags
Return values
EntityInterfacesaveViewConditions()
画面の情報をセッションに保存する
protected
saveViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
次のセッション名に保存。
- POSTデータ: BcApp.viewConditions.{$contentsName}.data.{$model}
- クエリパラメーター: BcApp.viewConditions.{$contentsName}.query
$contentsNameは次の形式となる。 {$controllerName}{$actionName}.{$group}
ただし、ページネーションにおいて、1ページ目はクエリパラメーターpage を付けない仕様となっているため
page は保存しない。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
-
オプション
group: 保存するグループ名(初期値:'')post: POSTデータを保存するかどうか(初期値:true)get: GETデータを保存するかどうか(初期値:false)
Tags
setViewConditions()
画面の情報をセットする
protected
setViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
POSTデータとクエリパラメーターをセッションに保存した上で、 指定されたデフォルト値も含めて ServerRequest に設定する。
$this->setViewConditions(['Content'], [
'group' => 'index',
'default' => [
'query' => ['limit' => 10],
'data' => ['title' => 'default']
],
'get' => true
]);
Parameters
- $targetModel : array<string|int, mixed> = []
-
ターゲットとなるモデル
- $options : array<string|int, mixed> = []
-
オプション
default: 読み出す初期値(初期値:[])group: 保存するグループ名(初期値:'')post: POSTデータを保存するかどうか(初期値:true)get: GETデータを保存するかどうか(初期値:false)