Skip to content

Commit

Permalink
fix: add openid-configuration endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
root0x committed Dec 9, 2022
1 parent fcbe763 commit 14a6507
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions integration-tests/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
});
});
});
});
8 changes: 8 additions & 0 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
Expand Down

0 comments on commit 14a6507

Please sign in to comment.