rs_server_common/authentication/apikey.md¶
API key authentication functions implementation.
Note: calls https://github.com/csgroup-oss/apikey-manager
__apikey_security_cached(apikey_value)
async
¶
Cached version of apikey_security. Cache an infinite (sys.maxsize) number of results for 120 seconds.
This function serves as a cached version of apikey_security. It retrieves user access control information from the User Authentication and Authorization Control (UAC) manager and caches the result for performance optimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
apikey_value
|
str
|
The API key value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AuthInfo |
AuthInfo
|
Authentication information from the keycloak account, associated to the api key. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If there is an error connecting to the UAC manager or if the UAC manager returns an error. |
Source code in docs/rs-server/services/common/rs_server_common/authentication/apikey.py
apikey_security(apikey_value='')
async
¶
Check the api key validity, passed as an HTTP header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
apikey_value
|
Security
|
API key passed in HTTP header |
''
|
Returns:
| Type | Description |
|---|---|
AuthInfo | None
|
Authentication information from the keycloak account, associated to the api key. |
AuthInfo | None
|
Or None if no api key is provided. |