mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
feat(core): add GET /configs/jwt-customizer API
This commit is contained in:
parent
ce2abe740c
commit
74a70c068d
4 changed files with 45 additions and 0 deletions
|
@ -168,6 +168,25 @@
|
|||
"description": "The JWT customizer does not exist."
|
||||
}
|
||||
}
|
||||
},
|
||||
"get": {
|
||||
"summary": "Get JWT customizer",
|
||||
"description": "Get the JWT customizer for the given token type.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "tokenType",
|
||||
"description": "The token type to get the JWT customizer for."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The JWT customizer."
|
||||
},
|
||||
"404": {
|
||||
"description": "The JWT customizer does not exist."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,4 +275,13 @@ describe('configs routes', () => {
|
|||
expect(response.status).toEqual(200);
|
||||
expect(response.body).toEqual(mockJwtCustomizerConfigForAccessToken.value);
|
||||
});
|
||||
|
||||
it('GET /configs/jwt-customizer/:tokenType should return the record', async () => {
|
||||
logtoConfigLibraries.getJwtCustomizer.mockResolvedValueOnce(
|
||||
mockJwtCustomizerConfigForAccessToken
|
||||
);
|
||||
const response = await routeRequester.get('/configs/jwt-customizer/access-token');
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.body).toEqual(mockJwtCustomizerConfigForAccessToken.value);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -81,9 +81,21 @@ const getRedactedOidcKeyResponse = async (
|
|||
export default function logtoConfigRoutes<T extends AuthedRouter>(
|
||||
...[router, { queries, logtoConfigs, invalidateCache }]: RouterInitArgs<T>
|
||||
) {
|
||||
<<<<<<< HEAD
|
||||
const { getAdminConsoleConfig, getRowsByKeys, updateAdminConsoleConfig, updateOidcConfigsByKey } =
|
||||
queries.logtoConfigs;
|
||||
const { getOidcConfigs, upsertJwtCustomizer, getJwtCustomizer } = logtoConfigs;
|
||||
=======
|
||||
const {
|
||||
getAdminConsoleConfig,
|
||||
getRowsByKeys,
|
||||
insertJwtCustomizer,
|
||||
updateAdminConsoleConfig,
|
||||
updateOidcConfigsByKey,
|
||||
getJwtCustomizer,
|
||||
} = queries.logtoConfigs;
|
||||
const { getOidcConfigs } = logtoConfigs;
|
||||
>>>>>>> 8086c9bc6 (feat(core): add GET /configs/jwt-customizer API)
|
||||
|
||||
router.get(
|
||||
'/configs/admin-console',
|
||||
|
|
|
@ -45,3 +45,8 @@ export const getJwtCustomizer = async (keyTypePath: 'access-token' | 'client-cre
|
|||
authedAdminApi
|
||||
.get(`configs/jwt-customizer/${keyTypePath}`)
|
||||
.json<JwtCustomizerAccessToken | JwtCustomizerClientCredentials>();
|
||||
|
||||
export const getJwtCustomizer = async (keyType: LogtoJwtTokenKeyType) =>
|
||||
authedAdminApi
|
||||
.get(`configs/jwt-customizer/${keyType}`)
|
||||
.json<JwtCustomizerAccessToken | JwtCustomizerClientCredentials>();
|
||||
|
|
Loading…
Reference in a new issue