PHP Class AppserverIo\Appserver\ServletEngine\Authenticator\FormAuthenticator

Inheritance: extends AbstractAuthenticator
Afficher le fichier Open project: appserver-io/appserver

Protected Properties

Свойство Type Description
$password string The password to authenticate the user with.

Méthodes publiques

Méthode Description
authenticate ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : boolean Try to authenticate the user making this request, based on the specified login configuration.
getPassword ( ) : AppserverIo\Lang\String Returns the parsed password.
login ( string $username, string $password, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : AppserverIo\Psr\Security\PrincipalInterface Tries the login the passed username/password combination for the login configuration.
logout ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : void Logout the actual user from the session.

Méthodes protégées

Méthode Description
forwardToErrorPage ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Forward's the request to the configured error page.
forwardToFormRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Forward's the request to the stored one or, if the user has not been on any page before, the application's base URL.
forwardToLoginPage ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Forward's the request to the configured login page.
matchRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : boolean Does this request match the saved one, so that it must be the redirect we signaled after successful authentication?
onCache ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked to handle a cached authentication request.
onCredentials ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked to load the credentials from the request.
onFailure ( AppserverIo\Appserver\ServletEngine\Security\RealmInterface $realm, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked when login fails for some reasons.
onLogin ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked to request authentication.
onResubmit ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked when login will be re-submitted.
onSuccess ( AppserverIo\Psr\Security\PrincipalInterface $userPrincipal, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Will be invoked on a successfull login.
register ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse, AppserverIo\Psr\Security\PrincipalInterface $userPrincipal ) : void Register's the user principal and the authenticytion in the request and session.
restoreRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpSessionInterface $session ) : void Populates the passed request with the request data of the original request found in the also passed session.
saveRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpSessionInterface $session ) : void Stores the data of the passed request in the also passed session.

Method Details

authenticate() public méthode

Return TRUE if any specified constraint has been satisfied, or FALSE if we have created a response challenge already.
public authenticate ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : boolean
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat boolean TRUE if authentication has already been processed on a request before, else FALSE

forwardToErrorPage() protected méthode

Forward's the request to the configured error page.
protected forwardToErrorPage ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

forwardToFormRequest() protected méthode

Forward's the request to the stored one or, if the user has not been on any page before, the application's base URL.
protected forwardToFormRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

forwardToLoginPage() protected méthode

Forward's the request to the configured login page.
protected forwardToLoginPage ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

getPassword() public méthode

Returns the parsed password.
public getPassword ( ) : AppserverIo\Lang\String
Résultat AppserverIo\Lang\String The password

login() public méthode

Tries the login the passed username/password combination for the login configuration.
public login ( string $username, string $password, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : AppserverIo\Psr\Security\PrincipalInterface
$username string The username used to login
$password string The password used to authenticate the user
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
Résultat AppserverIo\Psr\Security\PrincipalInterface The authenticated user principal

logout() public méthode

Logout the actual user from the session.
public logout ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
Résultat void

matchRequest() protected méthode

Does this request match the saved one, so that it must be the redirect we signaled after successful authentication?
protected matchRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : boolean
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
Résultat boolean TRUE if the request matches the saved one, else FALSE

onCache() protected méthode

Will be invoked to handle a cached authentication request.
protected onCache ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

onCredentials() protected méthode

Will be invoked to load the credentials from the request.
protected onCredentials ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

onFailure() protected méthode

Will be invoked when login fails for some reasons.
protected onFailure ( AppserverIo\Appserver\ServletEngine\Security\RealmInterface $realm, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$realm AppserverIo\Appserver\ServletEngine\Security\RealmInterface The realm instance containing the exception stack
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

onLogin() protected méthode

Will be invoked to request authentication.
protected onLogin ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

onResubmit() protected méthode

Will be invoked when login will be re-submitted.
protected onResubmit ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

onSuccess() protected méthode

Will be invoked on a successfull login.
protected onSuccess ( AppserverIo\Psr\Security\PrincipalInterface $userPrincipal, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$userPrincipal AppserverIo\Psr\Security\PrincipalInterface The user principal logged into the system
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
Résultat void

register() protected méthode

Register's the user principal and the authenticytion in the request and session.
protected register ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse, AppserverIo\Psr\Security\PrincipalInterface $userPrincipal ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The servlet response instance
$userPrincipal AppserverIo\Psr\Security\PrincipalInterface The actual user principal
Résultat void

restoreRequest() protected méthode

Populates the passed request with the request data of the original request found in the also passed session.
protected restoreRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpSessionInterface $session ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$session AppserverIo\Psr\Servlet\Http\HttpSessionInterface The session instance
Résultat void

saveRequest() protected méthode

Stores the data of the passed request in the also passed session.
protected saveRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpSessionInterface $session ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance
$session AppserverIo\Psr\Servlet\Http\HttpSessionInterface The session instance
Résultat void

Property Details

$password protected_oe property

The password to authenticate the user with.
protected string $password
Résultat string