Add actiondoc for auth

next
Sayan Nandan 3 years ago
parent 5681e5ec53
commit 97112c4b51
No known key found for this signature in database
GPG Key ID: 8BC07A0A4D41DD52

@ -72,6 +72,40 @@ global:
Returns an array with either the name of the current keyspace as the first element or if a default table Returns an array with either the name of the current keyspace as the first element or if a default table
is set, then it returns the keyspace name as the first element and the table name as the second element is set, then it returns the keyspace name as the first element and the table name as the second element
return: [Non-null array] return: [Non-null array]
- name: AUTH
desc: Change global authn/authz settings
subactions:
- name: LOGIN
complexity: O(1)
accept: [AnyArray]
syntax: [AUTH LOGIN <username> <token>]
desc: Attempts to log in using the provided credentials
return: [Rcode 0, Rcode 10]
- name: CLAIM
complexity: O(1)
accept: [AnyArray]
syntax: [AUTH CLAIM <origin key>]
desc: Attempts to claim the root account using the origin key
return: [String, Rcode 10]
- name: LOGOUT
complexity: O(1)
accept: [AnyArray]
syntax: [AUTH LOGOUT]
desc: Attempts to log out the currently logged in user
return: [Rcode 0, Rcode 10]
- name: ADDUSER
complexity: O(1)
accept: [AnyArray]
syntax: [AUTH ADDUSER <username>]
desc: Attempts to create a new user with the provided username, returning the token
return: [String, Rcode 11]
- name: DELUSER
complexity: O(1)
accept: [AnyArray]
syntax: [AUTH DELUSER <username>]
desc: Attempts to delete the user with the provided username
return: [Rcode 0, Rcode 10, Rcode 11]
keyvalue: keyvalue:
generic: generic:
- name: DEL - name: DEL

@ -27,7 +27,7 @@
use crate::actions::ActionError; use crate::actions::ActionError;
/// Skyhash respstring: already claimed (user was already claimed) /// Skyhash respstring: already claimed (user was already claimed)
pub const AUTH_ERROR_ALREADYCLAIMED: &[u8] = b"!19\nerr-already-claimed\n"; pub const AUTH_ERROR_ALREADYCLAIMED: &[u8] = b"!19\nerr-auth-already-claimed\n";
/// Skyhash respcode(10): bad credentials (either bad creds or invalid user) /// Skyhash respcode(10): bad credentials (either bad creds or invalid user)
pub const AUTH_CODE_BAD_CREDENTIALS: &[u8] = b"!2\n10\n"; pub const AUTH_CODE_BAD_CREDENTIALS: &[u8] = b"!2\n10\n";
/// Skyhash respstring: auth is disabled /// Skyhash respstring: auth is disabled
@ -37,7 +37,7 @@ pub const AUTH_CODE_PERMS: &[u8] = b"!2\n11\n";
/// Skyhash respstring: ID is too long /// Skyhash respstring: ID is too long
pub const AUTH_ERROR_TOO_LONG: &[u8] = b"!25\nerr-auth-illegal-username\n"; pub const AUTH_ERROR_TOO_LONG: &[u8] = b"!25\nerr-auth-illegal-username\n";
/// Skyhash respstring: ID is protected/in use /// Skyhash respstring: ID is protected/in use
pub const AUTH_ERROR_FAILED_TO_DELETE_USER: &[u8] = b"!18\nerr-user-delete-fail\n"; pub const AUTH_ERROR_FAILED_TO_DELETE_USER: &[u8] = b"!18\nerr-auth-deluser-fail\n";
/// Auth erros /// Auth erros
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]

@ -65,7 +65,7 @@ async fn claim_root_fail_already_claimed() {
runeq!( runeq!(
con, con,
query!("auth", "claim", crate::TEST_AUTH_ORIGIN_KEY), query!("auth", "claim", crate::TEST_AUTH_ORIGIN_KEY),
Element::RespCode(RespCode::ErrorString("err-already-claimed".to_owned())) Element::RespCode(RespCode::ErrorString("err-auth-already-claimed".to_owned()))
) )
} }

Loading…
Cancel
Save