mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-18 17:38:20 +02:00
Add reverse-proxy guard to support authentication proxy
This commit is contained in:
67
app/Extensions/RemoteUserProvider.php
Normal file
67
app/Extensions/RemoteUserProvider.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
// Part of Firefly III (https://github.com/firefly-iii)
|
||||
// see https://github.com/firefly-iii/firefly-iii/blob/main/app/Support/Authentication/RemoteUserProvider.php
|
||||
|
||||
namespace App\Extensions;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Auth\UserProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Exception;
|
||||
|
||||
class RemoteUserProvider implements UserProvider
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function retrieveById($identifier): User
|
||||
{
|
||||
$user = User::where('email', $identifier)->first();
|
||||
|
||||
// if (null === $user) {
|
||||
// $user = User::create(
|
||||
// [
|
||||
// 'name' => $identifier,
|
||||
// 'email' => $identifier,
|
||||
// 'password' => bcrypt(Str::random(64)),
|
||||
// ]
|
||||
// );
|
||||
// }
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function retrieveByToken($identifier, $token)
|
||||
{
|
||||
throw new Exception(sprintf('No implementation for %s', __METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function updateRememberToken(Authenticatable $user, $token)
|
||||
{
|
||||
throw new Exception(sprintf('No implementation for %s', __METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function retrieveByCredentials(array $credentials)
|
||||
{
|
||||
throw new Exception(sprintf('No implementation for %s', __METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function validateCredentials(Authenticatable $user, array $credentials)
|
||||
{
|
||||
throw new Exception(sprintf('No implementation for %s', __METHOD__));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user