mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 13:27:46 +00:00
Merge pull request #3319 from akhilmhdh/feat/oidc-claims-in-audit-log
Added provider oidc claim in audit log event
This commit is contained in:
@@ -968,6 +968,7 @@ interface LoginIdentityOidcAuthEvent {
|
|||||||
identityId: string;
|
identityId: string;
|
||||||
identityOidcAuthId: string;
|
identityOidcAuthId: string;
|
||||||
identityAccessTokenId: string;
|
identityAccessTokenId: string;
|
||||||
|
oidcClaimsReceived: Record<string, unknown>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ const IdentityOidcAuthResponseSchema = IdentityOidcAuthsSchema.pick({
|
|||||||
caCert: z.string()
|
caCert: z.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const MAX_OIDC_CLAIM_SIZE = 32_768;
|
||||||
|
|
||||||
export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -55,7 +57,7 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
const { identityOidcAuth, accessToken, identityAccessToken, identityMembershipOrg } =
|
const { identityOidcAuth, accessToken, identityAccessToken, identityMembershipOrg, oidcTokenData } =
|
||||||
await server.services.identityOidcAuth.login({
|
await server.services.identityOidcAuth.login({
|
||||||
identityId: req.body.identityId,
|
identityId: req.body.identityId,
|
||||||
jwt: req.body.jwt
|
jwt: req.body.jwt
|
||||||
@@ -69,7 +71,11 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
metadata: {
|
metadata: {
|
||||||
identityId: identityOidcAuth.identityId,
|
identityId: identityOidcAuth.identityId,
|
||||||
identityAccessTokenId: identityAccessToken.id,
|
identityAccessTokenId: identityAccessToken.id,
|
||||||
identityOidcAuthId: identityOidcAuth.id
|
identityOidcAuthId: identityOidcAuth.id,
|
||||||
|
oidcClaimsReceived:
|
||||||
|
Buffer.from(JSON.stringify(oidcTokenData), "utf8").byteLength < MAX_OIDC_CLAIM_SIZE
|
||||||
|
? oidcTokenData
|
||||||
|
: { payload: "Error: Payload exceeds 32KB, provided oidc claim not recorded in audit log." }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export const identityOidcAuthServiceFactory = ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return { accessToken, identityOidcAuth, identityAccessToken, identityMembershipOrg };
|
return { accessToken, identityOidcAuth, identityAccessToken, identityMembershipOrg, oidcTokenData: tokenData };
|
||||||
};
|
};
|
||||||
|
|
||||||
const attachOidcAuth = async ({
|
const attachOidcAuth = async ({
|
||||||
|
|||||||
Reference in New Issue
Block a user