AppserverIo\Appserver\ServletEngine\Security\GenericPrincipal::__construct PHP Method

__construct() public method

Initializes the principal with the data from the passed objects.
public __construct ( string $username = null, string $password = null, AppserverIo\Collections\ArrayList $roles = null, AppserverIo\Psr\Security\PrincipalInterface $userPrincipal = null, AppserverIo\Psr\Security\Auth\Login\LoginContextInterface $loginContext = null )
$username string The principal's username
$password string The principal's password
$roles AppserverIo\Collections\ArrayList The principal's roles
$userPrincipal AppserverIo\Psr\Security\PrincipalInterface The user principal instance that will be returned from the request
$loginContext AppserverIo\Psr\Security\Auth\Login\LoginContextInterface The actual login context instance
    public function __construct(string $username = null, string $password = null, ArrayList $roles = null, PrincipalInterface $userPrincipal = null, LoginContextInterface $loginContext = null)
    {
        // set the passed instances
        $this->username = $username;
        $this->password = $password;
        $this->userPrincipal = $userPrincipal;
        $this->loginContext = $loginContext;
        // set the roles or initialize an empty ArrayList
        if ($roles == null) {
            $this->roles = new ArrayList();
        } else {
            $this->roles = $roles;
        }
    }