Methods summary
public static
MvcCore\Ext\Auths\Basic
|
#
GetInstance( array $configuration = [] )
Return singleton instance. If instance exists, return existing instance,
if not, create new basic authentication module instance, store it and return it.
Return singleton instance. If instance exists, return existing instance,
if not, create new basic authentication module instance, store it and return it.
Parameters
- $configuration
Optional configuration passed into method
\MvcCore\Ext\Auths\Basic::__construct($configuration) .
Returns
|
public
integer
|
#
GetExpirationIdentity( )
Get expiration time (in seconds) how long to remember the user name in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 1 month (30 days, 2592000 seconds).
Get expiration time (in seconds) how long to remember the user name in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 1 month (30 days, 2592000 seconds).
Returns
integer
|
public
integer
|
#
GetExpirationAuthorization( )
Get expiration time (in seconds) how long to remember the authorization in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 10 minutes (600 seconds).
Get expiration time (in seconds) how long to remember the authorization in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 10 minutes (600 seconds).
Returns
integer
|
public
string
|
#
GetUserClass( )
Get full class name to use for user instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IUser .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\User .
Get full class name to use for user instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IUser .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\User .
Returns
string
|
public
string
|
#
GetRoleClass( )
Get full class name to use for user role class.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IRole .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Role .
Get full class name to use for user role class.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IRole .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Role .
Returns
string
|
public
string
|
#
GetControllerClass( )
Get full class name to use for controller instance
to submit authentication form(s). Class name has to implement interfaces:
- \MvcCore\Ext\Auths\Basics\IController
- \MvcCore\IController
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Controller .
Get full class name to use for controller instance
to submit authentication form(s). Class name has to implement interfaces:
- \MvcCore\Ext\Auths\Basics\IController
- \MvcCore\IController
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Controller .
Returns
string
|
public
string
|
#
GetSignInFormClass( )
Get full class name to use for sign in form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignInForm .
Get full class name to use for sign in form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignInForm .
Returns
string
|
public
string
|
#
GetSignOutFormClass( )
Full class name to use for sign out form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignOutForm .
Full class name to use for sign out form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignOutForm .
Returns
string
|
public
string|null
|
#
GetSignedInUrl( )
Get full URL to redirect user, after sign in
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign in form rendered.
Get full URL to redirect user, after sign in
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign in form rendered.
Returns
string|null
|
public
string|null
|
#
GetSignedOutUrl( )
Get full URL to redirect user, after sign out
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign out form rendered.
Get full URL to redirect user, after sign out
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign out form rendered.
Returns
string|null
|
public
string|null
|
#
GetSignErrorUrl( string $signErrorUrl,… )
Get full URL to redirect user, after sign in POST
request or sign out POST request was not successful,
for example wrong credentials.
If NULL (by default), user will be redirected
to the same url, where was sign in/out form rendered.
Get full URL to redirect user, after sign in POST
request or sign out POST request was not successful,
for example wrong credentials.
If NULL (by default), user will be redirected
to the same url, where was sign in/out form rendered.
Parameters
Returns
string|null
|
public
MvcCore\Route
|
#
GetSignInRoute( )
Get route instance to submit sign in form into.
Default configured route for sign in request is /signin by POST.
Get route instance to submit sign in form into.
Default configured route for sign in request is /signin by POST.
Returns
|
public
MvcCore\Route
|
#
GetSignOutRoute( )
Get route to submit sign out form into.
Default configured route for sign in request is /signout by POST.
Get route to submit sign out form into.
Default configured route for sign in request is /signout by POST.
Returns
|
public
string|null
|
#
GetPasswordHashSalt( )
Get configured salt for passord_hash(); to generate password by PASSWORD_BCRYPT .
NULL by default. This option is the only one option required
to configure authentication module to use it properly.
Get configured salt for passord_hash(); to generate password by PASSWORD_BCRYPT .
NULL by default. This option is the only one option required
to configure authentication module to use it properly.
Returns
string|null
|
public
integer
|
#
GetInvalidCredentialsTimeout( )
Get timeout to sleep(); PHP script before sending response to user,
when user submitted invalid username or password.
Default value is 3 (3 seconds).
Get timeout to sleep(); PHP script before sending response to user,
when user submitted invalid username or password.
Default value is 3 (3 seconds).
Returns
integer
|
public
callable|null
|
#
GetTranslator( )
Get configured callable translator to set it into authentication form
to translate form labels, placeholders, buttons or error messages.
Default value is NULL (forms without translations).
Get configured callable translator to set it into authentication form
to translate form labels, placeholders, buttons or error messages.
Default value is NULL (forms without translations).
Returns
callable|null
|
public
MvcCore\Ext\Auths\Basics\User |null
|
#
GetUser( )
Get authenticated user model instance reference
or NULL if user has no username record in session namespace.
If user has not yet been initialized, load the user internally by
{$configuredUserClass}::SetUpUserBySession(); to try to load
user by username record in session namespace.
Get authenticated user model instance reference
or NULL if user has no username record in session namespace.
If user has not yet been initialized, load the user internally by
{$configuredUserClass}::SetUpUserBySession(); to try to load
user by username record in session namespace.
Returns
|
public
boolean
|
#
IsAuthenticated( )
Return TRUE if user is authenticated/signed in,
TRUE if user has any username record in session namespace.
If user has not yet been initialized, load the user internally by
$auth->GetUser(); to try to load user by username record in session namespace.
Return TRUE if user is authenticated/signed in,
TRUE if user has any username record in session namespace.
If user has not yet been initialized, load the user internally by
$auth->GetUser(); to try to load user by username record in session namespace.
Returns
boolean
|
public
|
#
GetForm( )
Return completed sign in or sign out form instance.
Form instance completion is processed only once,
any created form instance is stored in $auth->form property.
This method is always called by you, your application
to set form into you custom template to render it for user.
If user is not authenticated, sign in form is returned and
if user is authenticated, opposite sign out form is returned.
This method is only alias to call two other methods:
- \MvcCore\Ext\Auths\Basic::GetInstance()->GetSignInForm(); for not authenticated users.
- \MvcCore\Ext\Auths\Basic::GetInstance()->GetSignOutForm(); for authenticated users.
Return completed sign in or sign out form instance.
Form instance completion is processed only once,
any created form instance is stored in $auth->form property.
This method is always called by you, your application
to set form into you custom template to render it for user.
If user is not authenticated, sign in form is returned and
if user is authenticated, opposite sign out form is returned.
This method is only alias to call two other methods:
- \MvcCore\Ext\Auths\Basic::GetInstance()->GetSignInForm(); for not authenticated users.
- \MvcCore\Ext\Auths\Basic::GetInstance()->GetSignOutForm(); for authenticated users.
Var
\MvcCore\Ext\Auths\Basics\Form\SignIn|\MvcCore\Ext\Auths\Basics\Form\SignOut
|
public
MvcCore\Ext\Auths\Basics\Form\SignIn
|
#
GetSignInForm( )
Return completed sign in form instance.
Form instance completion is processed only once,
created form instance is stored in $auth->form property.
Return completed sign in form instance.
Form instance completion is processed only once,
created form instance is stored in $auth->form property.
Returns
|
public
MvcCore\Ext\Auths\Basics\Form\SignOut
|
#
GetSignOutForm( )
Return completed sign out form instance.
Form instance completion is processed only once,
created form instance is stored in $auth->form property.
Return completed sign out form instance.
Form instance completion is processed only once,
created form instance is stored in $auth->form property.
Returns
|
public
array
|
#
GetConfiguration( )
Return array with all protected configuration properties.
Return array with all protected configuration properties.
Returns
array
|
public
MvcCore\Ext\Auths\Basic
|
#
SetExpirationIdentity( integer $identityExpirationSeconds = 2592000 )
Set expiration time (in seconds) how long to remember the user name in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 1 month (30 days, 2592000 seconds).
Set expiration time (in seconds) how long to remember the user name in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 1 month (30 days, 2592000 seconds).
Parameters
- $identityExpirationSeconds
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetExpirationAuthorization( $authorizationExpirationSeconds = 600 )
Set expiration time (in seconds) how long to remember the authorization in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 10 minutes (600 seconds).
Set expiration time (in seconds) how long to remember the authorization in session.
You can use zero (0 ) to browser close moment, but some browsers can
restore previous session after next browser application start. Or anybody
else in your project could use session for storing any information
for some longer time in your application and session cookie could then
exists much longer then browser close moment only.
So better is not to use a zero value.
Default value is 10 minutes (600 seconds).
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetUserClass( string $userClass = '' )
Set full class name to use for user instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IUser .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\User .
Set full class name to use for user instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IUser .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\User .
Parameters
- $userClass
- User full class name implementing
\MvcCore\Ext\Auths\Basics\IUser .
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetRoleClass( string $roleClass = '' )
Set full class name to use for user role class.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IRole .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Role .
Set full class name to use for user role class.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IRole .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Role .
Parameters
- $roleClass
- Role full class name implementing
\MvcCore\Ext\Auths\Basics\IRole .
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetControllerClass( string $controllerClass = '' )
Set full class name to use for controller instance
to submit authentication form(s). Class name has to implement interfaces:
- \MvcCore\Ext\Auths\Basics\IController
- \MvcCore\IController
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Controller .
Set full class name to use for controller instance
to submit authentication form(s). Class name has to implement interfaces:
- \MvcCore\Ext\Auths\Basics\IController
- \MvcCore\IController
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\Controller .
Parameters
- $controllerClass
- Controller full class name implementing
\MvcCore\Ext\Auths\Basics\IController .
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignInFormClass( string $signInFormClass = '' )
Set full class name to use for sign in form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignInForm .
Set full class name to use for sign in form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignInForm .
Parameters
- $signInFormClass
- Form full class name implementing
\MvcCore\Ext\Auths\Basics\IForm .
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignOutFormClass( string $signOutFormClass = '' )
Set full class name to use for sign out form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignOutForm .
Set full class name to use for sign out form instance.
Class name has to implement interface
\MvcCore\Ext\Auths\Basics\IForm .
Default value after authentication module init is
configured to \MvcCore\Ext\Auths\Basics\SignOutForm .
Parameters
- $signOutFormClass
- $signInFormClass Form full class name implementing
\MvcCore\Ext\Auths\Basics\IForm .
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignedInUrl( string|null $signedInUrl = NULL )
Set full URL to redirect user, after sign in
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign in form rendered.
Set full URL to redirect user, after sign in
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign in form rendered.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignedOutUrl( string|null $signedOutUrl = NULL )
Set full URL to redirect user, after sign out
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign out form rendered.
Set full URL to redirect user, after sign out
POST request was successful.
If NULL (by default), user will be redirected
to the same url, where was sign out form rendered.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignErrorUrl( string|null $signErrorUrl = NULL )
Set full URL to redirect user, after sign in POST
request or sign out POST request was not successful,
for example wrong credentials.
If NULL (by default), user will be redirected
to the same url, where was sign in/out form rendered.
Set full URL to redirect user, after sign in POST
request or sign out POST request was not successful,
for example wrong credentials.
If NULL (by default), user will be redirected
to the same url, where was sign in/out form rendered.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignInRoute( string|array|MvcCore\Route $signInRoute = NULL )
Set route instance to submit sign in form into.
Default configured route for sign in request is /signin by POST.
Set route instance to submit sign in form into.
Default configured route for sign in request is /signin by POST.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetSignOutRoute( string|array|MvcCore\Route $signOutRoute = NULL )
Set route to submit sign out form into.
Default configured route for sign in request is /signout by POST.
Set route to submit sign out form into.
Default configured route for sign in request is /signout by POST.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetPasswordHashSalt( string $passwordHashSalt = '' )
Set configured salt for passord_hash(); to generate password by PASSWORD_BCRYPT .
NULL by default. This option is the only one option required
to configure authentication module to use it properly.
Set configured salt for passord_hash(); to generate password by PASSWORD_BCRYPT .
NULL by default. This option is the only one option required
to configure authentication module to use it properly.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetInvalidCredentialsTimeout( integer $seconds = 3 )
Set timeout to sleep(); PHP script before sending response to user,
when user submitted invalid username or password.
Default value is 3 (3 seconds).
Set timeout to sleep(); PHP script before sending response to user,
when user submitted invalid username or password.
Default value is 3 (3 seconds).
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetTranslator( callable $translator = NULL )
Set callable translator to set it into authentication form
to translate form labels, placeholders or buttons.
Default value is NULL (forms without translations).
Set callable translator to set it into authentication form
to translate form labels, placeholders or buttons.
Default value is NULL (forms without translations).
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetUser( MvcCore\Ext\Auths\Basics\IUser $user = NULL )
Set user instance manually. If you use this method
no authentication by {$configuredUserClass}::SetUpUserBySession();
is used and authentication state is always positive.
Set user instance manually. If you use this method
no authentication by {$configuredUserClass}::SetUpUserBySession();
is used and authentication state is always positive.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetForm( MvcCore\Ext\Auths\Basics\IForm $form )
Set sign in, sign out or any authentication form instance.
Use this method only if you need sometimes to complete different form to render.
Set sign in, sign out or any authentication form instance.
Use this method only if you need sometimes to complete different form to render.
Parameters
Returns
|
public
MvcCore\Ext\Auths\Basic
|
#
SetConfiguration( array $configuration = [], boolean $throwExceptionIfPropertyIsMissing = TRUE )
Set up authorization module configuration.
Each array key has to be key by protected configuration property in this class.
All properties are one by one configured by it's setter method.
Set up authorization module configuration.
Each array key has to be key by protected configuration property in this class.
All properties are one by one configured by it's setter method.
Parameters
- $configuration
- Keys by protected properties names in camel case.
- $throwExceptionIfPropertyIsMissing
Returns
Throws
InvalidArgumentException
|
public
MvcCore\Ext\Auths\Basic
|
#
SetTableStructureForDbUsers( string|null $tableName = NULL, string[]|null $columnNames = NULL )
Optional alias method if you have user class configured
to database user: \MvcCore\Ext\Auths\Basics\Users\Database .
Alias for \MvcCore\Ext\Auths\Basics\Users\Database::SetUsersTableStructure($tableName, $columnNames); .
Optional alias method if you have user class configured
to database user: \MvcCore\Ext\Auths\Basics\Users\Database .
Alias for \MvcCore\Ext\Auths\Basics\Users\Database::SetUsersTableStructure($tableName, $columnNames); .
Parameters
- $tableName
- Database table name.
- $columnNames
- Keys are user class protected properties names in camel case, values are database columns names.
Returns
|