mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-17 15:46:17 +00:00
Compare commits
2 Commits
1.0.0-rc.5
...
1.0.0-rc.6
| Author | SHA1 | Date | |
|---|---|---|---|
| 30ac4ae4f9 | |||
| e1a6af11a3 |
@@ -46,16 +46,6 @@ class AnikeenId
|
|||||||
*/
|
*/
|
||||||
public static bool $unserializesCookies = false;
|
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.
|
* The key for the access token.
|
||||||
*/
|
*/
|
||||||
@@ -96,6 +86,16 @@ class AnikeenId
|
|||||||
*/
|
*/
|
||||||
protected ?string $redirectUri = null;
|
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.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -110,25 +110,25 @@ class AnikeenId
|
|||||||
if ($redirectUri = config('services.anikeen.redirect')) {
|
if ($redirectUri = config('services.anikeen.redirect')) {
|
||||||
$this->setRedirectUri($redirectUri);
|
$this->setRedirectUri($redirectUri);
|
||||||
}
|
}
|
||||||
if (self::getMode() === 'staging') {
|
if (self::getMode() === 'staging' && !config('services.anikeen.base_url')) {
|
||||||
self::setBaseUrl(self::$stagingBaseUrl);
|
self::setBaseUrl($this->stagingBaseUrl);
|
||||||
}
|
}
|
||||||
if ($baseUrl = config('services.anikeen.base_url')) {
|
if ($baseUrl = config('services.anikeen.base_url')) {
|
||||||
self::setBaseUrl($baseUrl);
|
self::setBaseUrl($baseUrl);
|
||||||
}
|
}
|
||||||
$this->client = new Client([
|
$this->client = new Client([
|
||||||
'base_uri' => self::$baseUrl,
|
'base_uri' => $this->baseUrl,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function setBaseUrl(string $baseUrl): void
|
||||||
* @param string $baseUrl
|
|
||||||
*
|
|
||||||
* @internal only for internal and debug purposes.
|
|
||||||
*/
|
|
||||||
public static 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
|
public static function useAccessTokenField(string $accessTokenField): void
|
||||||
|
|||||||
@@ -6,11 +6,35 @@ class Scope
|
|||||||
{
|
{
|
||||||
const USER = 'user';
|
const USER = 'user';
|
||||||
const USER_READ = 'user:read';
|
const USER_READ = 'user:read';
|
||||||
const ORDERS = 'orders';
|
|
||||||
const ORDERS_READ = 'orders:read';
|
const ADDRESSES = 'addresses';
|
||||||
const PRODUCTS = 'products';
|
const ADDRESSES_READ = 'addresses:read';
|
||||||
const PRODUCTS_READ = 'products:read';
|
|
||||||
const BILLING = 'billing';
|
const BILLING = 'billing';
|
||||||
const BILLING_READ = 'billing:read';
|
const BILLING_READ = 'billing:read';
|
||||||
|
const BILLING_CLIENT = 'billing:client';
|
||||||
|
|
||||||
|
const INVOICES = 'invoices';
|
||||||
|
const INVOICES_READ = 'invoices:read';
|
||||||
|
const INVOICES_CLIENT = 'invoices:client';
|
||||||
|
|
||||||
|
const ORDERS = 'orders';
|
||||||
|
const ORDERS_READ = 'orders:read';
|
||||||
|
const ORDERS_CLIENT = 'orders:client';
|
||||||
|
|
||||||
|
const PAYMENT_METHODS = 'payment-methods';
|
||||||
|
const PAYMENT_METHODS_READ = 'payment-methods:read';
|
||||||
|
|
||||||
|
const SUBSCRIPTIONS = 'subscriptions';
|
||||||
|
const SUBSCRIPTIONS_READ = 'subscriptions:read';
|
||||||
|
const SUBSCRIPTIONS_CLIENT = 'subscriptions:client';
|
||||||
|
|
||||||
|
const TRANSACTIONS = 'transactions';
|
||||||
|
const TRANSACTIONS_READ = 'transactions:read';
|
||||||
|
const TRANSACTIONS_CLIENT = 'transactions:client';
|
||||||
|
|
||||||
|
const SSH_KEYS = 'ssh-keys';
|
||||||
|
const SSH_KEYS_READ = 'ssh-keys:read';
|
||||||
|
|
||||||
const ADMIN = 'admin';
|
const ADMIN = 'admin';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ class Provider extends AbstractProvider implements ProviderInterface
|
|||||||
*/
|
*/
|
||||||
protected function getBaseUrl(): string
|
protected function getBaseUrl(): string
|
||||||
{
|
{
|
||||||
return AnikeenId::getMode() === 'staging'
|
return app(AnikeenId::class)->getBaseUrl();
|
||||||
? 'https://staging.id.anikeen.com'
|
|
||||||
: 'https://id.anikeen.com';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,4 +95,12 @@ class Provider extends AbstractProvider implements ProviderInterface
|
|||||||
'grant_type' => 'authorization_code',
|
'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