1 | <?php |
||
24 | class Identity extends Component |
||
25 | { |
||
26 | /** |
||
27 | * Issue an authorization JWT token on behalf of a user. |
||
28 | * |
||
29 | * @param string $user |
||
30 | * @param string|null $audience |
||
31 | * @param int|null $expiration |
||
32 | * @return Token|null |
||
33 | * @throws \craft\errors\SiteNotFoundException |
||
34 | * @throws \yii\base\InvalidConfigException |
||
35 | */ |
||
36 | public function issue( |
||
56 | |||
57 | /** |
||
58 | * This |
||
59 | * @param string $token |
||
60 | * @return bool|null|IdentityInterface |
||
61 | * @throws \craft\errors\SiteNotFoundException |
||
62 | */ |
||
63 | public function claim(string $token) |
||
71 | |||
72 | /** |
||
73 | * @param $token |
||
74 | * @param bool $validate |
||
75 | * @param bool $verify |
||
76 | * @return Token|null |
||
77 | * @throws \craft\errors\SiteNotFoundException |
||
78 | */ |
||
79 | public function parse(string $token, bool $validate = true, bool $verify = true) |
||
91 | |||
92 | /** |
||
93 | * @param Token $token |
||
94 | * @return bool |
||
95 | * @throws \craft\errors\SiteNotFoundException |
||
96 | */ |
||
97 | public function verifyToken(Token $token): bool |
||
108 | |||
109 | /** |
||
110 | * @param Token $token |
||
111 | * @return null|IdentityInterface |
||
112 | */ |
||
113 | private function tokenIdentity(Token $token) |
||
117 | |||
118 | /** |
||
119 | * @param string|null $audience |
||
120 | * @return string |
||
121 | * @throws \craft\errors\SiteNotFoundException |
||
122 | */ |
||
123 | private function resolveAudience(string $audience = null): string |
||
131 | |||
132 | /** |
||
133 | * @param int|null $expiration |
||
134 | * @return int |
||
135 | * @throws \yii\base\InvalidConfigException |
||
136 | */ |
||
137 | private function resolveTokenExpiration(int $expiration = null): int |
||
145 | } |
||
146 |