# This file was auto-generated by Fern from our API Definition.

from ...core.unchecked_base_model import UncheckedBaseModel
from .http_receiver_token_credential import HttpReceiverTokenCredential
import typing
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class HttpReceiverTokenAuthConfig(UncheckedBaseModel):
    """
    Token-based authentication for API keys, bearer tokens, and custom token schemes. By default, sends token in Authorization header as a Bearer token. Use the **Header Name** and **Template** options to override this behavior.
    """

    credential: HttpReceiverTokenCredential
    header_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    HTTP header name to use when sending the token.
    """

    template: typing.Optional[str] = pydantic.Field(default=None)
    """
    Template to use when building the HTTP header value. Use `{{token}}` as a placeholder for the secret token value. This will be substituted at runtime. Do not store any secrets in this field.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
            extra="allow"
        )  # type: ignore # Pydantic v2
    else:

        class Config:
            smart_union = True
            extra = pydantic.Extra.allow
