Module auth

Source
Expand description

A set of base functions that are used to do all the underlying work of auth. This includes user and session management.

Structs§

Credentials
Basic information about a user. Note that realm can be a arbitrary string and you can use to figure out a group a user belongs to like "admin".
Session
Information about a session. Each session is associated with a user_name.

Enums§

AddUserReturn
Error return type of add_user
DeleteUserReturn
EndSessionReturn
SessionGeneratedErr
Error return type of error in result from generate_session
SessionInvalided
Return type of invalidate_session
SessionValidated
Return type of validate_session
UserValidatedReturn
Error return type of validate_user

Constants§

SESSION_VALID_FOR_SECONDS

Functions§

add_user
add_user
connect_to_db_get_pool
Provides a connection to a postgres server. This requires DATABASE_URL to be set in .env file.
delete_user
delete_user
end_sessions
end_sessions
generate_session
Will create a session for the provided user. The users information is stored in credentials. Once the session is generated it will be stored in the DB. The validity and state of the session can be changed later with validate_session and invalidate_session.
invalidate_session
invalidate_session
validate_session
validate_session
validate_user
validate_user