texdc/veritas

Identity and Access Control - Simplified, but not anemic

Maintainers

Details

github.com/texdc/Veritas

Source

Issues

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 1

pkg:composer/texdc/veritas

dev-develop 2017-03-31 19:46 UTC

This package is not auto-updated.

Last update: 2025-09-27 20:19:57 UTC


README

Identity and Access Control - simplified, but not anemic.

WIP: currently experimental only

Build Status Coverage Status

Passwords and Validation

use texdc\veritas\identity\CryptoServiceInterface;
use texdc\veritas\identity\Password;

class User
{
    /**
     * @var Password
     */
    private $password;
    
    // ...
    
    public function changePassword(string $aPassword, CryptoServiceInterface $aCryptoService)
    {
        $this->setPassword(new Password($aCryptoService->encrypt($aPassword)));
        $this->eventService->publish(new PasswordChangedEvent($this->userId));
    }
    
    protected function setPassword(Password $aPassword)
    {
        if ($this->password == $aPassword) {
            throw new IdenticalPasswordException;
        }
        $this->password = $aPassword;
    }
    
    // ...
}