No description
Find a file
Brendan Golden c85bd97967 Merge branch '#26-clubs-and-socs' into 'main'
Allow Clubs and Socs to have accounts again

Closes #26

See merge request compsoc1/skynet/ldap/backend!22
2024-03-11 21:30:27 +00:00
scripts fix: now deals with the correct path for the old ssh accounts 2023-08-24 18:54:22 +01:00
src fix: havent used the csv import in quite a while, would be good to remove it now. 2024-03-11 21:17:45 +00:00
.gitignore fix: ignore the cargo dir 2023-12-24 23:29:35 +00:00
.gitlab-ci.yml ci: should deal with nestled folders now? 2023-08-11 08:28:36 +01:00
.rustfmt.toml fmt: updated the formatting 2023-08-19 22:09:41 +01:00
Cargo.lock feat: remove the last traces of the csv 2023-10-27 01:48:37 +01:00
Cargo.toml feat: remove the last traces of the csv 2023-10-27 01:48:37 +01:00
flake.lock feat: packed up server as a flake 2023-06-18 20:46:02 +01:00
flake.nix feat: new env var for clubs and socs 2024-03-11 20:56:14 +00:00
README.md docs : documentation for new endpoints 2023-12-31 02:42:25 +00:00
rust-toolchain.toml feat: added a toolchain to use 2023-12-24 22:28:21 +00:00

Skynet LDAP backend

Basic information on the Skynet ldap backend for use on https://account.skynet.ie

Error: HTTP 500

No indication of the issue is returned to teh frontend.

Routes

Base URL: https://api.account.skynet.ie

POST /ldap/update

Fields:

  • userPassword
  • mail
  • sshPublicKey
  • cn
  • sn
  • skDiscord
{ 
  "user" : "username", 
  "pass" : "password",
  "field": "field to change",
  "value": "new value of field"
}

Success:
Each value is either a string or null.

{
  "result": "success",
  "success": {
    "cn": "Firstname Surname",
    "mail": "Email address",
    "skDiscord": null, 
    "sshPublicKey": "ssh key"
  }
}

Changing userPassword requires the existing password in teh apssword field and the new one in teh value field.

POST /ldap/new/email

Kickstarts teh process of signing up to Skynet

{ 
  "email" : "User's wolves email"
}

POST /ldap/new/account

Verifies teh user has access to this email

{ 
  "auth" : "Authcode from the email",
  "user" : "username the user wants", 
  "pass" : "password teh user wants"
}

Username taken:

{"result": "error", "error": "username not available"}

Invalid Auth:

{"result": "error", "error": "Invalid auth"}

Responses

Generic responses which is used unless otherwise specified above.

POST /ldap/recover/username

Sends an email to the user of the address reminding them of their username (if there is an account associated with said username).

{
  "email" : "email looking for remidner"
}

POST /ldap/recover/password

{
  "user" : "[OPTIONAL] username looking for reset",
  "email" : "[OPTIONAL] email looking for reset"
}

All responses:

{"result": "success"}

POST /ldap/recover/password/auth

{
  "auth" : "Auth key from teh email",
  "pass" : "Password the user chooses"
}

Early Errors:

{"result": "error"}

LDAP error:

{"result": "error", "error": "ldap error"}

Success:

{"result": "success", "success": "Password set"}

POST /ldap/recover/ssh/request

This endpoint can set emails for old skynet members who previously logged in via ssh keys.

  1. Request for their account.
  2. A list of public keys will be displayed.
  3. Sign using one of the private keys.
  4. Submit the pem value.
echo "auth code" | ssh-keygen -Y sign -n file -f /path/to/private/key
{ 
  "user" : "Skynet username",
  "email" : "Email to set"
}

Errors:

{"result": "error", "error": "Skynet email not permitted."}
{ "result": "success", "success": {  "auth": "", "keys": [] }}
{ "result": "success", "success": {  "auth": "code here", "keys": ["key 1", "key 2"] }}

POST /ldap/recover/ssh/verify

{ 
  "user" : "Skynet username",
  "auth_signed" : "signed auth code"
}

Errors

{ "result": "error"}
{ "result": "error", "error": "Incorrect signed format"}
{"result": "error", "error": "no valid key"}

Success

{"result": "success", "success": "key valid"}

POST /ldap/ssh

Returns array of SSH keys associated with the Skynet account

{
  "auth" : {
    "user": "username",
    "pass": "password"
  }
}

Errors

{"result": "error", "error": "Failed to authenticate"}

Success

{"result": "success", "success": ["key1","key2","key3"]}

DELETE /ldap/ssh

Deletes SSH key from Skynet account

{
  "auth" : {
    "user": "username",
    "pass": "password"
  },
  "key": "ssh key"
}

Errors

{"result": "error", "error": "Failed to authenticate"}
{"result": "error", "error": "Failed to remove key"}

Success

{"result": "success"}

POST /ldap/ssh/add

Adds SSH key to Skynet account

{
  "auth" : {
    "user": "username",
    "pass": "password"
  },
  "key": "ssh key"
}

Errors

{"result": "error", "error": "Failed to authenticate"}
{"result": "error", "error": "Failed to add key"}

Success

{"result": "success"}

Responses

Generic responses which is used unless otherwise specified above.

Success: HTTP 200

{
    "result": "success"
}