mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 11:38:55 +00:00
feature: oidc group membership mapping
This commit is contained in:
@@ -6,6 +6,8 @@ import { EFilterReturnedUsers, TGroup, TGroupUser } from "./types";
|
||||
|
||||
export const groupKeys = {
|
||||
getGroupById: (groupId: string) => [{ groupId }, "group"] as const,
|
||||
isGroupMembershipManagementDisabled: (orgId: string) =>
|
||||
["group-memberships-management-disabled", orgId] as const,
|
||||
allGroupUserMemberships: () => ["group-user-memberships"] as const,
|
||||
forGroupUserMemberships: (slug: string) =>
|
||||
[...groupKeys.allGroupUserMemberships(), slug] as const,
|
||||
|
||||
@@ -20,7 +20,8 @@ export const useUpdateOIDCConfig = () => {
|
||||
clientId,
|
||||
clientSecret,
|
||||
isActive,
|
||||
orgSlug
|
||||
orgSlug,
|
||||
manageGroupMemberships
|
||||
}: {
|
||||
allowedEmailDomains?: string;
|
||||
issuer?: string;
|
||||
@@ -34,6 +35,7 @@ export const useUpdateOIDCConfig = () => {
|
||||
isActive?: boolean;
|
||||
configurationType?: string;
|
||||
orgSlug: string;
|
||||
manageGroupMemberships?: boolean;
|
||||
}) => {
|
||||
const { data } = await apiRequest.patch("/api/v1/sso/oidc/config", {
|
||||
issuer,
|
||||
@@ -47,7 +49,8 @@ export const useUpdateOIDCConfig = () => {
|
||||
clientId,
|
||||
orgSlug,
|
||||
clientSecret,
|
||||
isActive
|
||||
isActive,
|
||||
manageGroupMemberships
|
||||
});
|
||||
|
||||
return data;
|
||||
@@ -74,7 +77,8 @@ export const useCreateOIDCConfig = () => {
|
||||
clientId,
|
||||
clientSecret,
|
||||
isActive,
|
||||
orgSlug
|
||||
orgSlug,
|
||||
manageGroupMemberships
|
||||
}: {
|
||||
issuer?: string;
|
||||
configurationType: string;
|
||||
@@ -88,6 +92,7 @@ export const useCreateOIDCConfig = () => {
|
||||
isActive: boolean;
|
||||
orgSlug: string;
|
||||
allowedEmailDomains?: string;
|
||||
manageGroupMemberships?: boolean;
|
||||
}) => {
|
||||
const { data } = await apiRequest.post("/api/v1/sso/oidc/config", {
|
||||
issuer,
|
||||
@@ -101,7 +106,8 @@ export const useCreateOIDCConfig = () => {
|
||||
clientId,
|
||||
clientSecret,
|
||||
isActive,
|
||||
orgSlug
|
||||
orgSlug,
|
||||
manageGroupMemberships
|
||||
});
|
||||
|
||||
return data;
|
||||
|
||||
@@ -5,7 +5,9 @@ import { apiRequest } from "@app/config/request";
|
||||
import { OIDCConfigData } from "./types";
|
||||
|
||||
export const oidcConfigKeys = {
|
||||
getOIDCConfig: (orgSlug: string) => [{ orgSlug }, "organization-oidc"] as const
|
||||
getOIDCConfig: (orgSlug: string) => [{ orgSlug }, "organization-oidc"] as const,
|
||||
getOIDCManageGroupMembershipsEnabled: (orgId: string) =>
|
||||
["oidc-manage-group-memberships", orgId] as const
|
||||
};
|
||||
|
||||
export const useGetOIDCConfig = (orgSlug: string) => {
|
||||
@@ -25,3 +27,16 @@ export const useGetOIDCConfig = (orgSlug: string) => {
|
||||
enabled: true
|
||||
});
|
||||
};
|
||||
|
||||
export const useOidcManageGroupMembershipsEnabled = (orgId: string) => {
|
||||
return useQuery({
|
||||
queryKey: oidcConfigKeys.getOIDCManageGroupMembershipsEnabled(orgId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ isEnabled: boolean }>(
|
||||
`/api/v1/sso/oidc/manage-group-memberships?orgId=${orgId}`
|
||||
);
|
||||
|
||||
return data.isEnabled;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -12,4 +12,5 @@ export type OIDCConfigData = {
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
allowedEmailDomains?: string;
|
||||
manageGroupMemberships: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user