AppserverIo\Appserver\ServletEngine\Security\Auth\Spi\AbstractLoginModule::createIdentity PHP Method

createIdentity() public method

Utility method to create a Principal for the given username. This creates an instance of the principalClassName type if this option was specified. If principalClassName was not specified, a SimplePrincipal is created.
public createIdentity ( string $name ) : Principal
$name string The name of the principal
return Principal The principal instance
    public function createIdentity(string $name)
    {
        //initialize the principal
        $principal = null;
        // query whether or not a principal class name has been specified
        if ($this->principalClassName == null) {
            $principal = new SimplePrincipal($name);
        } else {
            $reflectionClass = new ReflectionClass($this->principalClassName->__toString());
            $principal = $reflectionClass->newInstanceArgs(array($name));
        }
        // return the principal instance
        return $principal;
    }