Class OTPAuthenticate
Authenticate users via One Time Password.
-
Cake\Auth\BaseAuthenticate
-
BEdita\API\Auth\OTPAuthenticate
uses
Cake\Event\EventDispatcherTrait (not available)
Methods summary
public
|
#
__construct( Cake\Controller\ComponentRegistry $registry, array $config = [] )
|
public
|
#
authenticate( Cake\Http\ServerRequest $request, Cake\Http\Response $response )
|
protected
array|boolean
|
#
otpAccess( string $username, Cake\Http\ServerRequest $request )
Retrieve access grant using authorization code and secret token.
Retrieve access grant using authorization code and secret token.
Parameters
- $username
- User name
- $request
- Request object
Returns
array|boolean User data array on success, false on failure
|
protected
array|boolean
|
#
otpRequest( string $username )
Generate a new client and secret token upon otp_request
Generate a new client and secret token upon otp_request
Parameters
Returns
array|boolean Authorization code array on success, false on failure
|
public
string
|
#
generateClientToken( )
Generate authorization code, aka client token.
Generate authorization code, aka client token.
Returns
string The generated token
Codecoverageignore
|
public
string
|
#
generateSecretToken( )
Generate secret token, to be sent separately in a secure way to user
Generate secret token, to be sent separately in a secure way to user
Returns
string The generated secure token
|
public static
string
|
#
defaultSecretGenerator( )
Super-simple default secret generator: string of 6 random digits
Super-simple default secret generator: string of 6 random digits
Returns
string The generated secure token
|
Properties summary
protected
array
|
$_defaultConfig
Default config for this object.
Default config for this object.
authProviders The AuthProviders entities associated to this authentication component.
Array formatted with auth_providers.name as key, from AuthProvidersTable::findAuthenticate()
fields The fields to use to identify a user by.
userModel The alias for users table, defaults to Users.
finder The finder method to use to fetch user record. Defaults to 'all'.
You can set finder name as string or an array where key is finder name and value
is an array passed to Table::find() options.
E.g. ['finderName' => ['some_finder_option' => 'some_value']]
passwordHasher Password hasher class. Can be a string specifying class name
or an array containing className key, any other keys will be passed as
config to the class. Defaults to 'Default'.
- 'expiry' Expiry time of a user token, expressed as string expression like
+1 hour , +10 minutes
- 'generator' Secret token generator, if a valid callable is used instead of default one.
|
#
[
'authProviders' => [],
'fields' => [
'username' => 'username',
'password' => null,
],
'userModel' => 'Users',
'finder' => 'loginRoles',
'passwordHasher' => 'Default',
'expiry' => '+15 minutes',
'generator' => null,
]
|