mirror of
https://github.com/tale/headplane.git
synced 2026-08-27 15:37:04 +00:00
feat: do partial client method validation
This commit is contained in:
+8
-3
@@ -2,7 +2,8 @@ import { redirect } from 'react-router';
|
|||||||
import {
|
import {
|
||||||
authorizationCodeGrantRequest,
|
authorizationCodeGrantRequest,
|
||||||
calculatePKCECodeChallenge,
|
calculatePKCECodeChallenge,
|
||||||
type Client,
|
Client,
|
||||||
|
ClientAuthenticationMethod,
|
||||||
discoveryRequest,
|
discoveryRequest,
|
||||||
generateRandomCodeVerifier,
|
generateRandomCodeVerifier,
|
||||||
generateRandomNonce,
|
generateRandomNonce,
|
||||||
@@ -34,10 +35,12 @@ export async function startOidc(oidc: OidcConfig, req: Request) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Properly validate the method is a valid type
|
||||||
|
const method = oidc.method as ClientAuthenticationMethod;
|
||||||
const issuerUrl = new URL(oidc.issuer);
|
const issuerUrl = new URL(oidc.issuer);
|
||||||
const oidcClient = {
|
const oidcClient = {
|
||||||
client_id: oidc.client,
|
client_id: oidc.client,
|
||||||
token_endpoint_auth_method: oidc.method,
|
token_endpoint_auth_method: method
|
||||||
} satisfies Client;
|
} satisfies Client;
|
||||||
|
|
||||||
const response = await discoveryRequest(issuerUrl);
|
const response = await discoveryRequest(issuerUrl);
|
||||||
@@ -88,11 +91,13 @@ export async function finishOidc(oidc: OidcConfig, req: Request) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Properly validate the method is a valid type
|
||||||
|
const method = oidc.method as ClientAuthenticationMethod;
|
||||||
const issuerUrl = new URL(oidc.issuer);
|
const issuerUrl = new URL(oidc.issuer);
|
||||||
const oidcClient = {
|
const oidcClient = {
|
||||||
client_id: oidc.client,
|
client_id: oidc.client,
|
||||||
client_secret: oidc.secret,
|
client_secret: oidc.secret,
|
||||||
token_endpoint_auth_method: oidc.method,
|
token_endpoint_auth_method: method,
|
||||||
} satisfies Client;
|
} satisfies Client;
|
||||||
|
|
||||||
const response = await discoveryRequest(issuerUrl);
|
const response = await discoveryRequest(issuerUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user