Skip to content

Commit

Permalink
Merge pull request ajnart#2002 from catrielmuller/catrielmuller/oidc-…
Browse files Browse the repository at this point in the history
…timeout

OIDC Timeout
  • Loading branch information
ajnart authored Apr 18, 2024
2 parents 8f78184 + e71af87 commit 53d1a57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const zodParsedBoolean = () =>
.default('false')
.transform((value) => trueStrings.includes(value));

const numberSchema = z
.string()
.regex(/\d*/)
.transform((value) => (value === undefined ? undefined : Number(value)))
.optional()

const portSchema = z
.string()
.regex(/\d*/)
Expand Down Expand Up @@ -90,6 +96,7 @@ const env = createEnv({
AUTH_OIDC_OWNER_GROUP: z.string().default('admin'),
AUTH_OIDC_AUTO_LOGIN: zodParsedBoolean(),
AUTH_OIDC_SCOPE_OVERWRITE: z.string().default('openid email profile groups'),
AUTH_OIDC_TIMEOUT: numberSchema.default(3500)
}
: {}),
},
Expand Down Expand Up @@ -149,6 +156,7 @@ const env = createEnv({
AUTH_OIDC_OWNER_GROUP: process.env.AUTH_OIDC_OWNER_GROUP,
AUTH_OIDC_AUTO_LOGIN: process.env.AUTH_OIDC_AUTO_LOGIN,
AUTH_OIDC_SCOPE_OVERWRITE: process.env.AUTH_OIDC_SCOPE_OVERWRITE,
AUTH_OIDC_TIMEOUT: process.env.AUTH_OIDC_TIMEOUT,
DEMO_MODE: process.env.DEMO_MODE,
},
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
Expand Down
3 changes: 3 additions & 0 deletions src/utils/auth/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const createProvider = (headers: OidcRedirectCallbackHeaders): OAuthConfig<Profi
},
},
idToken: true,
httpOptions: {
timeout: env.AUTH_OIDC_TIMEOUT,
},
async profile(profile) {
const user = await adapter.getUserByEmail!(profile.email);

Expand Down

0 comments on commit 53d1a57

Please sign in to comment.