mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-13 13:46:13 +00:00
update provider
This commit is contained in:
@@ -46,16 +46,6 @@ class AnikeenId
|
||||
*/
|
||||
public static bool $unserializesCookies = false;
|
||||
|
||||
/**
|
||||
* The base URL for Anikeen ID API.
|
||||
*/
|
||||
private static string $baseUrl = 'https://id.anikeen.com/api/';
|
||||
|
||||
/**
|
||||
* The staging base URL for Anikeen ID API.
|
||||
*/
|
||||
private static string $stagingBaseUrl = 'https://staging.id.anikeen.com/api/';
|
||||
|
||||
/**
|
||||
* The key for the access token.
|
||||
*/
|
||||
@@ -96,6 +86,16 @@ class AnikeenId
|
||||
*/
|
||||
protected ?string $redirectUri = null;
|
||||
|
||||
/**
|
||||
* The base URL for Anikeen ID.
|
||||
*/
|
||||
protected string $baseUrl = 'https://id.anikeen.com';
|
||||
|
||||
/**
|
||||
* The staging base URL for Anikeen ID.
|
||||
*/
|
||||
protected string $stagingBaseUrl = 'https://staging.id.anikeen.com';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -110,25 +110,25 @@ class AnikeenId
|
||||
if ($redirectUri = config('services.anikeen.redirect')) {
|
||||
$this->setRedirectUri($redirectUri);
|
||||
}
|
||||
if (self::getMode() === 'staging') {
|
||||
self::setBaseUrl(self::$stagingBaseUrl);
|
||||
if (self::getMode() === 'staging' && !config('services.anikeen.base_url')) {
|
||||
self::setBaseUrl($this->stagingBaseUrl);
|
||||
}
|
||||
if ($baseUrl = config('services.anikeen.base_url')) {
|
||||
self::setBaseUrl($baseUrl);
|
||||
}
|
||||
$this->client = new Client([
|
||||
'base_uri' => self::$baseUrl,
|
||||
'base_uri' => $this->baseUrl,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
*
|
||||
* @internal only for internal and debug purposes.
|
||||
*/
|
||||
public static function setBaseUrl(string $baseUrl): void
|
||||
protected function setBaseUrl(string $baseUrl): void
|
||||
{
|
||||
self::$baseUrl = $baseUrl;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
public function getBaseUrl(): string
|
||||
{
|
||||
return rtrim($this->baseUrl, '/');
|
||||
}
|
||||
|
||||
public static function useAccessTokenField(string $accessTokenField): void
|
||||
|
||||
@@ -33,9 +33,7 @@ class Provider extends AbstractProvider implements ProviderInterface
|
||||
*/
|
||||
protected function getBaseUrl(): string
|
||||
{
|
||||
return AnikeenId::getMode() === 'staging'
|
||||
? 'https://staging.id.anikeen.com'
|
||||
: 'https://id.anikeen.com';
|
||||
return app(AnikeenId::class)->getBaseUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,4 +95,12 @@ class Provider extends AbstractProvider implements ProviderInterface
|
||||
'grant_type' => 'authorization_code',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user logout url for the provider.
|
||||
*/
|
||||
public function getLogoutUrl(string $redirect = null): string
|
||||
{
|
||||
return app(AnikeenId::class)->getBaseUrl() . '/logout?redirect=' . urlencode($redirect ?: '/');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user