Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public static function post($params) |
||
26 | { |
||
27 | // Get the token |
||
28 | $token = AuthenticationAction::getAccessTokenFromHeader(); |
||
29 | |||
30 | $refreshToken = Yii::$app->request->post('refresh_token', false); |
||
31 | |||
32 | if ($refreshToken !== $token->refresh_token) { |
||
33 | return false; |
||
34 | } |
||
35 | |||
36 | // If we can delete the token, send a newly generated token out |
||
37 | if ($token->delete()) { |
||
38 | // Merge any extra attributes with the generated tokens |
||
39 | $tokens = ArrayHelper::merge($params['class']['extraAttributes'], Token::generate(Yii::$app->user->id)); |
||
40 | // Merge the identity attributes |
||
41 | foreach ($params['class']['identityAttributes'] as $attr) { |
||
42 | $tokens[$attr] = Yii::$app->user->getIdentity()->$attr; |
||
43 | } |
||
44 | |||
45 | return $tokens; |
||
46 | } |
||
47 | |||
48 | // Return false for any other reasons |
||
49 | return false; |
||
50 | } |
||
51 | } |
||
52 |