fix(oidc): migrate OIDC endpoints and internal handlers to use typedserver IRequestContext and update dependencies
This commit is contained in:
+12
-12
@@ -28,40 +28,40 @@ export const runCli = async () => {
|
||||
typedserver.options.spaFallback = true;
|
||||
|
||||
// OIDC Discovery endpoint
|
||||
typedserver.addRoute('/.well-known/openid-configuration', 'GET', async (req) => {
|
||||
typedserver.addRoute('/.well-known/openid-configuration', 'GET', async (ctx) => {
|
||||
return new Response(JSON.stringify(reception.oidcManager.getDiscoveryDocument()), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
});
|
||||
|
||||
// JWKS endpoint
|
||||
typedserver.addRoute('/.well-known/jwks.json', 'GET', async (req) => {
|
||||
typedserver.addRoute('/.well-known/jwks.json', 'GET', async (ctx) => {
|
||||
return new Response(JSON.stringify(reception.oidcManager.getJwks()), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
});
|
||||
|
||||
// OAuth Authorization endpoint
|
||||
typedserver.addRoute('/oauth/authorize', 'GET', async (req) => {
|
||||
return reception.oidcManager.handleAuthorize(req);
|
||||
typedserver.addRoute('/oauth/authorize', 'GET', async (ctx) => {
|
||||
return reception.oidcManager.handleAuthorize(ctx);
|
||||
});
|
||||
|
||||
// OAuth Token endpoint
|
||||
typedserver.addRoute('/oauth/token', 'POST', async (req) => {
|
||||
return reception.oidcManager.handleToken(req);
|
||||
typedserver.addRoute('/oauth/token', 'POST', async (ctx) => {
|
||||
return reception.oidcManager.handleToken(ctx);
|
||||
});
|
||||
|
||||
// OAuth UserInfo endpoint (GET and POST)
|
||||
typedserver.addRoute('/oauth/userinfo', 'GET', async (req) => {
|
||||
return reception.oidcManager.handleUserInfo(req);
|
||||
typedserver.addRoute('/oauth/userinfo', 'GET', async (ctx) => {
|
||||
return reception.oidcManager.handleUserInfo(ctx);
|
||||
});
|
||||
typedserver.addRoute('/oauth/userinfo', 'POST', async (req) => {
|
||||
return reception.oidcManager.handleUserInfo(req);
|
||||
typedserver.addRoute('/oauth/userinfo', 'POST', async (ctx) => {
|
||||
return reception.oidcManager.handleUserInfo(ctx);
|
||||
});
|
||||
|
||||
// OAuth Revocation endpoint
|
||||
typedserver.addRoute('/oauth/revoke', 'POST', async (req) => {
|
||||
return reception.oidcManager.handleRevoke(req);
|
||||
typedserver.addRoute('/oauth/revoke', 'POST', async (ctx) => {
|
||||
return reception.oidcManager.handleRevoke(ctx);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user