mirror of
https://github.com/1sept/oauth2-1sept.git
synced 2024-05-30 17:38:52 +03:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d06db0d56 |
@@ -4,16 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Sept\OAuth2\Client\Provider;
|
namespace Sept\OAuth2\Client\Provider;
|
||||||
|
|
||||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||||
|
use League\OAuth2\Client\Provider\GenericProvider;
|
||||||
use League\OAuth2\Client\Token\AccessToken;
|
use League\OAuth2\Client\Token\AccessToken;
|
||||||
use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
|
use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
|
||||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Провайдер данных Первого сентября
|
* Провайдер данных Первого сентября
|
||||||
*/
|
*/
|
||||||
class SeptemberFirstProvider extends AbstractProvider
|
class SeptemberFirstProvider extends GenericProvider
|
||||||
{
|
{
|
||||||
use BearerAuthorizationTrait;
|
use BearerAuthorizationTrait;
|
||||||
|
|
||||||
@@ -32,44 +32,17 @@ class SeptemberFirstProvider extends AbstractProvider
|
|||||||
*/
|
*/
|
||||||
const API_VERSION = '2.0';
|
const API_VERSION = '2.0';
|
||||||
|
|
||||||
/**
|
public function __construct(array $options = [], array $collaborators = [])
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getBaseAuthorizationUrl(): string
|
|
||||||
{
|
{
|
||||||
return static::AUTH_BASE.'/oauth/authorize';
|
$defaultOptions = [
|
||||||
}
|
'urlAuthorize' => static::AUTH_BASE.'/oauth/authorize',
|
||||||
|
'urlAccessToken' => static::API_BASE.'/oauth/access_token',
|
||||||
|
'urlResourceOwnerDetails' => static::API_BASE.'/'.static::API_VERSION.'/userinfo',
|
||||||
|
'scopes' => ['profile'],
|
||||||
|
'scopeSeparator' => ' ',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
parent::__construct(array_merge($defaultOptions, $options), $collaborators);
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getBaseAccessTokenUrl(array $params): string
|
|
||||||
{
|
|
||||||
return static::API_BASE.'/oauth/access_token';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getResourceOwnerDetailsUrl(AccessToken $token): string
|
|
||||||
{
|
|
||||||
return static::API_BASE.'/'.static::API_VERSION.'/userinfo';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getDefaultScopes(): array
|
|
||||||
{
|
|
||||||
return ['profile'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
protected function getScopeSeparator(): string
|
|
||||||
{
|
|
||||||
return ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user