misuzu/src/Auth/AuthContext.php

43 lines
1.2 KiB
PHP

<?php
namespace Misuzu\Auth;
use Index\Data\IDbConnection;
use Syokuhou\IConfig;
class AuthContext {
private Sessions $sessions;
private LoginAttempts $loginAttempts;
private RecoveryTokens $recoveryTokens;
private TwoFactorAuthSessions $tfaSessions;
private IConfig $config;
public function __construct(IDbConnection $dbConn, IConfig $config) {
$this->config = $config;
$this->sessions = new Sessions($dbConn);
$this->loginAttempts = new LoginAttempts($dbConn);
$this->recoveryTokens = new RecoveryTokens($dbConn);
$this->tfaSessions = new TwoFactorAuthSessions($dbConn);
}
public function getSessions(): Sessions {
return $this->sessions;
}
public function getLoginAttempts(): LoginAttempts {
return $this->loginAttempts;
}
public function getRecoveryTokens(): RecoveryTokens {
return $this->recoveryTokens;
}
public function getTwoFactorAuthSessions(): TwoFactorAuthSessions {
return $this->tfaSessions;
}
public function createAuthTokenPacker(): AuthTokenPacker {
return new AuthTokenPacker($this->config->getString('secret', 'meow'));
}
}