Skip to content

Commit e2671c8

Browse files
committed
add OIDC integration check on access policy check
1 parent b19d121 commit e2671c8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/services/api/src/modules/auth/lib/supertokens-strategy.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ export class SuperTokensCookieBasedSession extends Session {
6363
user.id,
6464
organizationId,
6565
);
66-
const organization = await this.storage.getOrganization({ organizationId });
66+
const [organization, oidcIntegration] = await Promise.all([
67+
this.storage.getOrganization({ organizationId }),
68+
this.storage.getOIDCIntegrationForOrganization({
69+
organizationId,
70+
}),
71+
]);
6772
const organizationMembership = await this.organizationMembers.findOrganizationMembership({
6873
organization,
6974
userId: user.id,
@@ -108,6 +113,10 @@ export class SuperTokensCookieBasedSession extends Session {
108113
];
109114
}
110115

116+
if (oidcIntegration?.oidcUserAccessOnly && this.oidcIntegrationId !== oidcIntegration.id) {
117+
return [];
118+
}
119+
111120
this.logger.debug(
112121
'Translate organization role assignments to policy statements. (userId=%s, organizationId=%s)',
113122
user.id,

0 commit comments

Comments
 (0)