testing
This commit is contained in:
@@ -66,8 +66,9 @@ VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
EVEONLINE_CLIENT_ID=replace_this_with_eve_developer_client_id
|
||||
EVEONLINE_SECRET_KEY=replace_this_with_eve_developer_secret_key
|
||||
EVEONLINE_REDIRECT_URI=replace_this_with_eve_developer_redirect_uri
|
||||
EVEONLINE_REDIRECT_URL=replace_this_with_eve_developer_redirect_uri
|
||||
|
||||
JWT_SECRET=replace_this_with_a_long_random_secret
|
||||
JWT_TTL=3600
|
||||
JWT_ISSUER="${APP_NAME}"
|
||||
|
||||
|
||||
50
app/Providers/Socialite/EveOnline/Claim/AzpChecker.php
Normal file
50
app/Providers/Socialite/EveOnline/Claim/AzpChecker.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Claim;
|
||||
|
||||
use Jose\Component\Checker\ClaimChecker;
|
||||
use Jose\Component\Checker\InvalidClaimException;
|
||||
|
||||
/**
|
||||
* Class AzpChecker
|
||||
*
|
||||
*/
|
||||
class AzpChecker implements ClaimChecker
|
||||
{
|
||||
private const NAME = 'azp';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $client_id;
|
||||
|
||||
/**
|
||||
* Azpchecker Constructor
|
||||
*
|
||||
* @param string $client_id
|
||||
*/
|
||||
public function __construct(string $client_id) {
|
||||
$this->client_id = $client_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkClaim($value) : void {
|
||||
if(!is_string($value)) {
|
||||
throw new InvalidClaimException('"azp" must a string.', self::NAME, $value);
|
||||
}
|
||||
|
||||
if ($value !== $this->client_id)
|
||||
throw new InvalidClaimException('"azp" must match the originating application.', self::NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedClaim(): string {
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
33
app/Providers/Socialite/EveOnline/Claim/NameChecker.php
Normal file
33
app/Providers/Socialite/EveOnline/Claim/NameChecker.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Claim;
|
||||
|
||||
use Jose\Component\Checker\ClaimChecker;
|
||||
use Jose\Component\Checker\InvalidClaimException;
|
||||
|
||||
/**
|
||||
* Class NameChecker.
|
||||
*/
|
||||
class NameChecker implements ClaimChecker
|
||||
{
|
||||
private const NAME = 'name';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkClaim($value): void
|
||||
{
|
||||
if (! is_string($value))
|
||||
throw new InvalidClaimException('"name" must be a string.', self::NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedClaim(): string
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
33
app/Providers/Socialite/EveOnline/Claim/OwnerChecker.php
Normal file
33
app/Providers/Socialite/EveOnline/Claim/OwnerChecker.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Claim;
|
||||
|
||||
use Jose\Component\Checker\ClaimChecker;
|
||||
use Jose\Component\Checker\InvalidClaimException;
|
||||
|
||||
/**
|
||||
* Class OwnerChecker.
|
||||
*/
|
||||
class OwnerChecker implements ClaimChecker
|
||||
{
|
||||
private const NAME = 'owner';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkClaim($value): void
|
||||
{
|
||||
if (! is_string($value))
|
||||
throw new InvalidClaimException('"owner" must be a string.', self::NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedClaim(): string
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
54
app/Providers/Socialite/EveOnline/Claim/ScpChecker.php
Normal file
54
app/Providers/Socialite/EveOnline/Claim/ScpChecker.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Claim;
|
||||
|
||||
use Jose\Component\Checker\ClaimChecker;
|
||||
use Jose\Component\Checker\InvalidClaimException;
|
||||
|
||||
/**
|
||||
* Class ScpChecker.
|
||||
*/
|
||||
class ScpChecker implements ClaimChecker
|
||||
{
|
||||
private const NAME = 'scp';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $scopes;
|
||||
|
||||
/**
|
||||
* ScpChecker constructor.
|
||||
*
|
||||
* @param array $scopes
|
||||
*/
|
||||
public function __construct(array $scopes)
|
||||
{
|
||||
$this->scopes = $scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkClaim($value): void
|
||||
{
|
||||
if (! is_array($value) && ! is_string($value))
|
||||
throw new InvalidClaimException('"scp" must be an array of scopes.', self::NAME, $value);
|
||||
|
||||
if (! is_array($value))
|
||||
$value = [$value];
|
||||
|
||||
if (! empty(array_diff($this->scopes, $value)))
|
||||
throw new InvalidClaimException('"scp" contains scopes which does not match requested ones or miss some requested scopes.', self::NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedClaim(): string
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Claim;
|
||||
|
||||
use Jose\Component\Checker\ClaimChecker;
|
||||
use Jose\Component\Checker\InvalidClaimException;
|
||||
|
||||
/**
|
||||
* Class SubEveCharacterChecker.
|
||||
*/
|
||||
class SubEveCharacterChecker implements ClaimChecker
|
||||
{
|
||||
private const NAME = 'sub';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkClaim($value): void
|
||||
{
|
||||
if (! is_string($value))
|
||||
throw new InvalidClaimException('"sub" must be a string.', self::NAME, $value);
|
||||
|
||||
if (preg_match('/^CHARACTER:EVE:[0-9]+$/', $value) !== 1)
|
||||
throw new InvalidClaimException('"sub" must be of the form CHARACTER:EVE:{character_id}', self::NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedClaim(): string
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline;
|
||||
|
||||
use SocialiteProviders\Managers\SocialiteWasCalled;
|
||||
|
||||
/**
|
||||
* Class EveOnlineExtendSocialite
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
class EveOnlineExtendSocialite {
|
||||
public function handle(SocialiteWasCalled $socialiteWasCalled) {
|
||||
$socialiteWasCalled->extendSocialite('eveonline', Provider::class);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
63
app/Providers/Socialite/EveOnline/Header/TypeChecker.php
Normal file
63
app/Providers/Socialite/EveOnline/Header/TypeChecker.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Socialite\EveOnline\Checker\Header;
|
||||
|
||||
use Jose\Component\Checker\HeaderChecker;
|
||||
use Jose\Component\Checker\InvalidHeaderException;
|
||||
|
||||
final class TypeChecker implements HeaderChecker
|
||||
{
|
||||
private const HEADER_NAME = 'typ';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $protected_header = true;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $supported_types;
|
||||
|
||||
/**
|
||||
* TypeChecker constructor.
|
||||
*
|
||||
* @param string[] $supported_types
|
||||
* @param bool $protected_header
|
||||
*/
|
||||
public function __construct(array $supported_types, bool $protected_header = true)
|
||||
{
|
||||
$this->supported_types = $supported_types;
|
||||
$this->protected_header = $protected_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function checkHeader($value): void
|
||||
{
|
||||
if (! is_string($value))
|
||||
throw new InvalidHeaderException('"typ" must be a string.', self::HEADER_NAME, $value);
|
||||
|
||||
if (! in_array($value, $this->supported_types, true))
|
||||
throw new InvalidHeaderException('Unsupported type.', self::HEADER_NAME, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportedHeader(): string
|
||||
{
|
||||
return self::HEADER_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function protectedHeaderOnly(): bool
|
||||
{
|
||||
return $this->protected_header;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user