mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 05:19:49 +00:00
Pass Okta SCIM 2.0 SPEC Test
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export {
|
||||
useGetScimToken
|
||||
} from "./queries";
|
||||
export { useGetScimTokens } from "./queries";
|
||||
export {
|
||||
useCreateScimToken,
|
||||
useDeleteScimToken
|
||||
} from "./mutations";
|
||||
@@ -0,0 +1,46 @@
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import {
|
||||
CreateScimTokenDTO,
|
||||
CreateScimTokenRes,
|
||||
DeleteScimTokenDTO
|
||||
} from "./types";
|
||||
import { scimKeys } from "./queries";
|
||||
|
||||
export const useCreateScimToken = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<CreateScimTokenRes, {}, CreateScimTokenDTO>({
|
||||
mutationFn: async ({
|
||||
organizationId,
|
||||
description,
|
||||
ttl
|
||||
}) => {
|
||||
const { data } = await apiRequest.post("/api/v1/scim/scim-tokens", {
|
||||
organizationId,
|
||||
description,
|
||||
ttl
|
||||
});
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(scimKeys.getScimTokens(organizationId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useDeleteScimToken = () => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<CreateScimTokenRes, {}, DeleteScimTokenDTO>({
|
||||
mutationFn: async ({
|
||||
organizationId,
|
||||
scimTokenId
|
||||
}) => {
|
||||
const { data } = await apiRequest.delete(`/api/v1/scim/scim-tokens/${scimTokenId}`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { organizationId }) => {
|
||||
queryClient.invalidateQueries(scimKeys.getScimTokens(organizationId));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,23 +1,22 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { ScimTokenData } from "./types";
|
||||
|
||||
import { GetScimTokenRes } from "./types";
|
||||
|
||||
const scimKeys = {
|
||||
getScimToken: (orgId: string) => [{ orgId }, "organization-scim-token"] as const,
|
||||
export const scimKeys = {
|
||||
getScimTokens: (orgId: string) => [{ orgId }, "organization-scim-token"] as const,
|
||||
};
|
||||
|
||||
export const useGetScimToken = (organizationId: string) => {
|
||||
export const useGetScimTokens = (organizationId: string) => {
|
||||
return useQuery({
|
||||
queryKey: scimKeys.getScimToken(organizationId),
|
||||
queryKey: scimKeys.getScimTokens(organizationId),
|
||||
queryFn: async () => {
|
||||
if (organizationId === "") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { data: { scimToken } } = await apiRequest.get<GetScimTokenRes>(`/api/v1/scim/token/organizations/${organizationId}`);
|
||||
return scimToken;
|
||||
const { data: { scimTokens } } = await apiRequest.get<{ scimTokens: ScimTokenData[] }>(`/api/v1/scim/scim-tokens?organizationId=${organizationId}`);
|
||||
|
||||
return scimTokens;
|
||||
},
|
||||
enabled: true
|
||||
});
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
export type GetScimTokenRes = {
|
||||
export type ScimTokenData = {
|
||||
id: string;
|
||||
ttl: number;
|
||||
description: string;
|
||||
tokenSuffix: string;
|
||||
orgId: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type CreateScimTokenDTO = {
|
||||
organizationId: string;
|
||||
description?: string;
|
||||
ttl?: number;
|
||||
}
|
||||
|
||||
export type DeleteScimTokenDTO = {
|
||||
organizationId: string;
|
||||
scimTokenId: string;
|
||||
}
|
||||
|
||||
export type CreateScimTokenRes = {
|
||||
scimToken: string;
|
||||
};
|
||||
}
|
||||
@@ -18,6 +18,7 @@ export type SubscriptionPlan = {
|
||||
workspacesUsed: number;
|
||||
environmentLimit: number;
|
||||
samlSSO: boolean;
|
||||
scim: boolean;
|
||||
status:
|
||||
| "incomplete"
|
||||
| "incomplete_expired"
|
||||
|
||||
Reference in New Issue
Block a user