diff options
author | Minteck <contact@minteck.org> | 2022-04-13 09:13:01 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-04-13 09:13:01 +0200 |
commit | 50b7b70a58942474790ac9c65ac58af87e90abb8 (patch) | |
tree | dac847095cdbaeb099c0ca45efd7beb207941dba | |
parent | b40e7f9f802c0c4bd8e1d27dbca0cbe11faff6d0 (diff) | |
download | session-50b7b70a58942474790ac9c65ac58af87e90abb8.tar.gz session-50b7b70a58942474790ac9c65ac58af87e90abb8.tar.bz2 session-50b7b70a58942474790ac9c65ac58af87e90abb8.zip |
Attempt 1 at fixing broken session
-rw-r--r-- | login/embed/index.php | 2 | ||||
-rwxr-xr-x | login/index.php | 2 | ||||
-rw-r--r-- | oauth/embed/index.php | 7 | ||||
-rwxr-xr-x | oauth/index.php | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/login/embed/index.php b/login/embed/index.php index a27ed39..a8d18a0 100644 --- a/login/embed/index.php +++ b/login/embed/index.php @@ -2,5 +2,5 @@ $_CONFIG = json_decode(file_get_contents("/mnt/familine/private/FamilineConfig.json"), true); -header("Location: https://" . $_CONFIG["Global"]["federation"] . "/auth/realms/Familine/protocol/openid-connect/auth?client_id=" . json_decode(file_get_contents("/mnt/familine/private/app.json"), true)["id"] . "&response_type=code&redirect_uri=https://session." . $_CONFIG["Global"]["domain"] . "/oauth/embed&scope=profile&request_credentials=default&access_type=offline"); +header("Location: https://" . $_CONFIG["Global"]["federation"] . "/hub/api/rest/oauth2/auth?client_id=" . json_decode(file_get_contents("/mnt/familine/private/app.json"), true)["id"] . "&response_type=code&redirect_uri=https://session." . $_CONFIG["Global"]["domain"] . "/oauth/embed&scope=profile&request_credentials=default&access_type=offline"); die(); diff --git a/login/index.php b/login/index.php index 05c3dc3..c9d3649 100755 --- a/login/index.php +++ b/login/index.php @@ -2,5 +2,5 @@ $_CONFIG = json_decode(file_get_contents("/mnt/familine/private/FamilineConfig.json"), true); -header("Location: https://" . $_CONFIG["Global"]["federation"] . "/auth/realms/Familine/protocol/openid-connect/auth?client_id=" . json_decode(file_get_contents("/mnt/familine/private/app.json"), true)["id"] . "&response_type=code&redirect_uri=https://session." . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . urlencode($_GET['r']) . "&scope=profile&request_credentials=default&access_type=offline"); +header("Location: https://" . $_CONFIG["Global"]["federation"] . "/hub/api/rest/oauth2/auth?client_id=" . json_decode(file_get_contents("/mnt/familine/private/app.json"), true)["id"] . "&response_type=code&redirect_uri=https://session." . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . urlencode($_GET['r']) . "&scope=profile&request_credentials=default&access_type=offline"); die(); diff --git a/oauth/embed/index.php b/oauth/embed/index.php index ff47ef0..663d5bc 100644 --- a/oauth/embed/index.php +++ b/oauth/embed/index.php @@ -10,7 +10,7 @@ if (!isset($_GET['code'])) { $appdata = json_decode(file_get_contents("/mnt/familine/private/app.json"), true);
-$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/token');
+$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/oauth2/token');
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLINFO_HEADER_OUT, true);
curl_setopt($crl, CURLOPT_POST, true);
@@ -19,8 +19,9 @@ curl_setopt($crl, CURLOPT_HTTPHEADER, [ "Content-Type: application/x-www-form-urlencoded",
"Accept: application/json"
]);
-curl_setopt($crl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&redirect_uri=" . urlencode("https://session." . $_CONFIG["Global"]["domain"] . "/oauth/embed") . "&code=" . $_GET['code']);
+curl_setopt($crl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&redirect_uri=" . urlencode("https://session." . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . $_GET['r']) . "&code=" . $_GET['code']);
+var_dump("grant_type=authorization_code&redirect_uri=" . urlencode("https://" . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . $_GET['r']) . "&code=" . $_GET['code']);
$result = curl_exec($crl);
var_dump($result);
$result = json_decode($result, true);
@@ -28,7 +29,7 @@ $result = json_decode($result, true); curl_close($crl);
if (isset($result["access_token"])) {
- $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/userinfo');
+ $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/users/me');
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLINFO_HEADER_OUT, true);
curl_setopt($crl, CURLOPT_HTTPHEADER, [
diff --git a/oauth/index.php b/oauth/index.php index 0a6ce71..1ebf7b7 100755 --- a/oauth/index.php +++ b/oauth/index.php @@ -10,7 +10,7 @@ if (!isset($_GET['code'])) { $appdata = json_decode(file_get_contents("/mnt/familine/private/app.json"), true);
-$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/token');
+$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/oauth2/token');
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLINFO_HEADER_OUT, true);
curl_setopt($crl, CURLOPT_POST, true);
@@ -29,7 +29,7 @@ $result = json_decode($result, true); curl_close($crl);
if (isset($result["access_token"])) {
- $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/userinfo');
+ $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/users/me');
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLINFO_HEADER_OUT, true);
curl_setopt($crl, CURLOPT_HTTPHEADER, [
@@ -49,5 +49,5 @@ if (isset($result["access_token"])) { file_put_contents("/mnt/familine/private/tokens/" . $token, json_encode($result));
setcookie("FL_SESSION_TOKEN", $token, 0, "/", "." . $_CONFIG["Global"]["cdn"], true, true);
- header("Location: https://auth.familine.minteck.org/auth/realms/Familine/X-Familine-PersistentSession/?r=" . urlencode($_GET['r']));
+ header("Location: " . $_GET['r']);
}
\ No newline at end of file |