auth Routes - SmartBeansGoe/smartbeans-backend GitHub Wiki
This route should be called by Stud.IP. It accepts the LTI data, verifies it and redirects to the URL specified in the settings file.
Input
LTI data
Output
Redirect to <[email protected]>#<session token>
Errors
- 400: Wrong input data
- 401: LTI validation failed
- 403: LTI is disabled for this user
Password login.
Input
{
"username": <String>,
"password": <String>,
"course": <String>
}
Output
{
"token": <String>
}
Errors
- 400: Wrong input data
- 401: Wrong password
- 403: No password set for this user
- 404: Non-existing user or course
Debug login. Requires header Authorization: Bearer <[email protected]>
.
Input
-
Output
<Session token as string>
Errors
- 400: Wrong header format
- 401: Wrong key
- 403: No key set in Settings.toml
- 404: Non-existing user or course
Deletes the token from the database. Returns 200, regardless whether the token existed or not.
Input/Output
-
Creates and returns an API token with the provided name. Requires header Authorization: Bearer <valid (session) token>
.
Input
-
Output
{
"apiToken": <String>
}
Errors
- 400: Invalid header format
- 401: Invalid token
Returns the names of all API tokens for the user. Requires header Authorization: Bearer <valid (session) token>
.
Output
[<String>, <String>, ...]
Errors
- 400: Invalid header format
- 401: Invalid token
Deletes the token with the given name. Requires header Authorization: Bearer <valid (session) token>
. Returns 200 on Success.
Input/Output
-
Errors
- 400: Invalid header format
- 401: Invalid token
Register a new user. Requires header Authorization: Bearer <any auth.password.registration_keys>
if auth.password.key_required = true
. Returns 200 on Success.
Input
{
"username": <String>,
"password": <String>,
"displayName": <String>
}
Output
-
Errors
- 400: Invalid header or body format
- 401: Invalid key (only with
auth.password.key_required = true
) - 403: Username already exists
Changes the LTI status of the user. Requires header Authorization: Bearer <valid (session) token>
. Returns 200 on Success.
Input
{
"ltiEnabled": <bool>
}
Output
-
Errors
- 400: Invalid header or body format
- 401: Invalid token
Changes the password of the user. Requires header Authorization: Bearer <valid (session) token>
. Returns 200 on Success.
Input
{
"newPassword": <String>
}
Output
-
Errors
- 400: Invalid header or body format
- 401: Invalid token