# `KeenAuth.User`
[🔗](https://github.com/KeenMate/keen_auth/blob/main/lib/user.ex#L1)

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"]
    }

# `t`

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

# `new`

```elixir
@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"
    })

---

*Consult [api-reference.md](api-reference.md) for complete listing*
