mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-22 11:58:46 +00:00
feat(sso): refine provider query to include user ID for enhanced security
- Updated the `listProviders` query to filter SSO providers by both organization ID and user ID. - Modified the provider validation logic to ensure that only relevant providers are returned for the authenticated user.
This commit is contained in:
@@ -54,7 +54,10 @@ export const ssoRouter = createTRPCRouter({
|
|||||||
}),
|
}),
|
||||||
listProviders: enterpriseProcedure.query(async ({ ctx }) => {
|
listProviders: enterpriseProcedure.query(async ({ ctx }) => {
|
||||||
const providers = await db.query.ssoProvider.findMany({
|
const providers = await db.query.ssoProvider.findMany({
|
||||||
where: eq(ssoProvider.organizationId, ctx.session.activeOrganizationId),
|
where: and(
|
||||||
|
eq(ssoProvider.organizationId, ctx.session.activeOrganizationId),
|
||||||
|
eq(ssoProvider.userId, ctx.session.userId),
|
||||||
|
),
|
||||||
columns: {
|
columns: {
|
||||||
id: true,
|
id: true,
|
||||||
providerId: true,
|
providerId: true,
|
||||||
@@ -76,6 +79,7 @@ export const ssoRouter = createTRPCRouter({
|
|||||||
and(
|
and(
|
||||||
eq(ssoProvider.providerId, input.providerId),
|
eq(ssoProvider.providerId, input.providerId),
|
||||||
eq(ssoProvider.organizationId, ctx.session.activeOrganizationId),
|
eq(ssoProvider.organizationId, ctx.session.activeOrganizationId),
|
||||||
|
eq(ssoProvider.userId, ctx.session.userId),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.returning({ id: ssoProvider.id });
|
.returning({ id: ssoProvider.id });
|
||||||
|
|||||||
Reference in New Issue
Block a user