mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 07:30:20 +00:00
Pass Okta SCIM 2.0 SPEC Test
This commit is contained in:
@@ -58,3 +58,20 @@ export class BadRequestError extends Error {
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
export class ScimRequestError extends Error {
|
||||
name: string;
|
||||
schemas: string[];
|
||||
detail: string;
|
||||
status: number;
|
||||
error: unknown;
|
||||
|
||||
constructor({ name, error, detail, status }: { message?: string; name?: string; error?: unknown, detail: string, status: number }) {
|
||||
super(detail ?? "The request is invalid");
|
||||
this.name = name || "ScimRequestError";
|
||||
this.schemas = ["urn:ietf:params:scim:api:messages:2.0:Error"];
|
||||
this.error = error;
|
||||
this.detail = detail;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { TScimUser } from "./types";
|
||||
|
||||
export const createScimUser = ({
|
||||
userId,
|
||||
firstName,
|
||||
lastName,
|
||||
email
|
||||
}: {
|
||||
userId: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
}): TScimUser => {
|
||||
let scimUser = {
|
||||
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
|
||||
"id": userId,
|
||||
"userName": email,
|
||||
"displayName": `${firstName} ${lastName}`,
|
||||
"name": {
|
||||
"givenName": firstName,
|
||||
"middleName": null,
|
||||
"familyName": lastName
|
||||
},
|
||||
"emails":
|
||||
[{
|
||||
"primary": true,
|
||||
"value": email,
|
||||
"type": "work"
|
||||
}],
|
||||
"active": true,
|
||||
"groups": [],
|
||||
"meta": {
|
||||
"resourceType": "User",
|
||||
"location": null
|
||||
}
|
||||
};
|
||||
|
||||
return scimUser;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export { TScimUser } from "./types";
|
||||
export {
|
||||
createScimUser
|
||||
} from "./fns";
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
export type TScimUser = {
|
||||
schemas: string[];
|
||||
id: string;
|
||||
userName: string;
|
||||
displayName: string;
|
||||
name: {
|
||||
givenName: string;
|
||||
middleName: null;
|
||||
familyName: string;
|
||||
};
|
||||
emails: {
|
||||
primary: boolean;
|
||||
value: string;
|
||||
type: string;
|
||||
}[];
|
||||
active: boolean;
|
||||
groups: string[];
|
||||
meta: {
|
||||
resourceType: string;
|
||||
location: null;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user