mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 01:27:41 +00:00
Feat: Org Scoped JWT Tokens
This commit is contained in:
@@ -9,11 +9,11 @@ export const injectPermission = fp(async (server) => {
|
|||||||
if (!req.auth) return;
|
if (!req.auth) return;
|
||||||
|
|
||||||
if (req.auth.actor === ActorType.USER) {
|
if (req.auth.actor === ActorType.USER) {
|
||||||
req.permission = { type: ActorType.USER, id: req.auth.userId, orgId: req.auth?.orgId };
|
req.permission = { type: ActorType.USER, id: req.auth.userId, orgId: req.auth.orgId };
|
||||||
} else if (req.auth.actor === ActorType.IDENTITY) {
|
} else if (req.auth.actor === ActorType.IDENTITY) {
|
||||||
req.permission = { type: ActorType.IDENTITY, id: req.auth.identityId, orgId: req.auth.orgId };
|
req.permission = { type: ActorType.IDENTITY, id: req.auth.identityId, orgId: req.auth.orgId };
|
||||||
} else if (req.auth.actor === ActorType.SERVICE) {
|
} else if (req.auth.actor === ActorType.SERVICE) {
|
||||||
req.permission = { type: ActorType.SERVICE, id: req.auth.serviceTokenId };
|
req.permission = { type: ActorType.SERVICE, id: req.auth.serviceTokenId, orgId: req.auth.orgId };
|
||||||
} else if (req.auth.actor === ActorType.SCIM_CLIENT) {
|
} else if (req.auth.actor === ActorType.SCIM_CLIENT) {
|
||||||
req.permission = { type: ActorType.SCIM_CLIENT, id: req.auth.scimTokenId, orgId: req.auth.orgId };
|
req.permission = { type: ActorType.SCIM_CLIENT, id: req.auth.scimTokenId, orgId: req.auth.orgId };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user