Raxol.Security.UserContext.ContextServer (Raxol v2.0.1)

View Source

GenServer implementation for Security User Context management.

This server manages user context state for security-related operations, eliminating Process dictionary usage in encryption and security modules.

Features

  • Current user tracking
  • Session management
  • Security context storage
  • Audit trail support

Summary

Functions

Records an audit event for the current user.

Returns a child specification for this server.

Clears all context for the calling process.

Clears the current user for the calling process.

Gets all context for the calling process.

Gets security context for the calling process.

Gets the current user for the calling process. Returns "system" if no user is set.

Sets additional security context for the calling process.

Sets the current user for the calling process.

Functions

audit_log(action, details \\ %{})

Records an audit event for the current user.

child_spec(init_arg)

Returns a child specification for this server.

clear_context()

Clears all context for the calling process.

clear_current_user()

Clears the current user for the calling process.

get_all_context()

Gets all context for the calling process.

get_context(key, default \\ nil)

Gets security context for the calling process.

get_current_user()

Gets the current user for the calling process. Returns "system" if no user is set.

set_context(key, value)

Sets additional security context for the calling process.

set_current_user(user_id)

Sets the current user for the calling process.

start_link(init_opts \\ [])