69 lines
2.0 KiB
PHP
69 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXF\Security\Authentication;
|
|
|
|
use KTXF\Security\Authentication\ProviderContext;
|
|
use KTXF\Security\Authentication\ProviderResult;
|
|
|
|
/**
|
|
* Abstract base for authentication provider
|
|
*/
|
|
abstract class AuthenticationProviderAbstract implements AuthenticationProviderInterface
|
|
{
|
|
|
|
abstract public function type(): string;
|
|
|
|
abstract public function identifier(): string;
|
|
|
|
abstract public function label(): string;
|
|
|
|
abstract public function description(): string;
|
|
|
|
abstract public function method(): string;
|
|
|
|
abstract public function icon(): string;
|
|
|
|
public function verify(ProviderContext $context, string $secret): ProviderResult
|
|
{
|
|
return ProviderResult::failed(
|
|
ProviderResult::ERROR_INVALID_PROVIDER,
|
|
'Credential authentication not supported by this provider'
|
|
);
|
|
}
|
|
|
|
public function beginChallenge(ProviderContext $context): ProviderResult
|
|
{
|
|
return ProviderResult::failed(
|
|
ProviderResult::ERROR_INVALID_PROVIDER,
|
|
'Challenge authentication not supported by this provider'
|
|
);
|
|
}
|
|
|
|
public function verifyChallenge(ProviderContext $context, string $code): ProviderResult
|
|
{
|
|
return ProviderResult::failed(
|
|
ProviderResult::ERROR_INVALID_PROVIDER,
|
|
'Challenge authentication not supported by this provider'
|
|
);
|
|
}
|
|
|
|
public function beginRedirect(ProviderContext $context, string $callbackUrl, ?string $returnUrl = null): ProviderResult
|
|
{
|
|
return ProviderResult::failed(
|
|
ProviderResult::ERROR_INVALID_PROVIDER,
|
|
'Redirect authentication not supported by this provider'
|
|
);
|
|
}
|
|
|
|
public function completeRedirect(ProviderContext $context, array $params): ProviderResult
|
|
{
|
|
return ProviderResult::failed(
|
|
ProviderResult::ERROR_INVALID_PROVIDER,
|
|
'Redirect authentication not supported by this provider'
|
|
);
|
|
}
|
|
|
|
}
|