\User\AuthAnonymousAuthenticate

Anonymous Authenticate adapter.

Applies authorization rules to anonymous users. Also, it will try login using the following methods:

  • Cookie: If user has a valid "remember me" cookie it be used to log in.
  • Token: If a valid token is given in current URL (as GET argument) user will be automatically logged in.

NOTE: Cookies are automatically created by FormAuthenticate.

Summary

Methods
Properties
Constants
authenticate()
unauthenticated()
action()
No public properties found
No constants found
_cookieLogin()
_tokenLogin()
_rolePermissions()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

authenticate()

authenticate(\Cake\Network\Request $request, \Cake\Network\Response $response) : boolean

Anonymous count as a "login failure".

Parameters

\Cake\Network\Request $request

Unused request object

\Cake\Network\Response $response

Unused response object

Returns

boolean —

False always.

unauthenticated()

unauthenticated(\Cake\Network\Request $request, \Cake\Network\Response $response) : boolean|null

Handle unauthenticated access attempt. In implementation valid return values can be:

  • Null - No action taken, AuthComponent should return appropriate response.
  • Cake\Network\Response - A response object, which will cause AuthComponent to simply return that response.

Parameters

\Cake\Network\Request $request

A request object

\Cake\Network\Response $response

A response object

Returns

boolean|null

action()

action(\Cake\Network\Request $request, string $path) : string

Gets an ACO path for current request.

Parameters

\Cake\Network\Request $request

Request object

string $path

Pattern

Returns

string

_cookieLogin()

_cookieLogin(\Cake\Network\Request $request) : boolean

Tries to login user if he/she has a cookie.

Parameters

\Cake\Network\Request $request

A request object

Returns

boolean —

True if user was logged in using cookie, false otherwise

_tokenLogin()

_tokenLogin(\Cake\Network\Request $request) : boolean

Tries to login user using token.

Token must be passed as a GET parameter named token, tokens looks as follow:

// <md5-hash> (length = 32)
5df9f63916ebf8528697b629022993e8

Tokens are consumables, the same token cannot be used twice to log in.

Parameters

\Cake\Network\Request $request

A request object

Returns

boolean —

True if user was logged in using token, false otherwise

_rolePermissions()

_rolePermissions(integer $roleId) : array

Gets all permissions available for the given role.

Example Output:

[
    'User/Admin/Gateway/login' => true,
    'User/Admin/Gateway/logout' => true,
    ...
]

Resulting array is always key => true, as role have access to every ACO in the array "true" is the only possible value.

Parameters

integer $roleId

Role's ID

Returns

array —

Array of ACO paths which role has permissions to