1"""Basic Authentication Configuration."""
3from pydantic
import BaseModel, 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 username: str = Field(default=
"", alias=
"Username", description=
"Username for the basic authentication.")
43 _password: str = PrivateAttr(default=
"")
46 """Check if the basic authentication is active.
48 :return: True if the username is not empty, False otherwise.
53 """Set the password for the basic authentication.
55 :param password: Password for the basic authentication.
60 """Get the password for the basic authentication.
62 :return: The password.
67class OAuth(BaseModel):
68 """Open Authentication Configuration.
70 :param BaseModel: Pydantic BaseModel for data validation.
73 token_url: str = Field(default=
"", alias=
"TokenUrl", description=
"Endpoint URL for the token request.")
74 client_id: str = Field(default=
"", alias=
"ClientId", description=
"Client identifier for authentication.")
75 grant_type: str = Field(default=
"client_credentials", alias=
"GrantType", description=
"Grant type for the authentication.")
76 header_name: str = Field(default=
"Authorization", alias=
"HeaderName", description=
"Header name for the authentication.")
77 _client_secret: str = PrivateAttr(default=
"")
80 """Check if the service provider authentication is active.
82 :return: True if the client ID is not empty, False otherwise.
87 """Set the client secret for the authentication.
89 :param client_secret: Client secret for the authentication.
94 """Get the client secret for the authentication.
96 :return: The client secret.
105 """Authentication Configuration.
107 param BaseModel: Pydantic BaseModel for data validation.
110 basic_auth: BasicAuth = Field(default_factory=BasicAuth, alias=
"BasicAuth", description=
"Basic authentication configuration.")
111 o_auth: OAuth = Field(
112 default_factory=OAuth,
114 description=
"Service provider authentication configuration.",
116 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.