rs_server_common/authentication/external_authentication_config.md¶
ExternalAuthenticationConfig implementation.
ExternalAuthenticationConfig
dataclass
¶
A configuration class for storing external authentication details, such as those used for API requiring token-based authentication.
Values are read either from the rs-server.yaml (in local mode) or RSPY__TOKEN__ env vars (in cluster mode).
Attributes:
| Name | Type | Description |
|---|---|---|
station_id |
str
|
The unique identifier for the station requesting the token. |
domain |
str
|
The domain for the external service. |
service_name |
str
|
The name of the external service. |
service_url |
str
|
The URL of the external service. |
auth_type |
str
|
The type of authentication used (e.g., 'token', 'basic'). |
Source code in docs/rs-server/services/common/rs_server_common/authentication/external_authentication_config.py
S3ExternalAuthenticationConfig
dataclass
¶
Bases: ExternalAuthenticationConfig
Configuration class for storing external authentication details for S3 buckets.
Attributes:
| Name | Type | Description |
|---|---|---|
station_id |
str
|
The unique identifier for the station requesting the token. |
domain |
str
|
The domain for the external service. |
service_name |
str
|
The name of the external service. |
service_url |
str
|
The URL of the external service. |
auth_type |
str
|
The type of authentication used (e.g., 'token', 'basic'). |
access_key |
str
|
Access key to the S3 storage |
secret_key |
str
|
Secret key to the S3 storage |
trusted_domains |
Optional[str]
|
The list of allowed hosts for http redirection |
Source code in docs/rs-server/services/common/rs_server_common/authentication/external_authentication_config.py
StationExternalAuthenticationConfig
dataclass
¶
Bases: ExternalAuthenticationConfig
Configuration class for storing external authentication details for stations.
Attributes:
| Name | Type | Description |
|---|---|---|
station_id |
str
|
The unique identifier for the station requesting the token. |
domain |
str
|
The domain for the external service. |
service_name |
str
|
The name of the external service. |
service_url |
str
|
The URL of the external service. |
auth_type |
str
|
The type of authentication used (e.g., 'token', 'basic'). |
token_url |
str
|
The URL to request the authentication token. |
grant_type |
str
|
The grant type used for obtaining the token. Currently, only 'password' is available. |
username |
str
|
The username used for authentication. |
password |
str
|
The password used for authentication. |
client_id |
str
|
The client ID used for authentication. |
client_secret |
str
|
The client secret used for authentication. |
scope |
Optional[str]
|
The scope of access requested in the authentication token (if applicable). |
authorization |
Optional[str]
|
Additional authorization header (if required). |
trusted_domains |
Optional[str]
|
The list of allowed hosts for http redirection |
Source code in docs/rs-server/services/common/rs_server_common/authentication/external_authentication_config.py
create_external_auth_config(station_id, station_dict, service_dict)
¶
Create an ExternalAuthenticationConfig object based on the provided station and service dictionaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_id
|
str
|
The unique identifier for the station. |
required |
station_dict
|
Dict[str, Any]
|
Dictionary containing station-specific configuration details. |
required |
service_dict
|
Dict[str, Any]
|
Dictionary containing service-specific configuration details. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ExternalAuthenticationConfig |
StationExternalAuthenticationConfig | S3ExternalAuthenticationConfig | None
|
An object representing the external authentication configuration. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If any required keys are missing in the configuration dictionaries. |