You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
737 B

  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Action\Exception\ActionAbort;
  4. use dokuwiki\Action\Exception\ActionException;
  5. use dokuwiki\JWT;
  6. class Authtoken extends AbstractUserAction
  7. {
  8. /** @inheritdoc */
  9. public function minimumPermission()
  10. {
  11. return AUTH_NONE;
  12. }
  13. /** @inheritdoc */
  14. public function checkPreconditions()
  15. {
  16. parent::checkPreconditions();
  17. if (!checkSecurityToken()) throw new ActionException('profile');
  18. }
  19. /** @inheritdoc */
  20. public function preProcess()
  21. {
  22. global $INPUT;
  23. parent::preProcess();
  24. $token = JWT::fromUser($INPUT->server->str('REMOTE_USER'));
  25. $token->save();
  26. throw new ActionAbort('profile');
  27. }
  28. }