Subversion Repositories oidplus

Rev

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

Rev 800 Rev 801
Line 31... Line 31...
31
 
31
 
32
        public function gui($id, &$out, &$handled) {
32
        public function gui($id, &$out, &$handled) {
33
                if ($id === 'oidplus:login_google') {
33
                if ($id === 'oidplus:login_google') {
34
                        $handled = true;
34
                        $handled = true;
35
                        $out['title'] = _L('Login using Google');
35
                        $out['title'] = _L('Login using Google');
36
                        $out['icon']  = OIDplus::webpath(__DIR__,true).'img/main_icon.png';
36
                        $out['icon']  = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png';
37
 
37
 
38
                        if (!OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_ENABLED', false)) {
38
                        if (!OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_ENABLED', false)) {
39
                                $out['icon'] = 'img/error.png';
39
                                $out['icon'] = 'img/error.png';
40
                                $out['text'] = _L('Google OAuth authentication is disabled on this system.');
40
                                $out['text'] = _L('Google OAuth authentication is disabled on this system.');
41
                                return;
41
                                return;
Line 44... Line 44...
44
                        $target =
44
                        $target =
45
                                "https://accounts.google.com/o/oauth2/v2/auth?".
45
                                "https://accounts.google.com/o/oauth2/v2/auth?".
46
                                "response_type=code&".
46
                                "response_type=code&".
47
                                "client_id=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_ID'))."&".
47
                                "client_id=".urlencode(OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_CLIENT_ID'))."&".
48
                                "scope=".implode('%20', array(/*'openid',*/ 'email', 'profile'))."&".
48
                                "scope=".implode('%20', array(/*'openid',*/ 'email', 'profile'))."&".
49
                                "redirect_uri=".urlencode(OIDplus::webpath(__DIR__,false).'oauth.php')."&".
49
                                "redirect_uri=".urlencode(OIDplus::webpath(__DIR__,OIDplus::PATH_ABSOLUTE_CANONICAL).'oauth.php')."&".
50
                                "state=".urlencode($_COOKIE['csrf_token_weak']);
50
                                "state=".urlencode($_COOKIE['csrf_token_weak']);
51
                        $out['text'] = '<p>'._L('Please wait...').'</p><script>window.location.href = '.js_escape($target).';</script>';
51
                        $out['text'] = '<p>'._L('Please wait...').'</p><script>window.location.href = '.js_escape($target).';</script>';
52
                }
52
                }
53
        }
53
        }
54
 
54
 
Line 73... Line 73...
73
                $logins = array();
73
                $logins = array();
74
                if (OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_ENABLED', false)) {
74
                if (OIDplus::baseConfig()->getValue('GOOGLE_OAUTH2_ENABLED', false)) {
75
                        $logins[] = array(
75
                        $logins[] = array(
76
                                'oidplus:login_google',
76
                                'oidplus:login_google',
77
                                _L('Login using Google'),
77
                                _L('Login using Google'),
78
                                OIDplus::webpath(__DIR__,true).'img/main_icon16.png'
78
                                OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png'
79
                        );
79
                        );
80
                }
80
                }
81
                return $logins;
81
                return $logins;
82
        }
82
        }
83
}
83
}