nova_auth_session (nova_auth v0.2.0)

View Source

Session token lifecycle management. Handles creating, validating, and deleting session tokens backed by the configured Kura repo.

Summary

Functions

Delete all tokens for a user across all contexts.

Delete all tokens for a user within a specific context.

Delete a specific session token (logout).

Create a new session token for a user and store the hash in the database.

Look up a user by their raw session token, checking validity.

Functions

delete_all_user_tokens(AuthMod, UserId)

-spec delete_all_user_tokens(module(), term()) -> ok.

Delete all tokens for a user across all contexts.

delete_all_user_tokens(AuthMod, UserId, Context)

-spec delete_all_user_tokens(module(), term(), binary()) -> ok.

Delete all tokens for a user within a specific context.

delete_session_token(AuthMod, SessionToken)

-spec delete_session_token(module(), binary()) -> ok.

Delete a specific session token (logout).

generate_session_token(AuthMod, User)

-spec generate_session_token(module(), map()) -> {ok, binary()} | {error, term()}.

Create a new session token for a user and store the hash in the database.

get_user_by_session_token(AuthMod, SessionToken)

-spec get_user_by_session_token(module(), binary()) -> {ok, map()} | {error, term()}.

Look up a user by their raw session token, checking validity.