1"""Basic Authentication Configuration."""
3from pydantic
import BaseModel, ConfigDict, Field, PrivateAttr
7 """Bearer Authentication Configuration.
9 :param BaseModel: Pydantic BaseModel for data validation.
12 _token: str = PrivateAttr(default=
"")
15 """Set the bearer token for the authentication.
17 :param token: Bearer token for the authentication.
21 def get_token(self) -> str:
22 """Get the bearer token for the authentication.
24 :return: The bearer token.
29 """Check if the bearer authentication is active.
31 :return: True if the token is not empty, False otherwise.
37 """Basic Authentication Configuration.
39 :param BaseModel: Pydantic BaseModel for data validation.
42 model_config = ConfigDict(populate_by_name=
True, arbitrary_types_allowed=
True)
44 username: str = Field(default=
"", alias=
"Username", description=
"Username for the basic authentication.")
45 _password: str = PrivateAttr(default=
"")
48 """Check if the basic authentication is active.
50 :return: True if the username is not empty, False otherwise.
55 """Set the password for the basic authentication.
57 :param password: Password for the basic authentication.
62 """Get the password for the basic authentication.
64 :return: The password.
69class OAuth(BaseModel):
70 """Open Authentication Configuration.
72 :param BaseModel: Pydantic BaseModel for data validation.
75 model_config = ConfigDict(populate_by_name=
True, arbitrary_types_allowed=
True)
77 token_url: str = Field(default=
"", alias=
"TokenUrl", description=
"Endpoint URL for the token request.")
78 client_id: str = Field(default=
"", alias=
"ClientId", description=
"Client identifier for authentication.")
79 grant_type: str = Field(default=
"client_credentials", alias=
"GrantType", description=
"Grant type for the authentication.")
80 header_name: str = Field(default=
"Authorization", alias=
"HeaderName", description=
"Header name for the authentication.")
81 _client_secret: str = PrivateAttr(default=
"")
84 """Check if the service provider authentication is active.
86 :return: True if the client ID is not empty, False otherwise.
91 """Set the client secret for the authentication.
93 :param client_secret: Client secret for the authentication.
98 """Get the client secret for the authentication.
100 :return: The client secret.
109 """Authentication Configuration.
111 param BaseModel: Pydantic BaseModel for data validation.
114 model_config = ConfigDict(populate_by_name=
True, arbitrary_types_allowed=
True)
116 basic_auth: BasicAuth = Field(default_factory=BasicAuth, alias=
"BasicAuth", description=
"Basic authentication configuration.")
117 o_auth: OAuth = Field(
118 default_factory=OAuth,
120 description=
"Service provider authentication configuration.",
122 bearer_auth: BearerAuth = Field(default_factory=BearerAuth, alias=
"BearerAuth", description=
"Bearer authentication configuration.")
Authentication Configuration.
Basic Authentication Configuration.
None set_password(self, str password)
Set the password for the basic authentication.
str get_password(self)
Get the password for the basic authentication.
bool is_active(self)
Check if the basic authentication is active.
Bearer Authentication Configuration.
None set_token(self, str token)
Set the bearer token for the authentication.
bool is_active(self)
Check if the bearer authentication is active.
Open Authentication Configuration.
bool is_active(self)
Check if the service provider authentication is active.
str get_client_secret(self)
Get the client secret for the authentication.
None set_client_secret(self, str client_secret)
Set the client secret for the authentication.