Skip to content

Commit

Permalink
fix: oidc should throw more specific error when cookie is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
Tethik committed Sep 29, 2023
1 parent 174ab4f commit 3415160
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/oidc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export class OIDCIdentityProvider implements IdentityProvider {
response_types: ["code"],
});

const key = await this.sessionSecret.getValue();
if (!key) {
const cryptoKey = await this.sessionSecret.getValue();
if (!cryptoKey) {
throw new Error("No session secret configured for OIDC Auth Provider");
}
this.sessionCryptoKey = key;
this.sessionCryptoKey = cryptoKey;
}

/**
Expand Down Expand Up @@ -147,6 +147,10 @@ export class OIDCIdentityProvider implements IdentityProvider {
throw new Error("Request is undefined or null");
}

if (!ctx.currentRequest.cookies["oidc-code"]) {
throw new Error("oidc-code cookie is not set");
}

const [ct, iv, authTag] =
ctx.currentRequest.cookies["oidc-code"].split(".");
// TODO: make oidc security parameters configurable, since different providers want different things.
Expand Down

0 comments on commit 3415160

Please sign in to comment.