1 | <?php |
||
23 | class Tokens extends \Nip\Records\RecordManager implements AccessTokenRepositoryInterface |
||
24 | { |
||
25 | /** |
||
26 | * Create a new access token |
||
27 | * |
||
28 | * @param ClientEntityInterface $clientEntity |
||
29 | * @param ScopeEntityInterface[] $scopes |
||
30 | * @param mixed $userIdentifier |
||
31 | * |
||
32 | * @return AccessTokenEntityInterface|Token |
||
33 | */ |
||
34 | 1 | public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null) |
|
42 | |||
43 | /** |
||
44 | * Persists a new access token to permanent storage. |
||
45 | * |
||
46 | * @param AccessTokenEntityInterface|Token $accessTokenEntity |
||
47 | * |
||
48 | * @throws UniqueTokenIdentifierConstraintViolationException |
||
49 | */ |
||
50 | public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity) |
||
54 | |||
55 | /** |
||
56 | * Revoke an access token. |
||
57 | * |
||
58 | * @param string $tokenId |
||
59 | */ |
||
60 | public function revokeAccessToken($tokenId) |
||
69 | |||
70 | /** |
||
71 | * Check if the access token has been revoked. |
||
72 | * |
||
73 | * @param string $tokenId |
||
74 | * |
||
75 | * @return bool Return true if this token has been revoked |
||
76 | */ |
||
77 | public function isAccessTokenRevoked($tokenId) |
||
85 | |||
86 | /** |
||
87 | * @param UserTrait $user |
||
88 | * @param Client $client |
||
89 | * @return Collection|Token[] |
||
90 | */ |
||
91 | 1 | public function getValidUserTokens($user, $client) |
|
102 | |||
103 | /** |
||
104 | * @param $tokenId |
||
105 | * @return Token|null |
||
106 | */ |
||
107 | public function getByIdentifier($tokenId) |
||
112 | |||
113 | 1 | protected function initRelations() |
|
118 | |||
119 | /** @noinspection PhpMissingParentCallCommonInspection |
||
120 | * @inheritDoc |
||
121 | */ |
||
122 | protected function generateTable() |
||
126 | } |
||
127 |