Subversion Repositories oidplus

Rev

Rev 1278 | Rev 1305 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1278 Rev 1293
Line 27... Line 27...
27
// phpcs:enable PSR1.Files.SideEffects
27
// phpcs:enable PSR1.Files.SideEffects
28
 
28
 
29
class OIDplusPageRaAutomatedAJAXCalls extends OIDplusPagePluginRa {
29
class OIDplusPageRaAutomatedAJAXCalls extends OIDplusPagePluginRa {
30
 
30
 
31
        /**
31
        /**
32
         * @param string $actionID
-
 
33
         * @param array $params
32
         * @param array $params
34
         * @return array
33
         * @return array
35
         * @throws OIDplusException
34
         * @throws OIDplusException
36
         */
35
         */
37
        public function action(string $actionID, array $params): array {
36
        private function action_Blacklist(array $params): array {
38
                if ($actionID == 'blacklistJWT') {
-
 
39
                        if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_USER', true)) {
37
                if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_USER', true)) {
40
                                throw new OIDplusException(_L('The administrator has disabled this feature. (Base configuration setting %1).','JWT_ALLOW_AJAX_USER'));
38
                        throw new OIDplusException(_L('The administrator has disabled this feature. (Base configuration setting %1).','JWT_ALLOW_AJAX_USER'));
41
                        }
39
                }
42
 
40
 
43
                        _CheckParamExists($params, 'user');
41
                _CheckParamExists($params, 'user');
44
                        $ra_email = $params['user'];
42
                $ra_email = $params['user'];
45
 
43
 
46
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
44
                if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
47
                                throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), null, 401);
45
                        throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), null, 401);
48
                        }
46
                }
-
 
47
 
-
 
48
                $gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_AJAX;
-
 
49
                $sub = $ra_email;
49
 
50
 
50
                        $gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_AJAX;
51
                OIDplusAuthContentStoreJWT::jwtBlacklist($gen, $sub);
51
                        $sub = $ra_email;
-
 
52
 
52
 
53
                        OIDplusAuthContentStoreJWT::jwtBlacklist($gen, $sub);
53
                return array("status" => 0);
-
 
54
        }
54
 
55
 
-
 
56
        /**
-
 
57
         * @param string $actionID
-
 
58
         * @param array $params
-
 
59
         * @return array
-
 
60
         * @throws OIDplusException
-
 
61
         */
-
 
62
        public function action(string $actionID, array $params): array {
-
 
63
                if ($actionID == 'blacklistJWT') {
55
                        return array("status" => 0);
64
                        return $this->action_Blacklist($params);
56
                } else {
65
                } else {
57
                        return parent::action($actionID, $params);
66
                        return parent::action($actionID, $params);
58
                }
67
                }
59
        }
68
        }
60
 
69