File tree Expand file tree Collapse file tree 10 files changed +10
-1095
lines changed
tutorials-and-examples/cms Expand file tree Collapse file tree 10 files changed +10
-1095
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ CakePHP の中に含まれるコンポーネントの詳細については、各
1414.. toctree ::
1515 :maxdepth: 1
1616
17- /controllers/components/authentication
1817 /controllers/components/flash
1918 /controllers/components/security
2019 /controllers/components/request-handling
@@ -85,15 +84,15 @@ CakePHP の中に含まれるコンポーネントの詳細については、各
8584 }
8685 }
8786
88- // src/Controller/Component/MyAuthComponent .php
89- use Cake\Controller\Component\AuthComponent ;
87+ // src/Controller/Component/MyFlashComponent .php
88+ use Cake\Controller\Component\FlashComponent ;
9089
91- class MyAuthComponent extends AuthComponent
90+ class MyFlashComponent extends FlashComponent
9291 {
93- // コア AuthComponent を上書きするコードを追加
92+ // Add your code to override the core FlashComponent
9493 }
9594
96- 上記の例ではコントローラーにて ``MyAuthComponent `` に ``$this->Auth `` という
95+ 上記の例ではコントローラーにて ``MyFlushComponent `` に ``$this->Flash `` という
9796*別名 * をつけています。
9897
9998.. note ::
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ App クラスはリソースの位置とパスの管理を担当します。
1616CakePHP が使用する短い形式の名前を解決し、完全解決されたクラス名を返します。 ::
1717
1818 // 短いクラス名を名前空間とサフィックスで解決します。
19- App::className('Auth ', 'Controller/Component', 'Component');
20- // Cake\Controller\Component\AuthComponent を返します
19+ App::className('Flash ', 'Controller/Component', 'Component');
20+ // Cake\Controller\Component\FlashComponent を返します
2121
2222 // プラグイン名を解決します。
2323 App::className('DebugKit.Toolbar', 'Controller/Component', 'Component');
Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ App.baseUrl
9898App.base
9999 アプリの存在するベースディレクトリーです。もし ``false `` をセットしたら、自動で検出されます。
100100 ``false `` 以外の場合、書き出しは `/ ` から始め、 `/ ` で終わらないことを確認してください。
101- 例えば、 `/basedir ` は有効な App.base です。さもなければ、
102- AuthComponent は適切に動かなくなります。
101+ 例えば、 `/basedir ` は有効な App.base です。
103102App.encoding
104103 あなたのアプリケーションで使用するエンコードを指定します。
105104 このエンコーディングはレイアウトの charset の生成やエンティティーのエンコードに利用されます。
Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ Null値でない戻り値に対する便宜的なラッパーと同じです。
403403
404404.. php :method :: renew()
405405
406- ユーザーがログインやログアウトした時、 ``AuthComponent `` は自動的にセッション ID を更新しますが、
406+ ユーザーがログインやログアウトした時、 ``Authentication Plugin `` は自動的にセッション ID を更新しますが、
407407セッション ID を手動で切り替えたい時もあるでしょう。そのためには、 ``renew() `` メソッドを
408408使います。 ::
409409
Original file line number Diff line number Diff line change @@ -1004,42 +1004,6 @@ CakePHP では特別に ``IntegrationTestTrait`` トレイトを提供してい
10041004
10051005これらのヘルパーメソッドによって設定された状態は、 ``tearDown() `` メソッドでリセットされます。
10061006
1007- .. _testing-authentication :
1008-
1009- 認証が必要なアクションのテスト
1010- ------------------------------
1011-
1012- もし ``AuthComponent `` を使用している場合、AuthComponent がユーザーの ID を検証するために
1013- 使用するセッションデータをスタブ化する必要があります。これを行うには、 ``IntegrationTestTrait ``
1014- のヘルパーメソッドを使用します。 ``ArticlesController `` が add メソッドを含み、
1015- その add メソッドに必要な認証を行っていたと仮定すると、次のテストを書くことができます。 ::
1016-
1017- public function testAddUnauthenticatedFails(): void
1018- {
1019- // セッションデータの未設定
1020- $this->get('/articles/add');
1021-
1022- $this->assertRedirect(['controller' => 'Users', 'action' => 'login']);
1023- }
1024-
1025- public function testAddAuthenticated(): void
1026- {
1027- // セッションデータのセット
1028- $this->session([
1029- 'Auth' => [
1030- 'User' => [
1031- 'id' => 1,
1032- 'username' => 'testing',
1033- // 他のキー
1034- ]
1035- ]
1036- ]);
1037- $this->get('/articles/add');
1038-
1039- $this->assertResponseOk();
1040- // その他のアサーション
1041- }
1042-
10431007ステートレス認証と API のテスト
10441008-------------------------------
10451009
Original file line number Diff line number Diff line change 2020 views
2121 orm
2222
23- controllers/components/authentication
2423 core-libraries/caching
2524 bake
2625 console-commands
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ Contents
2020 views
2121 orm
2222
23- controllers/components/authentication
2423 core-libraries/caching
2524 bake
2625 console-commands
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ CakePHP のすべての重要な部分の紹介
2424* :doc: `/core-libraries/form `
2525* :doc: `/development/sessions `
2626* :doc: `/development/rest `
27- * :doc: `/controllers/components/authentication `
2827* :doc: `/controllers/pagination `
2928* :ref: `csrf-middleware `
3029* :doc: `/core-libraries/email `
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ bcrypt は `PHPの推奨パスワードハッシュアルゴリズム <https://w
9393 ユーザーが認証されているかどうかチェックします。
9494
9595覚えているかもしれませんが、
96- 以前は、これらすべてのステップを処理するために :doc: ` AuthComponent < /controllers/components/authentication >` を使用していました 。
96+ 以前は、これらすべてのステップを処理するために AuthComponentを使用していました 。
9797現在では、ロジックは特定のクラスに分割され、認証プロセスはコントローラーレイヤーの前に行われます。
9898ユーザーが(指定した構成に基づいて)認証されたかどうか確認し、ユーザーと認証結果をリクエストに挿入し、参照できるようにします。
9999
You can’t perform that action at this time.
0 commit comments