|
1 | | -"""Token endpoint implementation.""" |
| 1 | +"""Token endpoint.""" |
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
|
21 | 21 | TokenResponse, |
22 | 22 | ) |
23 | 23 | from diracx.logic.auth.token import create_token |
24 | | -from diracx.logic.auth.token import legacy_exchange as legacy_exchange_bl |
25 | | -from diracx.logic.auth.token import token as token_bl |
| 24 | +from diracx.logic.auth.token import get_oidc_token as get_oidc_token_bl |
| 25 | +from diracx.logic.auth.token import ( |
| 26 | + perform_legacy_exchange as perform_legacy_exchange_bl, |
| 27 | +) |
26 | 28 | from diracx.routers.access_policies import BaseAccessPolicy |
27 | 29 |
|
28 | 30 | from ..dependencies import AuthDB, AuthSettings, AvailableSecurityProperties, Config |
@@ -66,7 +68,7 @@ async def mint_token( |
66 | 68 |
|
67 | 69 |
|
68 | 70 | @router.post("/token") |
69 | | -async def token( |
| 71 | +async def get_oidc_token( |
70 | 72 | # Autorest does not support the GrantType annotation |
71 | 73 | # We need to specify each option with Literal[] |
72 | 74 | grant_type: Annotated[ |
@@ -108,7 +110,7 @@ async def token( |
108 | 110 | This is the endpoint being pulled by dirac-login when doing the device flow. |
109 | 111 | """ |
110 | 112 | try: |
111 | | - access_payload, refresh_payload = await token_bl( |
| 113 | + access_payload, refresh_payload = await get_oidc_token_bl( |
112 | 114 | grant_type, |
113 | 115 | client_id, |
114 | 116 | auth_db, |
@@ -164,7 +166,7 @@ async def token( |
164 | 166 |
|
165 | 167 |
|
166 | 168 | @router.get("/legacy-exchange", include_in_schema=False) |
167 | | -async def legacy_exchange( |
| 169 | +async def perform_legacy_exchange( |
168 | 170 | preferred_username: str, |
169 | 171 | scope: str, |
170 | 172 | authorization: Annotated[str, Header()], |
@@ -207,7 +209,7 @@ async def legacy_exchange( |
207 | 209 | ) |
208 | 210 |
|
209 | 211 | try: |
210 | | - access_payload, refresh_payload = await legacy_exchange_bl( |
| 212 | + access_payload, refresh_payload = await perform_legacy_exchange_bl( |
211 | 213 | expected_api_key=expected_api_key, |
212 | 214 | preferred_username=preferred_username, |
213 | 215 | scope=scope, |
|
0 commit comments