Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions ja/controllers/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ CakePHP の中に含まれるコンポーネントの詳細については、各
.. toctree::
:maxdepth: 1

/controllers/components/authentication
/controllers/components/flash
/controllers/components/security
/controllers/components/request-handling
/controllers/components/form-protection
/controllers/components/check-http-cache
Expand Down Expand Up @@ -85,15 +83,15 @@ CakePHP の中に含まれるコンポーネントの詳細については、各
}
}

// src/Controller/Component/MyAuthComponent.php
use Cake\Controller\Component\AuthComponent;
// src/Controller/Component/MyFlashComponent.php
use Cake\Controller\Component\FlashComponent;

class MyAuthComponent extends AuthComponent
class MyFlashComponent extends FlashComponent
{
// コア AuthComponent を上書きするコードを追加
// Add your code to override the core FlashComponent
}

上記の例ではコントローラーにて ``MyAuthComponent`` に ``$this->Auth`` という
上記の例ではコントローラーにて ``MyFlushComponent`` に ``$this->Flash`` という
*別名* をつけています。

.. note::
Expand Down
1,044 changes: 0 additions & 1,044 deletions ja/controllers/components/authentication.rst

This file was deleted.

190 changes: 0 additions & 190 deletions ja/controllers/components/security.rst

This file was deleted.

4 changes: 2 additions & 2 deletions ja/core-libraries/app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ App クラスはリソースの位置とパスの管理を担当します。
CakePHP が使用する短い形式の名前を解決し、完全解決されたクラス名を返します。 ::

// 短いクラス名を名前空間とサフィックスで解決します。
App::className('Auth', 'Controller/Component', 'Component');
// Cake\Controller\Component\AuthComponent を返します
App::className('Flash', 'Controller/Component', 'Component');
// Cake\Controller\Component\FlashComponent を返します

// プラグイン名を解決します。
App::className('DebugKit.Toolbar', 'Controller/Component', 'Component');
Expand Down
2 changes: 1 addition & 1 deletion ja/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ variables.

* :ref:`csrf-middleware` コンポーネントまたはミドルウェアを使用していることを確認して
下さい。
* :doc:`/controllers/components/security` コンポーネントを有効化しておいた方が
* :doc:`/controllers/components/form-protection` コンポーネントを有効化しておいた方が
いいかもしれません。フォームの改ざんや一括代入 (mass-assignment) 脆弱性に関する
問題の発生可能性を削減することができます。
* 各モデルにおいて、正しい :doc:`/core-libraries/validation` ルールが
Expand Down
3 changes: 1 addition & 2 deletions ja/development/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ App.baseUrl
App.base
アプリの存在するベースディレクトリーです。もし ``false`` をセットしたら、自動で検出されます。
``false`` 以外の場合、書き出しは `/` から始め、 `/` で終わらないことを確認してください。
例えば、 `/basedir` は有効な App.base です。さもなければ、
AuthComponent は適切に動かなくなります。
例えば、 `/basedir` は有効な App.base です。
App.encoding
あなたのアプリケーションで使用するエンコードを指定します。
このエンコーディングはレイアウトの charset の生成やエンティティーのエンコードに利用されます。
Expand Down
2 changes: 1 addition & 1 deletion ja/development/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Null値でない戻り値に対する便宜的なラッパーと同じです。

.. php:method:: renew()

ユーザーがログインやログアウトした時、 ``AuthComponent`` は自動的にセッション ID を更新しますが、
ユーザーがログインやログアウトした時、 ``Authentication Plugin`` は自動的にセッション ID を更新しますが、
セッション ID を手動で切り替えたい時もあるでしょう。そのためには、 ``renew()`` メソッドを
使います。 ::

Expand Down
36 changes: 0 additions & 36 deletions ja/development/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1004,42 +1004,6 @@ CakePHP では特別に ``IntegrationTestTrait`` トレイトを提供してい

これらのヘルパーメソッドによって設定された状態は、 ``tearDown()`` メソッドでリセットされます。

.. _testing-authentication:

認証が必要なアクションのテスト
------------------------------

もし ``AuthComponent`` を使用している場合、AuthComponent がユーザーの ID を検証するために
使用するセッションデータをスタブ化する必要があります。これを行うには、 ``IntegrationTestTrait``
のヘルパーメソッドを使用します。 ``ArticlesController`` が add メソッドを含み、
その add メソッドに必要な認証を行っていたと仮定すると、次のテストを書くことができます。 ::

public function testAddUnauthenticatedFails(): void
{
// セッションデータの未設定
$this->get('/articles/add');

$this->assertRedirect(['controller' => 'Users', 'action' => 'login']);
}

public function testAddAuthenticated(): void
{
// セッションデータのセット
$this->session([
'Auth' => [
'User' => [
'id' => 1,
'username' => 'testing',
// 他のキー
]
]
]);
$this->get('/articles/add');

$this->assertResponseOk();
// その他のアサーション
}

ステートレス認証と API のテスト
-------------------------------

Expand Down
1 change: 0 additions & 1 deletion ja/epub-contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
views
orm

controllers/components/authentication
core-libraries/caching
bake
console-commands
Expand Down
1 change: 0 additions & 1 deletion ja/pdf-contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Contents
views
orm

controllers/components/authentication
core-libraries/caching
bake
console-commands
Expand Down
1 change: 0 additions & 1 deletion ja/topics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ CakePHP のすべての重要な部分の紹介
* :doc:`/core-libraries/form`
* :doc:`/development/sessions`
* :doc:`/development/rest`
* :doc:`/controllers/components/authentication`
* :doc:`/controllers/pagination`
* :ref:`csrf-middleware`
* :doc:`/core-libraries/email`
Expand Down
2 changes: 1 addition & 1 deletion ja/tutorials-and-examples/cms/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bcrypt は `PHPの推奨パスワードハッシュアルゴリズム <https://w
ユーザーが認証されているかどうかチェックします。

覚えているかもしれませんが、
以前は、これらすべてのステップを処理するために :doc:`AuthComponent </controllers/components/authentication>` を使用していました
以前は、これらすべてのステップを処理するために AuthComponentを使用していました
現在では、ロジックは特定のクラスに分割され、認証プロセスはコントローラーレイヤーの前に行われます。
ユーザーが(指定した構成に基づいて)認証されたかどうか確認し、ユーザーと認証結果をリクエストに挿入し、参照できるようにします。

Expand Down
Loading