@simpleview/sv-auth-client 6.7.0 → 6.9.3
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/Dockerfile +6 -0
- package/netskope.crt +52 -0
- package/package.json +4 -4
- package/readme.md +1 -1
- package/src/prefixes/AdminPrefix.js +62 -0
- package/src/prefixes/AuthPrefix.js +85 -6
- package/src/prefixes/admin/ProductInstances.js +3 -0
- package/src/prefixes/auth/SVProducts.js +69 -2
- package/src/prefixes/auth/Users.js +38 -0
package/Dockerfile
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
FROM node:18.15.0
|
|
2
2
|
|
|
3
|
+
# load custom granicus certs
|
|
4
|
+
ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/netskope.crt
|
|
5
|
+
COPY netskope.crt /usr/local/share/ca-certificates/
|
|
6
|
+
RUN update-ca-certificates
|
|
7
|
+
|
|
3
8
|
COPY package.json /app/package.json
|
|
4
9
|
COPY package-lock.json /app/package-lock.json
|
|
5
10
|
|
|
6
11
|
RUN cd /app && npm install
|
|
12
|
+
RUN cd /app && npm update
|
|
7
13
|
|
|
8
14
|
COPY src /app/src
|
|
9
15
|
COPY .eslintrc.json /app/.eslintrc.json
|
package/netskope.crt
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIID/DCCAuSgAwIBAgICATgwDQYJKoZIhvcNAQELBQAwgZcxCzAJBgNVBAYTAlVT
|
|
3
|
+
MQswCQYDVQQIEwJDQTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDU5l
|
|
4
|
+
dHNrb3BlIEluYy4xEjAQBgNVBAsTCWNlcnRhZG1pbjESMBAGA1UEAxMJY2VydGFk
|
|
5
|
+
bWluMSUwIwYJKoZIhvcNAQkBFhZjZXJ0YWRtaW5AbmV0c2tvcGUuY29tMB4XDTE5
|
|
6
|
+
MTAyNTE4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1VLXcsxBWQPYswKC7OzddaUgS1DaAWQ7o
|
|
51
|
+
byAY952sz7FxUETlCMU1OCgsxrcjWerMCUFm
|
|
52
|
+
-----END CERTIFICATE-----
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleview/sv-auth-client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.3",
|
|
4
4
|
"description": "Client for communicating with sv-auth",
|
|
5
5
|
"author": "Owen Allen <owenallenaz@gmail.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@graphql-tools/utils": "9.2.1",
|
|
8
|
-
"@simpleview/sv-graphql-client": ">=
|
|
8
|
+
"@simpleview/sv-graphql-client": ">=4.1.3",
|
|
9
9
|
"@simpleview/express-async-handler": "1.0.2",
|
|
10
10
|
"axios": "1.3.4",
|
|
11
11
|
"expiry-map": "2.0.0",
|
|
12
12
|
"graphql-tag": "2.12.6",
|
|
13
|
-
"jsonwebtoken": "9.0.
|
|
13
|
+
"jsonwebtoken": "9.0.2",
|
|
14
14
|
"p-memoize-cjs": "7.1.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"graphql": ">=16.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@apollo/server": "4.
|
|
20
|
+
"@apollo/server": "4.11.3",
|
|
21
21
|
"@babel/core": "7.21.3",
|
|
22
22
|
"@babel/eslint-parser": "7.21.3",
|
|
23
23
|
"@graphql-tools/schema": "9.0.17",
|
package/readme.md
CHANGED
|
@@ -421,4 +421,4 @@ This is a helper method which registers the `callback` and `logout` functions on
|
|
|
421
421
|
|
|
422
422
|
## Troubleshooting
|
|
423
423
|
|
|
424
|
-
For any assistance please reach out on the [
|
|
424
|
+
For any assistance please reach out on the [Microservices Support](https://teams.microsoft.com/l/channel/19%3A0QyLUigUKgmuRY-RfRJIVzq3y8_oURvRVvV5IC67-0w1%40thread.tacv2/General?groupId=42dd24e6-f6ae-4520-9092-cc21b3b3b730&tenantId=cc1eb3c2-fc0c-4a83-8e6a-8d886b4faeab) Teams channel.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const ObjectBindings = require("./admin/ObjectBindings");
|
|
2
2
|
const Products = require("./admin/Products");
|
|
3
|
+
const ProductInstances = require("./admin/ProductInstances");
|
|
3
4
|
const Roles = require("./admin/Roles");
|
|
4
5
|
const Users = require("./admin/Users");
|
|
5
6
|
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
@@ -7,6 +8,7 @@ const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
|
7
8
|
const apis = {
|
|
8
9
|
object_bindings : ObjectBindings,
|
|
9
10
|
products : Products,
|
|
11
|
+
product_instances : ProductInstances,
|
|
10
12
|
roles : Roles,
|
|
11
13
|
users : Users
|
|
12
14
|
}
|
|
@@ -85,6 +87,66 @@ class AdminPrefix {
|
|
|
85
87
|
return returnData;
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
async users_instance_upsert({ input, fields, context }) {
|
|
91
|
+
context = context || this._graphServer.context;
|
|
92
|
+
|
|
93
|
+
const variables = {
|
|
94
|
+
input,
|
|
95
|
+
acct_id : context.acct_id
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const response = await query({
|
|
99
|
+
query : `
|
|
100
|
+
mutation($acct_id: String!, $input: admin_users_instance_upsert_input!) {
|
|
101
|
+
admin(acct_id: $acct_id) {
|
|
102
|
+
users_instance_upsert(input: $input){
|
|
103
|
+
${fields}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`,
|
|
108
|
+
variables,
|
|
109
|
+
url: this._graphUrl,
|
|
110
|
+
token: context.token
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const returnData = response.admin.users_instance_upsert;
|
|
114
|
+
|
|
115
|
+
nullToUndefined(returnData);
|
|
116
|
+
|
|
117
|
+
return returnData;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async users_instance_remove({ input, fields, context }) {
|
|
121
|
+
context = context || this._graphServer.context;
|
|
122
|
+
|
|
123
|
+
const variables = {
|
|
124
|
+
input,
|
|
125
|
+
acct_id : context.acct_id
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const response = await query({
|
|
129
|
+
query : `
|
|
130
|
+
mutation($acct_id: String!, $input: admin_users_instance_remove_input!) {
|
|
131
|
+
admin(acct_id: $acct_id) {
|
|
132
|
+
users_instance_remove(input: $input){
|
|
133
|
+
${fields}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`,
|
|
138
|
+
variables,
|
|
139
|
+
url: this._graphUrl,
|
|
140
|
+
token: context.token
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const returnData = response.admin.users_instance_remove;
|
|
144
|
+
|
|
145
|
+
nullToUndefined(returnData);
|
|
146
|
+
|
|
147
|
+
return returnData;
|
|
148
|
+
}
|
|
149
|
+
|
|
88
150
|
async account_global_settings_upsert({ input, fields, context }) {
|
|
89
151
|
context = context || this._graphServer.context;
|
|
90
152
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const Accounts = require("./auth/Accounts");
|
|
2
|
+
const Users = require("./auth/Users");
|
|
2
3
|
const OauthClients = require("./auth/OauthClients");
|
|
3
4
|
const SamlClients = require("./auth/SamlClients");
|
|
4
5
|
const SVProducts = require("./auth/SVProducts");
|
|
@@ -18,6 +19,11 @@ class AuthPrefix {
|
|
|
18
19
|
graphServer
|
|
19
20
|
});
|
|
20
21
|
|
|
22
|
+
this._users = new Users({
|
|
23
|
+
graphUrl,
|
|
24
|
+
graphServer
|
|
25
|
+
});
|
|
26
|
+
|
|
21
27
|
this._oauthClients = new OauthClients({
|
|
22
28
|
graphUrl,
|
|
23
29
|
name: "oauth_clients",
|
|
@@ -55,6 +61,10 @@ class AuthPrefix {
|
|
|
55
61
|
return this._accounts.remove(...args);
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
async users(...args) {
|
|
65
|
+
return this._users.find(...args);
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
async account_public({ filter, fields, context }) {
|
|
59
69
|
context = context || this._graphServer.context;
|
|
60
70
|
|
|
@@ -105,6 +115,30 @@ class AuthPrefix {
|
|
|
105
115
|
return returnData;
|
|
106
116
|
}
|
|
107
117
|
|
|
118
|
+
async account_products_sync({ fields, context }) {
|
|
119
|
+
context = context || this._graphServer.context;
|
|
120
|
+
|
|
121
|
+
const result = await query({
|
|
122
|
+
query : `
|
|
123
|
+
mutation {
|
|
124
|
+
auth {
|
|
125
|
+
account_products_sync {
|
|
126
|
+
${fields}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`,
|
|
131
|
+
url : this._graphUrl,
|
|
132
|
+
token : context.token
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const returnData = result.auth.account_products_sync;
|
|
136
|
+
|
|
137
|
+
nullToUndefined(returnData);
|
|
138
|
+
|
|
139
|
+
return returnData;
|
|
140
|
+
}
|
|
141
|
+
|
|
108
142
|
async accounts_email_setup({ fields, context = this._graphServer.context }) {
|
|
109
143
|
return query({
|
|
110
144
|
query : `
|
|
@@ -151,12 +185,8 @@ class AuthPrefix {
|
|
|
151
185
|
return this._sv_products.find(...args);
|
|
152
186
|
}
|
|
153
187
|
|
|
154
|
-
async
|
|
155
|
-
return this._sv_products.
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
async sv_products_remove(...args) {
|
|
159
|
-
return this._sv_products.remove(...args);
|
|
188
|
+
async sv_products_sync(...args) {
|
|
189
|
+
return this._sv_products.sync(...args);
|
|
160
190
|
}
|
|
161
191
|
|
|
162
192
|
async current({ acct_id, fields, context }) {
|
|
@@ -534,6 +564,30 @@ class AuthPrefix {
|
|
|
534
564
|
return returnData;
|
|
535
565
|
}
|
|
536
566
|
|
|
567
|
+
async sv_user({ fields, context }) {
|
|
568
|
+
context = context || this._graphServer.context;
|
|
569
|
+
|
|
570
|
+
const result = await query({
|
|
571
|
+
query: `
|
|
572
|
+
query {
|
|
573
|
+
auth {
|
|
574
|
+
sv_user {
|
|
575
|
+
${fields}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
`,
|
|
580
|
+
url: this._graphUrl,
|
|
581
|
+
token: context.token
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
const returnData = result.auth.sv_user;
|
|
585
|
+
|
|
586
|
+
nullToUndefined(returnData)
|
|
587
|
+
|
|
588
|
+
return returnData;
|
|
589
|
+
}
|
|
590
|
+
|
|
537
591
|
async create_totp_factor({ fields, context }) {
|
|
538
592
|
context = context || this._graphServer.context;
|
|
539
593
|
|
|
@@ -605,6 +659,31 @@ class AuthPrefix {
|
|
|
605
659
|
return result.auth.verified_totp_factor;
|
|
606
660
|
}
|
|
607
661
|
|
|
662
|
+
async ui_products({ fields, context }) {
|
|
663
|
+
context = context || this._graphServer.context;
|
|
664
|
+
|
|
665
|
+
const result = await query({
|
|
666
|
+
query: `
|
|
667
|
+
query {
|
|
668
|
+
auth {
|
|
669
|
+
ui_products {
|
|
670
|
+
${fields}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
`,
|
|
675
|
+
url: this._graphUrl,
|
|
676
|
+
token: context.token
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
const returnData = result.auth.ui_products;
|
|
680
|
+
|
|
681
|
+
nullToUndefined(returnData)
|
|
682
|
+
|
|
683
|
+
return returnData;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
608
687
|
async test_reset_data({ fields, context }) {
|
|
609
688
|
context = context || this._graphServer.context;
|
|
610
689
|
|
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class SVProducts {
|
|
4
|
+
constructor({ graphUrl, name, graphServer }) {
|
|
5
|
+
this._graphUrl = graphUrl;
|
|
6
|
+
this._name = name;
|
|
7
|
+
this._graphServer = graphServer;
|
|
8
|
+
}
|
|
9
|
+
async find({ filter, options, fields, context, headers }) {
|
|
10
|
+
context = context || this._graphServer.context;
|
|
11
|
+
|
|
12
|
+
const variables = {
|
|
13
|
+
filter,
|
|
14
|
+
options
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const response = await query({
|
|
18
|
+
query: `
|
|
19
|
+
query($filter: auth_sv_products_filter) {
|
|
20
|
+
auth {
|
|
21
|
+
sv_products(filter: $filter) {
|
|
22
|
+
${fields}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
variables,
|
|
28
|
+
url: this._graphUrl,
|
|
29
|
+
token: context.token,
|
|
30
|
+
headers
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const returnData = response.auth.sv_products;
|
|
34
|
+
|
|
35
|
+
nullToUndefined(returnData)
|
|
36
|
+
|
|
37
|
+
return returnData;
|
|
38
|
+
}
|
|
39
|
+
async sync({ input, fields, context, headers }) {
|
|
40
|
+
context = context || this._graphServer.context;
|
|
41
|
+
|
|
42
|
+
const variables = {
|
|
43
|
+
input
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const response = await query({
|
|
47
|
+
query: `
|
|
48
|
+
mutation {
|
|
49
|
+
auth {
|
|
50
|
+
sv_products_sync {
|
|
51
|
+
${fields}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
variables,
|
|
57
|
+
url: this._graphUrl,
|
|
58
|
+
token: context.token,
|
|
59
|
+
headers
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const returnData = response.auth.sv_products_sync;
|
|
63
|
+
|
|
64
|
+
nullToUndefined(returnData);
|
|
65
|
+
|
|
66
|
+
return returnData;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = SVProducts;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
|
+
|
|
3
|
+
module.exports = class Users {
|
|
4
|
+
constructor({ graphUrl, graphServer }) {
|
|
5
|
+
this._graphUrl = graphUrl;
|
|
6
|
+
this._graphServer = graphServer;
|
|
7
|
+
}
|
|
8
|
+
async find({ filter, options, fields, context, headers }) {
|
|
9
|
+
context = context || this._graphServer.context;
|
|
10
|
+
|
|
11
|
+
const variables = {
|
|
12
|
+
filter,
|
|
13
|
+
options
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const response = await query({
|
|
17
|
+
query : `
|
|
18
|
+
query($filter: auth_users_filter, $options: auth_users_options) {
|
|
19
|
+
auth {
|
|
20
|
+
users(filter: $filter, options: $options) {
|
|
21
|
+
${fields}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
variables,
|
|
27
|
+
url : this._graphUrl,
|
|
28
|
+
token : context.token,
|
|
29
|
+
headers
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const returnData = response.auth.users;
|
|
33
|
+
|
|
34
|
+
nullToUndefined(returnData)
|
|
35
|
+
|
|
36
|
+
return returnData;
|
|
37
|
+
}
|
|
38
|
+
}
|