Rev 1283 | Rev 1301 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1283 | Rev 1300 | ||
---|---|---|---|
Line 73... | Line 73... | ||
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? |
75 | // TODO: Should we implement these AuthContentStore as plugin type, so that there can be more than just JWT and PHP session? |
76 | 76 | ||
77 | // Logged in via JWT |
77 | // Logged in via JWT |
- | 78 | // (The JWT can come from a REST Authentication Bearer, an AJAX Cookie, or an Automated AJAX Call GET/POST token.) |
|
78 | $tmp = OIDplusAuthContentStoreJWT::getActiveProvider(); |
79 | $tmp = OIDplusAuthContentStoreJWT::getActiveProvider(); |
79 | if ($tmp) return $tmp; |
80 | if ($tmp) return $tmp; |
80 | 81 | ||
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 | - | ||
85 | // Normal login via web-browser |
82 | // Normal login via web-browser |
86 | // Cookie will only be created once content is stored |
83 | // Cookie will only be created once content is stored |
87 | $tmp = OIDplusAuthContentStoreSession::getActiveProvider(); |
84 | $tmp = OIDplusAuthContentStoreSession::getActiveProvider(); |
88 | if ($tmp) return $tmp; |
85 | if ($tmp) return $tmp; |
89 | 86 | ||
90 | } |
- | |
91 | - | ||
92 | // No active session and no JWT token available. User is not logged in. |
87 | // No active session and no JWT token available. User is not logged in. |
93 | return null; |
88 | return null; |
94 | } |
89 | } |
95 | 90 | ||
96 | /** |
91 | /** |