mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
Initial import
This commit is contained in:
commit
2295a33590
884 changed files with 93939 additions and 0 deletions
34
php/src/Auth/AuthManager.php
Normal file
34
php/src/Auth/AuthManager.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Auth;
|
||||
|
||||
use AIO\Data\ConfigurationManager;
|
||||
|
||||
class AuthManager {
|
||||
private const SESSION_KEY = 'aio_authenticated';
|
||||
private ConfigurationManager $configurationManager;
|
||||
|
||||
public function __construct(ConfigurationManager $configurationManager) {
|
||||
$this->configurationManager = $configurationManager;
|
||||
}
|
||||
|
||||
public function CheckCredentials(string $username, string $password) : bool {
|
||||
if($username === $this->configurationManager->GetUserName()) {
|
||||
return hash_equals($this->configurationManager->GetPassword(), $password);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function CheckToken(string $token) : bool {
|
||||
return hash_equals($this->configurationManager->GetToken(), $token);
|
||||
}
|
||||
|
||||
public function SetAuthState(bool $isLoggedIn) : void {
|
||||
$_SESSION[self::SESSION_KEY] = $isLoggedIn;
|
||||
}
|
||||
|
||||
public function IsAuthenticated() : bool {
|
||||
return isset($_SESSION[self::SESSION_KEY]) && $_SESSION[self::SESSION_KEY] === true;
|
||||
}
|
||||
}
|
||||
7801
php/src/Auth/PasswordGenerator.php
Normal file
7801
php/src/Auth/PasswordGenerator.php
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue