# `ExMCP.Authorization.Validator`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/authorization/validator.ex#L1)

Validation functions for OAuth 2.1 parameters and endpoints.

This module contains all validation logic extracted from the main
Authorization module, focusing on security and compliance checks.

# `validate_client_credentials`

```elixir
@spec validate_client_credentials(String.t(), String.t() | nil) ::
  :ok | {:error, term()}
```

Validates that client credentials are properly formed.

Ensures client IDs and secrets meet security requirements.

# `validate_grant_params`

```elixir
@spec validate_grant_params(String.t(), map()) :: :ok | {:error, term()}
```

Validates OAuth grant type parameters.

Ensures all required parameters are present for the specific grant type.

# `validate_https_endpoint`

```elixir
@spec validate_https_endpoint(String.t()) :: :ok | {:error, term()}
```

Validates that an endpoint URL uses HTTPS (except localhost).

OAuth 2.1 requires HTTPS for all authorization endpoints except
localhost for development purposes.

# `validate_redirect_uri`

```elixir
@spec validate_redirect_uri(String.t()) :: :ok | {:error, term()}
```

Validates that a redirect URI is properly formed and secure.

Prevents open redirect vulnerabilities by ensuring redirect URIs
are properly validated.

# `validate_resource_parameters`

```elixir
@spec validate_resource_parameters(map()) :: :ok | {:error, term()}
```

Validates resource parameters according to RFC 8707.

Resource parameters must be valid URIs without fragments.

# `validate_scopes`

```elixir
@spec validate_scopes([String.t()]) :: :ok | {:error, term()}
```

Validates that scopes are properly formatted.

Scopes must be space-separated strings according to OAuth 2.1.

---

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