JwksController
extends BcApiController
in package
Class JwksController
Table of Contents
- $Authentication : AuthenticationComponent
- $Authentication : AuthenticationComponent
- $BcMessage : BcMessageComponent
- $Paginator : PaginatorComponent
- $Security : SecurityComponent
- $_View : View
- View
- __construct() : mixed
- BcAppController constructor.
- _blackHoleCallback() : void
- Securityコンポーネントのブラックホールからのコールバック
- beforeFilter() : Response|void
- Before Filter
- beforeRender() : Response|void|null
- Before render
- dispatchLayerEvent() : bool|Event
- イベントを発火
- getAccessToken() : array<string|int, mixed>
- トークンを取得する
- getService() : array<string|int, mixed>|mixed|object
- Get Service
- hasService() : bool
- Has Service
- index() : mixed
- トークンを検証する(RS256のみ)
- initialize() : void
- Initialize
- isAdminApiEnabled() : bool
- 認証が必要なAPIを利用可能かどうか判定
- isAvailableUser() : bool
- ログインユーザーが有効か判定する
- notFound() : void
- NOT FOUNDページを出力する
- redirectIfIsRequireMaintenance() : Response|void|null
- メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
- setTitle() : void
- Set Title
- setupFrontView() : void
- フロント用のViewクラスをセットアップする
- _autoConvertEncodingByArray() : array<string|int, mixed>
- 配列の文字コードを変換する
- loadViewConditions() : void
- 画面の情報をセッションから読み込む
- saveViewConditions() : void
- 画面の情報をセッションに保存する
- setViewConditions() : void
- 画面の情報をセットする
- __cleanupQueryParams() : void
- クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
- __convertEncodingHttpInput() : void
- http経由で送信されたデータを変換する とりあえず、UTF-8で固定
- checkPermission() : bool
- アクセスルールの権限を確認する
Properties
$Authentication
public
AuthenticationComponent
$Authentication
$Authentication
public
AuthenticationComponent
$Authentication
$BcMessage
public
BcMessageComponent
$BcMessage
$Paginator
public
PaginatorComponent
$Paginator
$Security
public
SecurityComponent
$Security
$_View
View
protected
View
$_View
Methods
__construct()
BcAppController constructor.
public
__construct([ServerRequest|null $request = null ][, Response|null $response = null ][, string|null $name = null ][, EventManagerInterface|null $eventManager = null ][, ComponentRegistry|null $components = null ]) : mixed
Parameters
- $request : ServerRequest|null = null
- $response : Response|null = null
- $name : string|null = null
- $eventManager : EventManagerInterface|null = null
- $components : ComponentRegistry|null = null
Tags
Return values
mixed —_blackHoleCallback()
Securityコンポーネントのブラックホールからのコールバック
public
_blackHoleCallback(string $err, mixed $exception) : void
フォーム改ざん対策・CSRF対策・SSL制限・HTTPメソッド制限などへの違反が原因で Securityコンポーネントに"ブラックホールされた"場合の動作を指定する
Parameters
- $err : string
-
エラーの種類
- $exception : mixed
Tags
Return values
void —beforeFilter()
Before Filter
public
beforeFilter(EventInterface $event) : Response|void
Parameters
- $event : EventInterface
Tags
Return values
Response|void —beforeRender()
Before render
public
beforeRender(EventInterface $event) : Response|void|null
Parameters
- $event : EventInterface
Tags
Return values
Response|void|null —dispatchLayerEvent()
イベントを発火
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|Event —getAccessToken()
トークンを取得する
public
getAccessToken(ResultInterface $result) : array<string|int, mixed>
Parameters
- $result : ResultInterface
Tags
Return values
array<string|int, mixed> —getService()
Get Service
public
getService( $service) : array<string|int, mixed>|mixed|object
Parameters
Tags
Return values
array<string|int, mixed>|mixed|object —hasService()
Has Service
public
hasService( $service) : bool
Parameters
Tags
Return values
bool —index()
トークンを検証する(RS256のみ)
public
index() : mixed
PHPでの検証コード例
JWT::decode($jwt, JWK::parseKeySet($keys), [Configure::read('Jwt.algorithm')])
Return values
mixed —initialize()
Initialize
public
initialize() : void
Return values
void —isAdminApiEnabled()
認証が必要なAPIを利用可能かどうか判定
public
isAdminApiEnabled() : bool
Return values
bool —isAvailableUser()
ログインユーザーが有効か判定する
public
isAvailableUser() : bool
サービスクラス、または、テーブルクラスにおいて、isAvailable / get メソッドが 存在するかを確認し、あれば実行し、その結果を返す。 ない場合は、 true を返却する
Return values
bool —notFound()
NOT FOUNDページを出力する
public
notFound() : void
Tags
Return values
void —redirectIfIsRequireMaintenance()
メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
public
redirectIfIsRequireMaintenance() : Response|void|null
Tags
Return values
Response|void|null —setTitle()
Set Title
public
setTitle(string $title) : void
Parameters
- $title : string
Tags
Return values
void —setupFrontView()
フロント用のViewクラスをセットアップする
public
setupFrontView() : void
Tags
Return values
void —_autoConvertEncodingByArray()
配列の文字コードを変換する
protected
_autoConvertEncodingByArray(array<string|int, mixed> $data[, string $outenc = 'UTF-8' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
変換前データ
- $outenc : string = 'UTF-8'
-
変換後の文字コード
Tags
Return values
array<string|int, mixed> —変換後データ
loadViewConditions()
画面の情報をセッションから読み込む
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
Return values
void —saveViewConditions()
画面の情報をセッションに保存する
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
Return values
void —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)
-
Tags
Return values
void —__cleanupQueryParams()
クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
private
__cleanupQueryParams() : void
Tags
Return values
void —__convertEncodingHttpInput()
http経由で送信されたデータを変換する とりあえず、UTF-8で固定
private
__convertEncodingHttpInput() : void
Tags
Return values
void —checkPermission()
アクセスルールの権限を確認する
private
checkPermission() : bool
現在アクセスしているURLについて権限があるかどうかを確認する。