Commit 3881ea0a authored by Imran Hussain's avatar Imran Hussain
Browse files

Close #4 - Add callbacks

parent 09de3c34
......@@ -5,6 +5,14 @@
The core of the Application `public/index.php` allows people to verify their
sucs and iss accounts with us.
### Callbacks
You can use `GET` Requests to call back to your apps. The params `callbackapp`
and `callbackpath` are simple, they translate to `<callbackapp>.sucs.org/<callbackpath>`
```http://sucs.org/~imranh/sso/public?callbackapp=doorkey&callbackpath=/```
## API
### v1
......@@ -15,13 +23,10 @@ sucs and iss accounts with us.
> ---
> id=<value of `sucs_sso_id_v1` cookie> REQUIRED
> iss=<true|false> OPTIONAL - return if they have logged in using iss creds (default false)
> ---
> apistate - should always be "ok" if not then don't trust the result
> sucs_username - will be their username
> iss_username - will be their iss username, only if requested
......@@ -70,6 +70,11 @@ if ( isset($_POST["username"]) && isset($_POST["password"]) && !$RATELIMITED ) {
$DB_CON->exec("UPDATE sessions SET sucs_username='${username}' WHERE id='${SESSIONID}'");
$SUCS_LOGIN = true;
$details["sucs_username"] = $username;
if (isset($_GET["callbackapp"]) && isset($_GET["callbackpath"])) {
header("Location: http://${_GET["callbackapp"]}.sucs.org/${_GET["callbackpath"]}");
}
} elseif ($isAuthd == "uni"){
//do stuff for uni auth
$DB_CON->exec("UPDATE sessions SET iss_username='${username}' WHERE id='${SESSIONID}'");
......@@ -95,6 +100,9 @@ if ( isset($_POST["username"]) && isset($_POST["password"]) && !$RATELIMITED ) {
$DB_CON->exec("UPDATE sessions SET sucs_username='${username}' WHERE id='${SESSIONID}'");
$SUCS_LOGIN = true;
$details["sucs_username"] = $username;
if (isset($_GET["callbackapp"]) && isset($_GET["callbackpath"])) {
header("Location: http://${_GET["callbackapp"]}.sucs.org/${_GET["callbackpath"]}");
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment