mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 19:28:33 +00:00
refactor: simplify token retrieval by using findById method
This commit is contained in:
@@ -535,10 +535,7 @@ export const identityTokenAuthServiceFactory = ({
|
|||||||
});
|
});
|
||||||
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
|
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
|
||||||
|
|
||||||
const token = await identityAccessTokenDAL.findOne({
|
const token = await identityAccessTokenDAL.findById(tokenId);
|
||||||
[`${TableName.IdentityAccessToken}.id` as "id"]: tokenId,
|
|
||||||
[`${TableName.IdentityAccessToken}.authMethod` as "authMethod"]: IdentityAuthMethod.TOKEN_AUTH
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!token) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` });
|
if (!token) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user