Feat: Org Scoped JWT Tokens

This commit is contained in:
Daniel Hougaard
2024-03-17 18:48:09 +01:00
parent 4f80234afa
commit 29b2b12ec7
+2 -1
View File
@@ -21,7 +21,7 @@ export const registerAuthRoutes = async (server: FastifyZodProvider) => {
}) })
} }
}, },
onRequest: verifyAuth([AuthMode.JWT]), onRequest: verifyAuth([AuthMode.JWT], { requireOrg: false }),
handler: async (req, res) => { handler: async (req, res) => {
const appCfg = getConfig(); const appCfg = getConfig();
if (req.auth.authMode === AuthMode.JWT) { if (req.auth.authMode === AuthMode.JWT) {
@@ -85,6 +85,7 @@ export const registerAuthRoutes = async (server: FastifyZodProvider) => {
const token = jwt.sign( const token = jwt.sign(
{ {
authMethod: decodedToken.authMethod,
authTokenType: AuthTokenType.ACCESS_TOKEN, authTokenType: AuthTokenType.ACCESS_TOKEN,
userId: decodedToken.userId, userId: decodedToken.userId,
tokenVersionId: tokenVersion.id, tokenVersionId: tokenVersion.id,