🤖 Rector and PHPCS fixes
[dokuwiki.git] / inc / Action / Authtoken.php
blob92b171b46ed7394c21f1afa93808844b42a9e4f7
1 <?php
3 namespace dokuwiki\Action;
5 use dokuwiki\Action\Exception\ActionAbort;
6 use dokuwiki\Action\Exception\ActionException;
7 use dokuwiki\JWT;
9 class Authtoken extends AbstractUserAction
11 /** @inheritdoc */
12 public function minimumPermission()
14 return AUTH_NONE;
17 /** @inheritdoc */
18 public function checkPreconditions()
20 parent::checkPreconditions();
22 if (!checkSecurityToken()) throw new ActionException('profile');
25 /** @inheritdoc */
26 public function preProcess()
28 global $INPUT;
29 parent::preProcess();
30 $token = JWT::fromUser($INPUT->server->str('REMOTE_USER'));
31 $token->save();
32 throw new ActionAbort('profile');