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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
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
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
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. |
Source code in docs/rs-server/services/common/rs_server_common/authentication/external_authentication_config.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |