diff --git a/Dockerfile b/Dockerfile index 3c22eda2..8040ebdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-alpine as builder +FROM node:16-alpine as builder WORKDIR /app # dependencies @@ -20,4 +20,4 @@ EXPOSE 9229 ENV HOST 0.0.0.0 ENV PORT 9229 VOLUME /app/.cognito -ENTRYPOINT ["node", "/app/start.js"] \ No newline at end of file +ENTRYPOINT ["node", "/app/start.js"] diff --git a/integration-tests/server.test.ts b/integration-tests/server.test.ts index dede7dcd..cd954988 100644 --- a/integration-tests/server.test.ts +++ b/integration-tests/server.test.ts @@ -126,4 +126,20 @@ describe("HTTP server", () => { }); }); }); + + describe("OpenId Configuration Endpoint", () => { + it("responds with open id configuration", async () => { + const server = createServer(jest.fn(), MockLogger as any); + + const response = await supertest(server.application).get( + "/any-user-pool/.well-known/openid-configuration" + ); + expect(response.status).toEqual(200); + expect(response.body).toEqual({ + id_token_signing_alg_values_supported: ["RS256"], + jwks_uri: `http://localhost:9229/any-user-pool/.well-known/jwks.json`, + issuer: `http://localhost:9229/any-user-pool`, + }); + }); + }); }); diff --git a/src/server/server.ts b/src/server/server.ts index 227f94a5..ecc98580 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -55,6 +55,14 @@ export const createServer = ( }); }); + app.get("/:userPoolId/.well-known/openid-configuration", (req, res) => { + res.status(200).json({ + id_token_signing_alg_values_supported: ["RS256"], + jwks_uri: `http://localhost:9229/${req.params.userPoolId}/.well-known/jwks.json`, + issuer: `http://localhost:9229/${req.params.userPoolId}`, + }); + }); + app.get("/health", (req, res) => { res.status(200).json({ ok: true }); });