File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/Ubiquity/controllers/auth Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1010 * This class is part of Ubiquity
1111 *
1212 * @author jc
13- * @version 1.0.0
13+ * @version 1.0.1
1414 *
1515 */
1616abstract class AbstractOAuthController extends Controller {
@@ -21,10 +21,12 @@ abstract class AbstractOAuthController extends Controller {
2121 */
2222 protected $ provider ;
2323
24- public function _oauth (string $ name ) {
25- $ requestURI = trim (strtok ($ _SERVER ["REQUEST_URI " ], '? ' ), '/ ' );
26- $ link = 'http ' . (isset ($ _SERVER ['HTTPS ' ]) ? 's ' : '' ) . ":// {$ _SERVER ['HTTP_HOST ' ]}/ {$ requestURI }" ;
27- $ this ->provider = OAuthManager::startAdapter ($ name , $ link );
24+ public function _oauth (string $ name , ?string $ callbackUrl = null ) {
25+ if (!isset ($ callbackUrl )) {
26+ $ requestURI = \trim (\strtok ($ _SERVER ["REQUEST_URI " ], '? ' ), '/ ' );
27+ $ callbackUrl = $ _SERVER ['HTTP_X_FORWARDED_PROTO ' ] ?? ((isset ($ _SERVER ["HTTPS " ]) && strtolower ($ _SERVER ["HTTPS " ]) == "on " ) ? 'https ' : 'http ' ) . ":// {$ _SERVER ['HTTP_HOST ' ]}/ {$ requestURI }" ;
28+ }
29+ $ this ->provider = OAuthManager::startAdapter ($ name , $ callbackUrl );
2830 $ this ->onConnect ($ name , $ this ->provider );
2931 }
3032
You can’t perform that action at this time.
0 commit comments