Subversion Repositories oidplus

Rev

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

Rev 1199 Rev 1265
Line 70... Line 70...
70
        /**
70
        /**
71
         * @return OIDplusAuthContentStore|null
71
         * @return OIDplusAuthContentStore|null
72
         * @throws OIDplusException
72
         * @throws OIDplusException
73
         */
73
         */
74
        protected function getAuthContentStore()/*: ?OIDplusAuthContentStore*/ {
74
        protected function getAuthContentStore()/*: ?OIDplusAuthContentStore*/ {
-
 
75
                // TODO: Should we implement these AuthContentStore as plugin type, so that there can be more than just JWT and PHP session?
-
 
76
 
75
                // Logged in via JWT
77
                // Logged in via JWT
76
                $tmp = OIDplusAuthContentStoreJWT::getActiveProvider();
78
                $tmp = OIDplusAuthContentStoreJWT::getActiveProvider();
77
                if ($tmp) return $tmp;
79
                if ($tmp) return $tmp;
78
 
80
 
-
 
81
                // For REST, we must only allow JWT from Bearer and nothing else! So disable cookies if we are accessing the REST plugin
-
 
82
                $rel_url = substr($_SERVER['REQUEST_URI'], strlen(OIDplus::webpath(null, OIDplus::PATH_RELATIVE_TO_ROOT)));
-
 
83
                if (!str_starts_with($rel_url, 'rest/')) { // <== TODO: Find a way how to move this into the plugin, since REST does not belong to the core. (Maybe some kind of "stateless mode" that is enabled by the REST plugin)
-
 
84
 
79
                // Normal login via web-browser
85
                        // Normal login via web-browser
80
                // Cookie will only be created once content is stored
86
                        // Cookie will only be created once content is stored
81
                $tmp = OIDplusAuthContentStoreSession::getActiveProvider();
87
                        $tmp = OIDplusAuthContentStoreSession::getActiveProvider();
82
                if ($tmp) return $tmp;
88
                        if ($tmp) return $tmp;
83
 
89
 
-
 
90
                }
-
 
91
 
84
                // No active session and no JWT token available. User is not logged in.
92
                // No active session and no JWT token available. User is not logged in.
85
                return null;
93
                return null;
86
        }
94
        }
87
 
95
 
88
        /**
96
        /**