Skip to main content
Version: Next

api_key_auth

File: core/src/utcp/data/auth_implementations/api_key_auth.py

class ApiKeyAuth (Auth)

Documentation

Authentication using an API key.

The key can be provided directly or sourced from an environment variable. Supports placement in headers, query parameters, or cookies.

Attributes

  • auth_type: The authentication type identifier, always "api_key".
  • api_key: The API key for authentication. Values starting with '$' or formatted as '${}' are treated as an injected variable from environment or configuration.
  • var_name: The name of the header, query parameter, or cookie that contains the API key.
  • location: Where to include the API key (header, query parameter, or cookie).

Fields:

  • auth_type: Literal['api_key']
  • api_key: str
  • var_name: str
  • location: Literal['header', 'query', 'cookie']

class ApiKeyAuthSerializer (Serializer[ApiKeyAuth])

No class documentation available

Methods:

to_dict(self, obj: ApiKeyAuth) -> dict

Convert an ApiKeyAuth object to a dictionary.

Args

  • obj: The ApiKeyAuth object to convert.

Returns

The dictionary converted from the ApiKeyAuth object.

validate_dict(self, obj: dict) -> ApiKeyAuth

Validate a dictionary and convert it to an ApiKeyAuth object.

Args

  • obj: The dictionary to validate and convert.

Returns

The ApiKeyAuth object converted from the dictionary.