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`,

This comment has been minimized.

Copy link
@dgadelha

dgadelha Mar 28, 2024

guess localhost:9229 was supposed to come from options

This comment has been minimized.

Copy link
@root0x

root0x Mar 28, 2024

Author Contributor

Yeah you're right. I can submit a pr for that if you want?

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.