0 追蹤者

介面 yii\filters\auth\AuthInterface

實作於yii\filters\auth\AuthMethod, yii\filters\auth\CompositeAuth, yii\filters\auth\HttpBasicAuth, yii\filters\auth\HttpBearerAuth, yii\filters\auth\HttpHeaderAuth, yii\filters\auth\QueryParamAuth
自版本2.0
原始碼 https://github.com/yiisoft/yii2/blob/master/framework/filters/auth/AuthInterface.php

AuthInterface 是驗證方法類別應實作的介面。

公共方法

隱藏繼承的方法

方法 描述 定義於
authenticate() 驗證當前使用者。 yii\filters\auth\AuthInterface
challenge() 驗證失敗時產生質詢。 yii\filters\auth\AuthInterface
handleFailure() 處理驗證失敗。 yii\filters\auth\AuthInterface

方法詳情

隱藏繼承的方法

authenticate() public abstract method

驗證當前使用者。

public abstract yii\web\身分介面|null authenticate ( $user, $request, $response )
$user yii\web\User
$request yii\web\Request
$response yii\web\Response
return yii\web\身分介面|null

已驗證的使用者身分。如果未提供驗證資訊,則會傳回 null。

throws yii\web\UnauthorizedHttpException

如果提供了驗證資訊,但資訊無效。

                public function authenticate($user, $request, $response);

            
challenge() public abstract method

驗證失敗時產生質詢。

例如,可能會產生一些適當的 HTTP 標頭。

public abstract void challenge ( $response )
$response yii\web\Response

                public function challenge($response);

            
handleFailure() public abstract method

處理驗證失敗。

實作通常應拋出 UnauthorizedHttpException 以指示驗證失敗。

public abstract void handleFailure ( $response )
$response yii\web\Response
throws yii\web\UnauthorizedHttpException

                public function handleFailure($response);