mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented PHP-CS-Fixer support
This commit is contained in:
@@ -214,7 +214,7 @@ class Component extends YiiUserComponent {
|
||||
|
||||
protected function createToken(Account $account): Token {
|
||||
$token = new Token();
|
||||
foreach($this->getClaims($account) as $claim) {
|
||||
foreach ($this->getClaims($account) as $claim) {
|
||||
$token->addClaim($claim);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ class Identity implements IdentityInterface {
|
||||
*/
|
||||
private $_accessToken;
|
||||
|
||||
private function __construct(AccessTokenEntity $accessToken) {
|
||||
$this->_accessToken = $accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @throws \yii\web\UnauthorizedHttpException
|
||||
@@ -73,10 +77,6 @@ class Identity implements IdentityInterface {
|
||||
throw new NotSupportedException('This method used for cookie auth, except we using Bearer auth');
|
||||
}
|
||||
|
||||
private function __construct(AccessTokenEntity $accessToken) {
|
||||
$this->_accessToken = $accessToken;
|
||||
}
|
||||
|
||||
private function getSession(): OauthSession {
|
||||
return OauthSession::findOne($this->_accessToken->getSessionId());
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ class JwtIdentity implements IdentityInterface {
|
||||
*/
|
||||
private $token;
|
||||
|
||||
private function __construct(string $rawToken, Token $token) {
|
||||
$this->rawToken = $rawToken;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public static function findIdentityByAccessToken($rawToken, $type = null): IdentityInterface {
|
||||
/** @var \api\components\User\Component $component */
|
||||
$component = Yii::$app->user;
|
||||
@@ -86,9 +91,4 @@ class JwtIdentity implements IdentityInterface {
|
||||
throw new NotSupportedException('This method used for cookie auth, except we using Bearer auth');
|
||||
}
|
||||
|
||||
private function __construct(string $rawToken, Token $token) {
|
||||
$this->rawToken = $rawToken;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use Emarref\Jwt\Claim\AbstractClaim;
|
||||
|
||||
class ScopesClaim extends AbstractClaim {
|
||||
|
||||
const NAME = 'ely-scopes';
|
||||
public const NAME = 'ely-scopes';
|
||||
|
||||
/**
|
||||
* ScopesClaim constructor.
|
||||
|
||||
@@ -21,7 +21,7 @@ class SubjectPrefixVerifier implements VerifierInterface {
|
||||
$subject = ($subjectClaim === null) ? null : $subjectClaim->getValue();
|
||||
|
||||
if (!StringHelper::startsWith($subject, $this->subjectPrefix)) {
|
||||
throw new InvalidSubjectException;
|
||||
throw new InvalidSubjectException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user