|
11 | 11 | import uvicorn |
12 | 12 | from common import configuration |
13 | 13 | from common import utils |
14 | | -from common.exceptions import DSKEException, EncryptorNotRegisteredForClientError |
| 14 | +from common.exceptions import DSKEException, MissingAuthorizationHeaderError |
15 | 15 | from .client import Client |
16 | 16 |
|
17 | 17 |
|
@@ -74,40 +74,40 @@ async def dske_exception_handler(_request: fastapi.Request, exc: DSKEException): |
74 | 74 | @_APP.get(f"/client/{_CLIENT.name}/etsi/api/v1/keys/{{slave_sae_id}}/status") |
75 | 75 | async def get_etsi_status( |
76 | 76 | slave_sae_id: str, |
77 | | - authorization_header: Annotated[str | None, fastapi.Header()] = None, |
| 77 | + authorization: Annotated[str | None, fastapi.Header()] = None, |
78 | 78 | ): |
79 | 79 | """ |
80 | 80 | ETSI QKD 014 API: Status. |
81 | 81 | """ |
82 | | - master_sae_id = calling_sae_id(authorization_header) |
| 82 | + master_sae_id = calling_sae_id(authorization) |
83 | 83 | return await _CLIENT.etsi_status(master_sae_id, slave_sae_id) |
84 | 84 |
|
85 | 85 |
|
86 | 86 | @_APP.get(f"/client/{_CLIENT.name}/etsi/api/v1/keys/{{slave_sae_id}}/enc_keys") |
87 | 87 | async def get_etsi_get_key( |
88 | 88 | slave_sae_id: str, |
89 | 89 | size: int | None = None, |
90 | | - authorization_header: Annotated[str | None, fastapi.Header()] = None, |
| 90 | + authorization: Annotated[str | None, fastapi.Header()] = None, |
91 | 91 | ): |
92 | 92 | """ |
93 | 93 | ETSI QKD 014 API: Get Key. |
94 | 94 | """ |
95 | | - master_sae_id = calling_sae_id(authorization_header) |
| 95 | + master_sae_id = calling_sae_id(authorization) |
96 | 96 | return await _CLIENT.etsi_get_key(master_sae_id, slave_sae_id, size) |
97 | 97 |
|
98 | 98 |
|
99 | 99 | @_APP.get(f"/client/{_CLIENT.name}/etsi/api/v1/keys/{{master_sae_id}}/dec_keys") |
100 | 100 | async def get_eti_get_key_with_key_ids( |
101 | 101 | master_sae_id: str, |
102 | 102 | key_ID: str, |
103 | | - authorization_header: Annotated[str | None, fastapi.Header()] = None, |
| 103 | + authorization: Annotated[str | None, fastapi.Header()] = None, |
104 | 104 | ): |
105 | 105 | """ |
106 | 106 | ETSI QKD 014 API: Get Key with Key IDs. |
107 | 107 | """ |
108 | 108 | # ETSI QKD 014 says that ID in key_ID has to be upper case, which lint doesn't like. |
109 | 109 | # pylint: disable=invalid-name |
110 | | - slave_sae_id = calling_sae_id(authorization_header) |
| 110 | + slave_sae_id = calling_sae_id(authorization) |
111 | 111 | return await _CLIENT.etsi_get_key_with_key_ids(master_sae_id, slave_sae_id, key_ID) |
112 | 112 |
|
113 | 113 |
|
@@ -140,9 +140,8 @@ def calling_sae_id(authorization_header: str | None) -> str: |
140 | 140 | master_sae_id = _CLIENT.encryptor_names[0] |
141 | 141 | else: |
142 | 142 | # There is more than one encryptor, so we cannot guess which one is calling. |
143 | | - raise EncryptorNotRegisteredForClientError( |
| 143 | + raise MissingAuthorizationHeaderError( |
144 | 144 | client_name=_CLIENT.name, |
145 | | - encryptor_name=authorization_header, |
146 | 145 | ) |
147 | 146 | else: |
148 | 147 | master_sae_id = authorization_header.strip() |
|
0 commit comments