PHP Class yii\filters\auth\AuthMethod

Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\base\ActionFilter, implements yii\filters\auth\AuthInterface
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$optional list of action IDs that this filter will be applied to, but auth failure will not lead to error. It may be used for actions, that are allowed for public, but return some additional data for authenticated users. Defaults to empty, meaning authentication is not optional for any action. Since version 2.0.10 action IDs can be specified as wildcards, e.g. site/*.
$request the current request. If not set, the request application component will be used.
$response the response to be sent. If not set, the response application component will be used.
$user the user object representing the user authentication status. If not set, the user application component will be used.

Public Methods

Method Description
beforeAction ( $action )
challenge ( $response )
handleFailure ( $response )

Protected Methods

Method Description
isOptional ( Action $action ) : boolean Checks, whether authentication is optional for the given action.

Method Details

beforeAction() public method

public beforeAction ( $action )

challenge() public method

public challenge ( $response )

handleFailure() public method

public handleFailure ( $response )

isOptional() protected method

Checks, whether authentication is optional for the given action.
See also: optional
Since: 2.0.7
protected isOptional ( Action $action ) : boolean
$action yii\base\Action action to be checked.
return boolean whether authentication is optional or not.

Property Details

$optional public property

list of action IDs that this filter will be applied to, but auth failure will not lead to error. It may be used for actions, that are allowed for public, but return some additional data for authenticated users. Defaults to empty, meaning authentication is not optional for any action. Since version 2.0.10 action IDs can be specified as wildcards, e.g. site/*.
See also: isOptional()
Since: 2.0.7
public $optional

$request public property

the current request. If not set, the request application component will be used.
public $request

$response public property

the response to be sent. If not set, the response application component will be used.
public $response

$user public property

the user object representing the user authentication status. If not set, the user application component will be used.
public $user