Skip to content

Commit

Permalink
misc: addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sheensantoscapadngan committed Jun 19, 2024
1 parent 2bc6db1 commit 0100ddf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions backend/src/ee/routes/v1/oidc-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { z } from "zod";

import { OidcConfigsSchema } from "@app/db/schemas/oidc-configs";
import { getConfig } from "@app/lib/config/env";
import { writeLimit } from "@app/server/config/rateLimiter";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";

Expand All @@ -38,7 +38,7 @@ export const registerOidcRouter = async (server: FastifyZodProvider) => {
secret: appCfg.COOKIE_SECRET_SIGN_KEY,
store: redisStore,
cookie: {
secure: false // set to true in production
secure: appCfg.isProductionMode
}
});

Expand Down Expand Up @@ -97,13 +97,13 @@ export const registerOidcRouter = async (server: FastifyZodProvider) => {

if (req.passportUser.isUserCompleted) {
return res.redirect(
`http://localhost:8080/login/sso?token=${encodeURIComponent(req.passportUser.providerAuthToken)}`
`${appCfg.SITE_URL}/login/sso?token=${encodeURIComponent(req.passportUser.providerAuthToken)}`
);
}

// signup
return res.redirect(
`http://localhost:8080/signup/sso?token=${encodeURIComponent(req.passportUser.providerAuthToken)}`
`${appCfg.SITE_URL}/signup/sso?token=${encodeURIComponent(req.passportUser.providerAuthToken)}`
);
}
});
Expand All @@ -124,6 +124,10 @@ export const registerOidcRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/config",
method: "GET",
config: {
rateLimit: readLimit
},
onRequest: verifyAuth([AuthMode.JWT]),
schema: {
querystring: z.object({
orgSlug: z.string().trim()
Expand Down

0 comments on commit 0100ddf

Please sign in to comment.