Subversion Repositories oidplus

Rev

Rev 582 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 582 Rev 585
Line 35... Line 35...
35
 
35
 
36
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
36
                        if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) {
37
                                throw new OIDplusException(_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>'));
37
                                throw new OIDplusException(_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>'));
38
                        }
38
                        }
39
 
39
 
40
                        $gen = OIDplusAuthUtils::JWT_GENERATOR_AJAX;
40
                        $gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_AJAX;
41
                        $sub = $ra_email;
41
                        $sub = $ra_email;
42
 
42
 
43
                        OIDplus::authUtils()->jwtBlacklist($gen, $sub);
43
                        OIDplusAuthContentStoreJWT::jwtBlacklist($gen, $sub);
44
 
44
 
45
                        return array("status" => 0);
45
                        return array("status" => 0);
46
                } else {
46
                } else {
47
                        throw new OIDplusException(_L('Unknown action ID'));
47
                        throw new OIDplusException(_L('Unknown action ID'));
48
                }
48
                }
Line 66... Line 66...
66
                        if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_USER', true)) {
66
                        if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_USER', true)) {
67
                                $out['text'] = '<p>'._L('The administrator has disabled this feature. (Base configuration setting %1).','JWT_ALLOW_AJAX_USER').'</p>';
67
                                $out['text'] = '<p>'._L('The administrator has disabled this feature. (Base configuration setting %1).','JWT_ALLOW_AJAX_USER').'</p>';
68
                                return;
68
                                return;
69
                        }
69
                        }
70
 
70
 
71
                        $gen = OIDplusAuthUtils::JWT_GENERATOR_AJAX;
71
                        $gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_AJAX;
72
                        $sub = $ra_email;
72
                        $sub = $ra_email;
73
 
73
 
74
                        $authSimulation = new OIDplusAuthContentStoreJWT();
74
                        $authSimulation = new OIDplusAuthContentStoreJWT();
75
                        $authSimulation->raLogin($ra_email);
75
                        $authSimulation->raLogin($ra_email);
76
                        $authSimulation->setValue('oidplus_generator', $gen);
76
                        $authSimulation->setValue('oidplus_generator', $gen);
77
                        $authSimulation->setValue('sub', $sub); // JWT "sub" attribute
-
 
78
                        $token = $authSimulation->GetJWTToken();
77
                        $token = $authSimulation->getJWTToken();
79
 
78
 
80
                        $out['text'] .= '<p>'._L('You can make automated calls to your OIDplus account by calling the AJAX API.').'</p>';
79
                        $out['text'] .= '<p>'._L('You can make automated calls to your OIDplus account by calling the AJAX API.').'</p>';
81
                        $out['text'] .= '<p>'._L('The URL for the AJAX script is:').'</p>';
80
                        $out['text'] .= '<p>'._L('The URL for the AJAX script is:').'</p>';
82
                        $out['text'] .= '<p><b>'.OIDplus::webpath(null,false).'ajax.php</b></p>';
81
                        $out['text'] .= '<p><b>'.OIDplus::webpath(null,false).'ajax.php</b></p>';
83
                        $out['text'] .= '<p>'._L('You must at least provide following fields:').'</p>';
82
                        $out['text'] .= '<p>'._L('You must at least provide following fields:').'</p>';
Line 87... Line 86...
87
                        $out['text'] .= '<p>'._L('Please keep this information confidential!').'</p>';
86
                        $out['text'] .= '<p>'._L('Please keep this information confidential!').'</p>';
88
                        $out['text'] .= '<p>'._L('The JWT-token (secret!) will automatically perform a one-time-login to fulfill the request. The other fields are the normal fields which are called during the usual operation of OIDplus.').'</p>';
87
                        $out['text'] .= '<p>'._L('The JWT-token (secret!) will automatically perform a one-time-login to fulfill the request. The other fields are the normal fields which are called during the usual operation of OIDplus.').'</p>';
89
                        $out['text'] .= '<p>'._L('Currently, there is no documentation for the AJAX calls. However, you can look at the <b>script.js</b> files of the plugins to see the field names being used. You can also enable network analysis in your web browser debugger (F12) to see the request headers sent to the server during the operation of OIDplus.').'</p>';
88
                        $out['text'] .= '<p>'._L('Currently, there is no documentation for the AJAX calls. However, you can look at the <b>script.js</b> files of the plugins to see the field names being used. You can also enable network analysis in your web browser debugger (F12) to see the request headers sent to the server during the operation of OIDplus.').'</p>';
90
 
89
 
91
                        $out['text'] .= '<h2>'._L('Blacklisted tokens').'</h2>';
90
                        $out['text'] .= '<h2>'._L('Blacklisted tokens').'</h2>';
92
                        $bl_time = OIDplus::authUtils()->jwtGetBlacklistTime($gen, $sub);
91
                        $bl_time = OIDplusAuthContentStoreJWT::jwtGetBlacklistTime($gen, $sub);
93
                        if ($bl_time == 0) {
92
                        if ($bl_time == 0) {
94
                                $out['text'] .= '<p>'._L('None of the previously generated JWT tokens have been blacklisted.').'</p>';
93
                                $out['text'] .= '<p>'._L('None of the previously generated JWT tokens have been blacklisted.').'</p>';
95
                        } else {
94
                        } else {
96
                                $out['text'] .= '<p>'._L('All tokens generated before %1 have been blacklisted.',date('d F Y, H:i:s',$bl_time+1)).'</p>';
95
                                $out['text'] .= '<p>'._L('All tokens generated before %1 have been blacklisted.',date('d F Y, H:i:s',$bl_time+1)).'</p>';
97
                        }
96
                        }