Benutzer prüfen¶
Der Benutzer wird in der Alvine\Application\Web klasse mit der Methode createAuthenticationUser erstellt.
Diese wird von Alvine\Application\Platform\Web abgeleitet und erstellt hier ein Alvine\Application\Platform\Security\Authentication\User Objekt.
Der Benutzer wird im Standart über Alvine\Application\Platform\Security\Authentication\Authority\Database\Authority geprüft.
In der Methode authenticate wird der hash also die ID des Objektes gesetzt mit der UID als INT gesetzt.
// Hash setzen
$refObject=new \ReflectionObject($identity);
$refProperty=$refObject->getProperty('hash');
$refProperty->setAccessible(true);
$refProperty->setValue($identity, \Alvine\Types\Type::validateInteger($uid));
Mit dem \Alvine\Application\Platform\Security\Authentication\User\Constraint\IsVerified Constraint kann die Identity
sicher geprüft werden.
Es wird geprüft ob der Benutzer verifiziert ist und ob es sich um eine Instance von \Alvine\Application\Platform\Security\Authentication\User handelt.
Die UID kann dann sicher über $identity->getUserUID() bezogen werden
$identity = \Alvine\Application\Assembly::getInstance()->getIdentity();
$constraint = new \Alvine\Application\Platform\Security\Authentication\User\Constraint\IsVerified();
if($constraint->isValid($identity)===true){
$uid = $identity->getUserUID();
}
Token¶
Ein Benutzer der über die Passwort vergessen Funktion kommt , ist eine Identity von Alvine\Application\Platform\Security\Authentication\TemporaryIdentity . Diese ist auch von Alvine\Application\Platform\Security\Authentication\User abgeleitet und kann identisch geprüft werden.