@sso-id/node 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/management.d.ts +3 -1
- package/dist/management.js +18 -17
- package/package.json +1 -1
package/dist/management.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface ManagementClientOptions {
|
|
|
7
7
|
/** Management API base URL (defaults to "https://api.sso.id") */
|
|
8
8
|
apiBaseUrl?: string;
|
|
9
9
|
audience?: string;
|
|
10
|
+
/** Optional SCIM 2.0 Bearer token for inbound SCIM calls to /api/scim/v2 */
|
|
11
|
+
scimToken?: string;
|
|
10
12
|
}
|
|
11
13
|
export declare class ManagementClient {
|
|
12
14
|
private readonly authBaseUrl;
|
|
@@ -77,7 +79,7 @@ export declare class ManagementClient {
|
|
|
77
79
|
removeUser: (groupId: string, userId: string) => Promise<void>;
|
|
78
80
|
};
|
|
79
81
|
readonly scim: {
|
|
80
|
-
forConnection: (connectionId?: string) => {
|
|
82
|
+
forConnection: (connectionId?: string, scimBearerToken?: string) => {
|
|
81
83
|
serviceProviderConfig: () => Promise<unknown>;
|
|
82
84
|
schemas: () => Promise<unknown>;
|
|
83
85
|
listUsers: (filter?: string) => Promise<unknown>;
|
package/dist/management.js
CHANGED
|
@@ -36,8 +36,8 @@ export class ManagementClient {
|
|
|
36
36
|
};
|
|
37
37
|
return this.cachedToken.token;
|
|
38
38
|
}
|
|
39
|
-
async request(method, path, payload) {
|
|
40
|
-
const token = await this.getAccessToken();
|
|
39
|
+
async request(method, path, payload, customToken) {
|
|
40
|
+
const token = customToken || (await this.getAccessToken());
|
|
41
41
|
const res = await fetch(`${this.apiBaseUrl}${path}`, {
|
|
42
42
|
method,
|
|
43
43
|
headers: {
|
|
@@ -117,7 +117,7 @@ export class ManagementClient {
|
|
|
117
117
|
list: () => this.request('GET', '/api/groups'),
|
|
118
118
|
get: (groupId) => this.request('GET', `/api/groups/${encodeURIComponent(groupId)}`),
|
|
119
119
|
create: (data) => this.request('POST', '/api/groups', {
|
|
120
|
-
groupId: '',
|
|
120
|
+
groupId: 'new',
|
|
121
121
|
groupName: data.groupName ?? data.name,
|
|
122
122
|
createdBy: 'system',
|
|
123
123
|
lastModifiedBy: 'system',
|
|
@@ -130,24 +130,25 @@ export class ManagementClient {
|
|
|
130
130
|
removeUser: (groupId, userId) => this.request('DELETE', `/api/groups/${encodeURIComponent(groupId)}/users/${encodeURIComponent(userId)}`),
|
|
131
131
|
};
|
|
132
132
|
scim = {
|
|
133
|
-
forConnection: (connectionId) => {
|
|
133
|
+
forConnection: (connectionId, scimBearerToken) => {
|
|
134
134
|
const prefix = connectionId
|
|
135
135
|
? `/api/scim/v2/connections/${encodeURIComponent(connectionId)}`
|
|
136
136
|
: '/api/scim/v2';
|
|
137
|
+
const tok = scimBearerToken || this.options.scimToken;
|
|
137
138
|
return {
|
|
138
|
-
serviceProviderConfig: () => this.request('GET', `${prefix}/ServiceProviderConfig
|
|
139
|
-
schemas: () => this.request('GET', `${prefix}/Schemas
|
|
140
|
-
listUsers: (filter) => this.request('GET', `${prefix}/Users${filter ? `?filter=${encodeURIComponent(filter)}` : ''}
|
|
141
|
-
getUser: (id) => this.request('GET', `${prefix}/Users/${encodeURIComponent(id)}
|
|
142
|
-
createUser: (user) => this.request('POST', `${prefix}/Users`, user),
|
|
143
|
-
replaceUser: (id, user) => this.request('PUT', `${prefix}/Users/${encodeURIComponent(id)}`, user),
|
|
144
|
-
patchUser: (id, patchPayload) => this.request('PATCH', `${prefix}/Users/${encodeURIComponent(id)}`, patchPayload),
|
|
145
|
-
deleteUser: (id) => this.request('DELETE', `${prefix}/Users/${encodeURIComponent(id)}
|
|
146
|
-
listGroups: (filter) => this.request('GET', `${prefix}/Groups${filter ? `?filter=${encodeURIComponent(filter)}` : ''}
|
|
147
|
-
getGroup: (id) => this.request('GET', `${prefix}/Groups/${encodeURIComponent(id)}
|
|
148
|
-
createGroup: (group) => this.request('POST', `${prefix}/Groups`, group),
|
|
149
|
-
replaceGroup: (id, group) => this.request('PUT', `${prefix}/Groups/${encodeURIComponent(id)}`, group),
|
|
150
|
-
deleteGroup: (id) => this.request('DELETE', `${prefix}/Groups/${encodeURIComponent(id)}
|
|
139
|
+
serviceProviderConfig: () => this.request('GET', `${prefix}/ServiceProviderConfig`, undefined, tok),
|
|
140
|
+
schemas: () => this.request('GET', `${prefix}/Schemas`, undefined, tok),
|
|
141
|
+
listUsers: (filter) => this.request('GET', `${prefix}/Users${filter ? `?filter=${encodeURIComponent(filter)}` : ''}`, undefined, tok),
|
|
142
|
+
getUser: (id) => this.request('GET', `${prefix}/Users/${encodeURIComponent(id)}`, undefined, tok),
|
|
143
|
+
createUser: (user) => this.request('POST', `${prefix}/Users`, user, tok),
|
|
144
|
+
replaceUser: (id, user) => this.request('PUT', `${prefix}/Users/${encodeURIComponent(id)}`, user, tok),
|
|
145
|
+
patchUser: (id, patchPayload) => this.request('PATCH', `${prefix}/Users/${encodeURIComponent(id)}`, patchPayload, tok),
|
|
146
|
+
deleteUser: (id) => this.request('DELETE', `${prefix}/Users/${encodeURIComponent(id)}`, undefined, tok),
|
|
147
|
+
listGroups: (filter) => this.request('GET', `${prefix}/Groups${filter ? `?filter=${encodeURIComponent(filter)}` : ''}`, undefined, tok),
|
|
148
|
+
getGroup: (id) => this.request('GET', `${prefix}/Groups/${encodeURIComponent(id)}`, undefined, tok),
|
|
149
|
+
createGroup: (group) => this.request('POST', `${prefix}/Groups`, group, tok),
|
|
150
|
+
replaceGroup: (id, group) => this.request('PUT', `${prefix}/Groups/${encodeURIComponent(id)}`, group, tok),
|
|
151
|
+
deleteGroup: (id) => this.request('DELETE', `${prefix}/Groups/${encodeURIComponent(id)}`, undefined, tok),
|
|
151
152
|
};
|
|
152
153
|
},
|
|
153
154
|
};
|
package/package.json
CHANGED