PHP Class AppserverIo\Appserver\ServletEngine\Security\Realm

Inheritance: implements AppserverIo\Appserver\ServletEngine\Security\RealmInterface
Show file Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$authenticationManager AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface The authentication manager instance.
$configruation AppserverIo\Appserver\ServletEngine\Security\SecurityDomainInterface The security domain's login modules.
$exceptionStack AppserverIo\Collections\ArrayList A stack with the exception throwed during authentication.
$name string The security domain's name.

Public Methods

Method Description
__construct ( AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface $authenticationManager, string $name ) Initialize the security domain with the passed name.
authenticate ( string $username, string $password ) : AppserverIo\Security\PrincipalInterface | null Finally tries to authenticate the user with the passed name.
authenticateByUsernameAndCallbackHandler ( string $username, AppserverIo\Psr\Security\Auth\Callback\CallbackHandlerInterface $callbackHandler ) : AppserverIo\Security\PrincipalInterface | null Finally tries to authenticate the user with the passed name.
getAuthenticationManager ( ) : AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface Return's the authentication manager instance.
getConfiguration ( ) : AppserverIo\Appserver\ServletEngine\Security\SecurityDomainInterface Return's the realm's configuration.
getExceptionStack ( ) : AppserverIo\Collections\ArrayList Return's the exception stack.
getName ( ) : string Return's the name of the security domain.
injectConfiguration ( AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface $configuration ) : void Inject the realm's configuration.

Protected Methods

Method Description
createPrincipal ( string $username, AppserverIo\Psr\Security\Auth\Subject $subject, AppserverIo\Psr\Security\Auth\Login\LoginContextInterface $loginContext ) : AppserverIo\Security\PrincipalInterface Identify and return an instance implementing the PrincipalInterface that represens the authenticated user for the specified Subject. The Principal is constructed by scanning the list of Principals returned by the LoginModule. The first Principal object that matches one of the class names supplied as a "user class" is the user Principal. This object is returned to the caller. Any remaining principal objects returned by the LoginModules are mapped to roles, but only if their respective classes match one of the "role class" classes. If a user Principal cannot be constructed, return NULL.

Method Details

__construct() public method

Initialize the security domain with the passed name.
public __construct ( AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface $authenticationManager, string $name )
$authenticationManager AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface The authentication manager instance
$name string The security domain's name

authenticate() public method

Finally tries to authenticate the user with the passed name.
public authenticate ( string $username, string $password ) : AppserverIo\Security\PrincipalInterface | null
$username string The name of the user to authenticate
$password string The password used for authentication
return AppserverIo\Security\PrincipalInterface | null The authenticated user principal

authenticateByUsernameAndCallbackHandler() public method

Finally tries to authenticate the user with the passed name.
public authenticateByUsernameAndCallbackHandler ( string $username, AppserverIo\Psr\Security\Auth\Callback\CallbackHandlerInterface $callbackHandler ) : AppserverIo\Security\PrincipalInterface | null
$username string The name of the user to authenticate
$callbackHandler AppserverIo\Psr\Security\Auth\Callback\CallbackHandlerInterface The callback handler used to load the credentials
return AppserverIo\Security\PrincipalInterface | null The authenticated user principal

createPrincipal() protected method

Identify and return an instance implementing the PrincipalInterface that represens the authenticated user for the specified Subject. The Principal is constructed by scanning the list of Principals returned by the LoginModule. The first Principal object that matches one of the class names supplied as a "user class" is the user Principal. This object is returned to the caller. Any remaining principal objects returned by the LoginModules are mapped to roles, but only if their respective classes match one of the "role class" classes. If a user Principal cannot be constructed, return NULL.
protected createPrincipal ( string $username, AppserverIo\Psr\Security\Auth\Subject $subject, AppserverIo\Psr\Security\Auth\Login\LoginContextInterface $loginContext ) : AppserverIo\Security\PrincipalInterface
$username string The associated user name
$subject AppserverIo\Psr\Security\Auth\Subject The Subject representing the logged-in user
$loginContext AppserverIo\Psr\Security\Auth\Login\LoginContextInterface Associated with the Principal so {@link LoginContext#logout()} can be called later
return AppserverIo\Security\PrincipalInterface the principal object

getAuthenticationManager() public method

Return's the authentication manager instance.
public getAuthenticationManager ( ) : AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface
return AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface The authentication manager instance

getConfiguration() public method

Return's the realm's configuration.
public getConfiguration ( ) : AppserverIo\Appserver\ServletEngine\Security\SecurityDomainInterface
return AppserverIo\Appserver\ServletEngine\Security\SecurityDomainInterface The realm's configuration

getExceptionStack() public method

Return's the exception stack.
public getExceptionStack ( ) : AppserverIo\Collections\ArrayList
return AppserverIo\Collections\ArrayList The exception stack

getName() public method

Return's the name of the security domain.
public getName ( ) : string
return string The security domain's name

injectConfiguration() public method

Inject the realm's configuration.
public injectConfiguration ( AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface $configuration ) : void
$configuration AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface The realm's configuration
return void

Property Details

$authenticationManager protected property

The authentication manager instance.
protected AuthenticationManagerInterface,AppserverIo\Appserver\ServletEngine\Security $authenticationManager
return AppserverIo\Appserver\ServletEngine\Security\AuthenticationManagerInterface

$configruation protected property

The security domain's login modules.
protected SecurityDomainInterface,AppserverIo\Appserver\ServletEngine\Security $configruation
return AppserverIo\Appserver\ServletEngine\Security\SecurityDomainInterface

$exceptionStack protected property

A stack with the exception throwed during authentication.
protected ArrayList,AppserverIo\Collections $exceptionStack
return AppserverIo\Collections\ArrayList

$name protected property

The security domain's name.
protected string $name
return string