interfaccia tra i portali e IS della Regione per l'autenticazione CNS SPID e CIE
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

33 righe
879 B

<?php
namespace MwgAuth\Models;
use MwgAuth\Core\Model;
class UserTool extends User
{
public static function add(string $username, string $password, string $remote, bool $useCns): bool
{
return self::insert('users', [
'username' => $username,
'password' => self::hashPassword($password),
'remote' => $remote,
'use_cns' => $useCns,
]);
}
public static function list(): array
{
return self::select('users', ['id', 'username', 'remote', 'use_cns'], []);
}
public static function token(string $username): ?string
{
$rows = self::select('users', ['id'], ['username' => $username]);
if (empty($rows)) {
return null;
}
$user = new User($rows[0]['id'], $username);
return $user->getToken('http://localhost/callback');
}
}