# `OCSF.AuthProtocol`
[🔗](https://github.com/docjerem/ocsf/blob/v0.1.0/lib/ocsf/auth_protocol.ex#L1)

OCSF authentication protocol identifiers.

Maps authentication protocol names to their OCSF 1.8 numeric
identifiers. Used to populate the `auth_protocol_id` field on
Authentication events.

See the OCSF
[auth_protocol_id](https://schema.ocsf.io/1.8.0/objects/authentication?caption=auth_protocol_id)
definition.

## Values

| Name                      | ID |
|---------------------------|----|
| `:Unknown`                | 0  |
| `:NTLM`                  | 1  |
| `:Kerberos`              | 2  |
| `:Digest`                | 3  |
| `:OpenID`                | 4  |
| `:SAML`                  | 5  |
| `:"OAUTH 2.0"`           | 6  |
| `:PAP`                   | 7  |
| `:CHAP`                  | 8  |
| `:EAP`                   | 9  |
| `:RADIUS`                | 10 |
| `:"Basic Authentication"`| 11 |
| `:LDAP`                  | 12 |
| `:Other`                 | 99 |

See `OCSF.Class` and `OCSF.Activity` for authentication event classes
and activities.

# `ecto_values`

```elixir
@spec ecto_values() :: keyword()
```

Return values formatted for `Ecto.Enum`.

## Examples

    iex> {:"OAUTH 2.0", 6} in OCSF.AuthProtocol.ecto_values()
    true

# `name`

```elixir
@spec name(integer()) :: atom() | nil
```

Return the name atom for the given numeric identifier.

## Examples

    iex> OCSF.AuthProtocol.name(5)
    :SAML

    iex> OCSF.AuthProtocol.name(6)
    :"OAUTH 2.0"

    iex> OCSF.AuthProtocol.name(42)
    nil

# `uid`

```elixir
@spec uid(atom()) :: integer() | nil
```

Return the numeric identifier for the given name atom.

## Examples

    iex> OCSF.AuthProtocol.uid(:SAML)
    5

    iex> OCSF.AuthProtocol.uid(:"OAUTH 2.0")
    6

    iex> OCSF.AuthProtocol.uid(:NonExistent)
    nil

# `valid?`

```elixir
@spec valid?(atom() | integer()) :: boolean()
```

Return true if the given name or identifier is valid.

## Examples

    iex> OCSF.AuthProtocol.valid?(:SAML)
    true

    iex> OCSF.AuthProtocol.valid?(5)
    true

    iex> OCSF.AuthProtocol.valid?(:NonExistent)
    false

# `values`

```elixir
@spec values() :: [{atom(), integer()}]
```

Return all values as a keyword list.

## Examples

    iex> {:"OAUTH 2.0", 6} in OCSF.AuthProtocol.values()
    true

---

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