ExUtcp.Auth (ex_utcp v0.3.2)

Copy Markdown View Source

Authentication mechanisms for UTCP providers.

This module handles various authentication types including API key, Basic Auth, and OAuth2.

Summary

Functions

Applies API key authentication to headers.

Applies Basic authentication to headers.

Applies authentication to HTTP headers based on the auth configuration.

Creates a new API key authentication configuration.

Creates a new Basic authentication configuration.

Creates a new OAuth2 authentication configuration.

Validates an authentication configuration.

Functions

apply_api_key_auth(auth, headers)

@spec apply_api_key_auth(ExUtcp.Types.api_key_auth(), map()) :: map()

Applies API key authentication to headers.

apply_basic_auth(auth, headers)

@spec apply_basic_auth(ExUtcp.Types.basic_auth(), map()) :: map()

Applies Basic authentication to headers.

apply_to_headers(auth, headers)

@spec apply_to_headers(ExUtcp.Types.auth(), map()) :: map()

Applies authentication to HTTP headers based on the auth configuration.

new_api_key_auth(opts)

@spec new_api_key_auth(keyword()) :: ExUtcp.Types.api_key_auth()

Creates a new API key authentication configuration.

new_basic_auth(opts)

@spec new_basic_auth(keyword()) :: ExUtcp.Types.basic_auth()

Creates a new Basic authentication configuration.

new_oauth2_auth(opts)

@spec new_oauth2_auth(keyword()) :: ExUtcp.Types.oauth2_auth()

Creates a new OAuth2 authentication configuration.

validate_auth(auth)

@spec validate_auth(ExUtcp.Types.auth()) :: :ok | {:error, String.t()}

Validates an authentication configuration.