KeenAuth.User (KeenAuth v1.0.1)

Copy Markdown View Source

Represents an authenticated user in KeenAuth.

This struct is the normalized representation of a user after being processed by a mapper. All OAuth providers are mapped to this common structure.

Fields

  • :user_id - Unique identifier from the OAuth provider
  • :username - Username (may be nil for some providers)
  • :display_name - Human-readable name
  • :email - Email address
  • :roles - List of role strings (populated by processor)
  • :permissions - List of permission strings (populated by processor)
  • :groups - List of group strings (populated by processor)

Example

%KeenAuth.User{
  user_id: "abc123",
  username: "jdoe",
  display_name: "John Doe",
  email: "john@example.com",
  roles: ["admin"],
  permissions: ["read", "write"],
  groups: ["engineering"]
}

Summary

Functions

Creates a new User struct from a map of attributes.

Types

t()

@type t() :: %KeenAuth.User{
  display_name: binary(),
  email: binary(),
  groups: [binary()],
  permissions: [binary()],
  roles: [binary()],
  user_id: binary(),
  username: binary() | nil
}

Functions

new(params \\ %{})

@spec new(map()) :: t()

Creates a new User struct from a map of attributes.

Example

KeenAuth.User.new(%{
  user_id: "123",
  email: "user@example.com",
  display_name: "User"
})