1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Module for authentication related entities.
use cratepico_ffi_authenticate;
use BoxError;
/// # Description
///
/// Tries to authenticate a user with specified password.
/// Authentication method is determined via accessing `_pico_user`
/// system table using `admin` session.
///
/// # FFI
///
/// Uses [`pico_ffi_authenticate`].
///
/// # Errors
///
/// - User was not found in the list of available users.
/// - Authentication method was not initialized for the user.
/// - Username length is greater than `u32`.
/// - Password is not correct for the specified user.
///
/// # Panics
///
/// - Global Raft node is not initialized.
/// - Authentication data is not set for the specified user.
/// - Session of `admin` user is closed.
/// - User `admin` is not found.
/// - User `admin` does not have enough permissions.
/// - Internal error on accessing underlying Tarantool space of `_pico_user` system table.