/**
  * Queries whether or not the login module has the passed control flag or not.
  *
  * @param \AppserverIo\Lang\String $controlFlag TRUE if the login module has the control flag, else FALSE
  *
  * @return boolean TRUE if the passed control flag matches, else FALSE
  */
 public function hasControlFlag(string $controlFlag)
 {
     return $this->controlFlag->equals($controlFlag);
 }
 /**
  * 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.
  *
  * @param \AppserverIo\Lang\String $name The name of the principal
  *
  * @return Principal The principal instance
  * @throws \Exception Is thrown if the custom principal type cannot be created
  */
 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;
 }
 /**
  * Returns the principals name as string.
  *
  * @return string The principal's name
  */
 public function __toString()
 {
     return $this->name->__toString();
 }