cidaas-javascript-sdk 2.0.3 → 2.0.7
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/README.md +117 -2
- package/package.json +1 -1
- package/src/main/authentication/index.js +170 -146
- package/src/main/web-auth/webauth.js +61 -3
package/README.md
CHANGED
|
@@ -16,9 +16,9 @@ This cidaas Javascript SDK library is built on the top of [OIDC client javascrip
|
|
|
16
16
|
From CDN
|
|
17
17
|
|
|
18
18
|
```html
|
|
19
|
-
<!-- Release version 2.0.
|
|
19
|
+
<!-- Release version 2.0.7 -->
|
|
20
20
|
<!-- Minified version -->
|
|
21
|
-
<script src="https://cdn.cidaas.de/javascript/oidc/2.0.
|
|
21
|
+
<script src="https://cdn.cidaas.de/javascript/oidc/2.0.7/cidaas-javascript-sdk.min.js"></script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
From npm
|
|
@@ -616,6 +616,81 @@ cidaas.changePassword({
|
|
|
616
616
|
}
|
|
617
617
|
```
|
|
618
618
|
|
|
619
|
+
#### Get user profile information
|
|
620
|
+
|
|
621
|
+
To get user profile details, pass access token to ****getProfileInfo()****.
|
|
622
|
+
|
|
623
|
+
##### Sample code
|
|
624
|
+
|
|
625
|
+
```js
|
|
626
|
+
cidaas.getProfileInfo({
|
|
627
|
+
access_token: 'your access token'
|
|
628
|
+
}).then(function (response) {
|
|
629
|
+
// type your code here
|
|
630
|
+
}).catch(function (ex) {
|
|
631
|
+
// your failure code here
|
|
632
|
+
});
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
##### Response
|
|
636
|
+
|
|
637
|
+
```json
|
|
638
|
+
{
|
|
639
|
+
"success": true,
|
|
640
|
+
"status": 200,
|
|
641
|
+
"data": {
|
|
642
|
+
"userAccount": {
|
|
643
|
+
"userIds": [
|
|
644
|
+
{
|
|
645
|
+
"key": "self.email",
|
|
646
|
+
"value": "testuser@gmail.com"
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
"className": "de.cidaas.management.db.UserAccounts",
|
|
650
|
+
"_id": "ac45bdda-93bf-44f1-b2ff-8465495c3417",
|
|
651
|
+
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
|
|
652
|
+
"user_status_reason": "",
|
|
653
|
+
"userStatus": "VERIFIED",
|
|
654
|
+
"customFields": {
|
|
655
|
+
"Test_consent_HP": true,
|
|
656
|
+
"customer_number": "CN456",
|
|
657
|
+
"invoice_number": "IN456"
|
|
658
|
+
},
|
|
659
|
+
"createdTime": "2021-05-27T07:38:29.579Z",
|
|
660
|
+
"updatedTime": "2021-06-24T11:02:43.188Z",
|
|
661
|
+
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
|
|
662
|
+
"__v": 0,
|
|
663
|
+
"lastLoggedInTime": "2021-06-24T11:02:43.186Z",
|
|
664
|
+
"lastUsedIdentity": "bbee960d-6a80-424e-99bd-586d74f1053e",
|
|
665
|
+
"mfa_enabled": true,
|
|
666
|
+
"id": "ac45bdda-93bf-44f1-b2ff-8465495c3417"
|
|
667
|
+
},
|
|
668
|
+
"identity": {
|
|
669
|
+
"_id": "bbee960d-6a80-424e-99bd-586d74f1053e",
|
|
670
|
+
"className": "de.cidaas.core.db.EnternalSocialIdentity",
|
|
671
|
+
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
|
|
672
|
+
"provider": "self",
|
|
673
|
+
"email": "testuser@gmail.com",
|
|
674
|
+
"email_verified": true,
|
|
675
|
+
"family_name": "Test",
|
|
676
|
+
"given_name": "User",
|
|
677
|
+
"locale": "en-us",
|
|
678
|
+
"createdTime": "2021-05-27T07:38:29.908Z",
|
|
679
|
+
"updatedTime": "2021-06-24T11:02:43.188Z",
|
|
680
|
+
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
|
|
681
|
+
"__v": 0,
|
|
682
|
+
"birthdate": "1993-06-07T18:30:00.000Z",
|
|
683
|
+
"id": "bbee960d-6a80-424e-99bd-586d74f1053e"
|
|
684
|
+
},
|
|
685
|
+
"customFields": {},
|
|
686
|
+
"roles": [
|
|
687
|
+
"USER"
|
|
688
|
+
],
|
|
689
|
+
"groups": []
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
619
694
|
#### Getting user profile
|
|
620
695
|
|
|
621
696
|
To get the user profile information, call ****getUserProfile()****.
|
|
@@ -683,7 +758,46 @@ cidaas.logoutUser({
|
|
|
683
758
|
access_token : 'your accessToken'
|
|
684
759
|
});
|
|
685
760
|
```
|
|
761
|
+
#### Delete User Account
|
|
762
|
+
|
|
763
|
+
To delete the user account directly in the application, call **deleteUserAccount()**. This method will delete the user account with **requestId** as the **query parameter**.
|
|
764
|
+
|
|
765
|
+
This method takes an object as input.
|
|
766
|
+
|
|
767
|
+
##### Sample code
|
|
686
768
|
|
|
769
|
+
```js
|
|
770
|
+
options = {
|
|
771
|
+
sub: "7e4f79a9-cfbc-456d-936a-e6bc1de2d4b9",
|
|
772
|
+
requestId: "7d86460b-8288-4341-aed1- 10dd27a4565c",
|
|
773
|
+
accept-language: "en"
|
|
774
|
+
}
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
The usage of the method is as follows.
|
|
778
|
+
|
|
779
|
+
```js
|
|
780
|
+
cidaas.deleteUserAccount(options).then(function (response) {
|
|
781
|
+
|
|
782
|
+
// your success code here
|
|
783
|
+
|
|
784
|
+
}).catch(function(ex) {
|
|
785
|
+
|
|
786
|
+
// your failure code here
|
|
787
|
+
|
|
788
|
+
});
|
|
789
|
+
```
|
|
790
|
+
#### Response
|
|
791
|
+
|
|
792
|
+
```js
|
|
793
|
+
{
|
|
794
|
+
"success": true,
|
|
795
|
+
"status": 200,
|
|
796
|
+
"data": {
|
|
797
|
+
"result": true
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
```
|
|
687
801
|
#### Physical Verification
|
|
688
802
|
|
|
689
803
|
After successful login, we can add multifactor authentications.
|
|
@@ -1891,3 +2005,4 @@ this.socket.on("status-update", (msg) => {
|
|
|
1891
2005
|
}
|
|
1892
2006
|
});
|
|
1893
2007
|
```
|
|
2008
|
+
F
|
package/package.json
CHANGED
|
@@ -4,186 +4,210 @@ function Authentication() {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
// redirect sign in
|
|
7
|
-
Authentication.prototype.redirectSignIn = function
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Authentication.prototype.redirectSignIn = function(view_type) {
|
|
8
|
+
try {
|
|
9
|
+
if (window.usermanager) {
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
if (window.webAuthSettings) {
|
|
12
|
+
if (!window.webAuthSettings.extraQueryParams) {
|
|
13
|
+
window.webAuthSettings.extraQueryParams = {};
|
|
14
|
+
}
|
|
15
|
+
window.webAuthSettings.extraQueryParams.view_type = view_type;
|
|
16
|
+
if (window.webAuthSettings.scope) {
|
|
17
|
+
if (window.webAuthSettings.response_type.indexOf("id_token") == -1 && window.webAuthSettings.scope.indexOf("openid") != -1 && !window.webAuthSettings.extraQueryParams.nonce) {
|
|
18
|
+
window.webAuthSettings.extraQueryParams.nonce = new Date().getTime().toString();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
window.webAuthSettings = {};
|
|
23
|
+
}
|
|
24
|
+
window.usermanager.signinRedirect({
|
|
25
|
+
extraQueryParams: window.webAuthSettings.extraQueryParams,
|
|
26
|
+
data: window.webAuthSettings
|
|
27
|
+
}).then(function() {
|
|
28
|
+
console.log("Redirect logged in using cidaas sdk");
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
throw "user manager is nil";
|
|
20
32
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
window.usermanager.signinRedirect({
|
|
25
|
-
extraQueryParams: window.webAuthSettings.extraQueryParams,
|
|
26
|
-
data: window.webAuthSettings
|
|
27
|
-
}).then(function () {
|
|
28
|
-
console.log("Redirect logged in using cidaas sdk");
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
throw "user manager is nil";
|
|
33
|
+
} catch (ex) {
|
|
34
|
+
console.log("user manager instance is empty : " + ex);
|
|
32
35
|
}
|
|
33
|
-
} catch (ex) {
|
|
34
|
-
console.log("user manager instance is empty : " + ex);
|
|
35
|
-
}
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// redirect sign in callback
|
|
39
|
-
Authentication.prototype.redirectSignInCallback = function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
Authentication.prototype.redirectSignInCallback = function() {
|
|
40
|
+
return new Promise(function(resolve, reject) {
|
|
41
|
+
try {
|
|
42
|
+
if (window.usermanager) {
|
|
43
|
+
window.usermanager.signinRedirectCallback({
|
|
44
|
+
data: window.webAuthSettings
|
|
45
|
+
}).then(function(user) {
|
|
46
|
+
if (user) {
|
|
47
|
+
resolve(user);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
resolve(undefined);
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
throw "user manager is nil";
|
|
54
|
+
}
|
|
55
|
+
} catch (ex) {
|
|
56
|
+
reject(ex);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// redirect sign out
|
|
62
|
-
Authentication.prototype.redirectSignOut = function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
Authentication.prototype.redirectSignOut = function() {
|
|
63
|
+
return new Promise(function(resolve, reject) {
|
|
64
|
+
try {
|
|
65
|
+
if (window.usermanager && window.webAuthSettings) {
|
|
66
|
+
window.usermanager.signoutRedirect({
|
|
67
|
+
state: window.webAuthSettings
|
|
68
|
+
}).then(function(resp) {
|
|
69
|
+
console.log('signed out', resp);
|
|
70
|
+
window.authentication.redirectSignOutCallback().then(function(resp) {
|
|
71
|
+
resolve(resp);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
throw "user manager or settings is nil";
|
|
76
|
+
}
|
|
77
|
+
} catch (ex) {
|
|
78
|
+
reject(ex);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// redirect sign out callback
|
|
84
|
-
Authentication.prototype.redirectSignOutCallback = function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
Authentication.prototype.redirectSignOutCallback = function() {
|
|
85
|
+
return new Promise(function(resolve, reject) {
|
|
86
|
+
try {
|
|
87
|
+
if (window.usermanager) {
|
|
88
|
+
window.usermanager.signoutRedirectCallback().then(function(resp) {
|
|
89
|
+
console.log("Signed out");
|
|
90
|
+
resolve(resp);
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
resolve(undefined);
|
|
94
|
+
throw "user manager is nil";
|
|
95
|
+
}
|
|
96
|
+
} catch (ex) {}
|
|
97
|
+
});
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
// pop up sign in
|
|
101
|
-
Authentication.prototype.popupSignIn = function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
Authentication.prototype.popupSignIn = function() {
|
|
102
|
+
try {
|
|
103
|
+
if (window.usermanager && window.webAuthSettings) {
|
|
104
|
+
window.usermanager.signinPopup({
|
|
105
|
+
data: window.webAuthSettings
|
|
106
|
+
}).then(function() {
|
|
107
|
+
console.log("signed in");
|
|
108
|
+
// window.location = "/";
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
throw "user manager or settings is nil";
|
|
112
|
+
}
|
|
113
|
+
} catch (ex) {}
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
// pop up sign in callback
|
|
117
|
-
Authentication.prototype.popupSignInCallback = function
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
Authentication.prototype.popupSignInCallback = function() {
|
|
118
|
+
try {
|
|
119
|
+
if (window.usermanager) {
|
|
120
|
+
window.usermanager.signinPopupCallback();
|
|
121
|
+
}
|
|
122
|
+
} catch (ex) {}
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// pop up sign out
|
|
126
|
-
Authentication.prototype.popupSignOut = function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
Authentication.prototype.popupSignOut = function() {
|
|
127
|
+
try {
|
|
128
|
+
if (window.usermanager && window.webAuthSettings) {
|
|
129
|
+
window.usermanager.signoutPopup({
|
|
130
|
+
state: window.webAuthSettings
|
|
131
|
+
}).then(function(resp) {
|
|
132
|
+
console.log('signed out', resp);
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
throw "user manager or settings is nil";
|
|
136
|
+
}
|
|
137
|
+
} catch (ex) {}
|
|
138
138
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// pop up sign out callback
|
|
142
|
-
Authentication.prototype.popupSignOutCallback = function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
Authentication.prototype.popupSignOutCallback = function() {
|
|
143
|
+
try {
|
|
144
|
+
if (window.usermanager) {
|
|
145
|
+
window.usermanager.signoutPopupCallback(true);
|
|
146
|
+
} else {
|
|
147
|
+
throw "user manager is nil";
|
|
148
|
+
}
|
|
149
|
+
} catch (ex) {}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
// silent sign in
|
|
153
|
-
Authentication.prototype.silentSignIn = function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
Authentication.prototype.silentSignIn = function() {
|
|
154
|
+
try {
|
|
155
|
+
if (window.usermanager && window.webAuthSettings) {
|
|
156
|
+
window.usermanager.signinSilent({
|
|
157
|
+
state: window.webAuthSettings
|
|
158
|
+
}).then(function(user) {
|
|
159
|
+
console.log("signed in : " + user.access_token);
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
throw "user manager is nil";
|
|
163
|
+
}
|
|
164
|
+
} catch (ex) {}
|
|
165
165
|
};
|
|
166
166
|
|
|
167
167
|
// silent sign in callback
|
|
168
|
-
Authentication.prototype.silentSignInCallback = function
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
Authentication.prototype.silentSignInCallback = function() {
|
|
169
|
+
try {
|
|
170
|
+
if (window.usermanager) {
|
|
171
|
+
window.usermanager.signinSilentCallback();
|
|
172
|
+
} else {
|
|
173
|
+
throw "user manager is nil";
|
|
174
|
+
}
|
|
175
|
+
} catch (ex) {}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// silent sign in callback v2
|
|
179
|
+
Authentication.prototype.silentSignInCallbackV2 = function() {
|
|
180
|
+
return new Promise(function(resolve, reject) {
|
|
181
|
+
try {
|
|
182
|
+
if (window.usermanager) {
|
|
183
|
+
window.usermanager.signinSilentCallback({
|
|
184
|
+
data: window.webAuthSettings
|
|
185
|
+
}).then(function(user) {
|
|
186
|
+
if (user) {
|
|
187
|
+
resolve(user);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
resolve(undefined);
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
throw "user manager is nil";
|
|
194
|
+
}
|
|
195
|
+
} catch (ex) {
|
|
196
|
+
reject(ex);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
176
200
|
};
|
|
177
201
|
|
|
178
202
|
// silent sign out callback
|
|
179
|
-
Authentication.prototype.popupSignOutCallback = function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
203
|
+
Authentication.prototype.popupSignOutCallback = function() {
|
|
204
|
+
try {
|
|
205
|
+
if (window.usermanager) {
|
|
206
|
+
window.usermanager.signoutPopupCallback(true);
|
|
207
|
+
} else {
|
|
208
|
+
throw "user manager is nil";
|
|
209
|
+
}
|
|
210
|
+
} catch (ex) {}
|
|
187
211
|
};
|
|
188
212
|
|
|
189
213
|
module.exports = Authentication;
|
|
@@ -83,7 +83,11 @@ WebAuth.prototype.loginCallback = function () {
|
|
|
83
83
|
} else if (window.webAuthSettings.mode == 'window') {
|
|
84
84
|
window.authentication.popupSignInCallback();
|
|
85
85
|
} else if (window.webAuthSettings.mode == 'silent') {
|
|
86
|
-
window.authentication.
|
|
86
|
+
window.authentication.silentSignInCallbackV2().then(function(data){
|
|
87
|
+
resolve(data);
|
|
88
|
+
}).catch(function(error){
|
|
89
|
+
reject(error);
|
|
90
|
+
})
|
|
87
91
|
}
|
|
88
92
|
} catch (ex) {
|
|
89
93
|
console.log(ex);
|
|
@@ -137,6 +141,31 @@ WebAuth.prototype.getUserProfile = function (options) {
|
|
|
137
141
|
});
|
|
138
142
|
};
|
|
139
143
|
|
|
144
|
+
// get user info (internal)
|
|
145
|
+
WebAuth.prototype.getProfileInfo = function (access_token) {
|
|
146
|
+
return new Promise(function (resolve, reject) {
|
|
147
|
+
try {
|
|
148
|
+
if (!access_token) {
|
|
149
|
+
throw new CustomException("access_token cannot be empty", 417);
|
|
150
|
+
}
|
|
151
|
+
var http = new XMLHttpRequest();
|
|
152
|
+
var _serviceURL = window.webAuthSettings.authority + "/users-srv/internal/userinfo/profile";
|
|
153
|
+
http.onreadystatechange = function () {
|
|
154
|
+
if (http.readyState == 4) {
|
|
155
|
+
resolve(JSON.parse(http.responseText));
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
http.open("GET", _serviceURL, true);
|
|
159
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
160
|
+
http.setRequestHeader("access_token", access_token);
|
|
161
|
+
http.send();
|
|
162
|
+
} catch (ex) {
|
|
163
|
+
reject(ex);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
|
|
140
169
|
// logout
|
|
141
170
|
WebAuth.prototype.logout = function () {
|
|
142
171
|
return new Promise(function (resolve, reject) {
|
|
@@ -208,7 +237,11 @@ function createPostPromise(options, serviceurl, errorResolver, access_token) {
|
|
|
208
237
|
if (access_token) {
|
|
209
238
|
http.setRequestHeader("access_token", access_token);
|
|
210
239
|
}
|
|
211
|
-
|
|
240
|
+
if (options) {
|
|
241
|
+
http.send(JSON.stringify(options));
|
|
242
|
+
} else {
|
|
243
|
+
http.send();
|
|
244
|
+
}
|
|
212
245
|
} catch (ex) {
|
|
213
246
|
reject(ex);
|
|
214
247
|
}
|
|
@@ -1048,6 +1081,31 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
|
|
|
1048
1081
|
});
|
|
1049
1082
|
};
|
|
1050
1083
|
|
|
1084
|
+
// get scope consent version details
|
|
1085
|
+
WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
|
|
1086
|
+
return new Promise(function (resolve, reject) {
|
|
1087
|
+
try {
|
|
1088
|
+
var http = new XMLHttpRequest();
|
|
1089
|
+
var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/v2/consent/versions/details/" + options.scopeid + "?locale=" + options.locale;
|
|
1090
|
+
http.onreadystatechange = function () {
|
|
1091
|
+
if (http.readyState == 4) {
|
|
1092
|
+
if (http.responseText) {
|
|
1093
|
+
resolve(JSON.parse(http.responseText));
|
|
1094
|
+
} else {
|
|
1095
|
+
resolve(false);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
http.open("GET", _serviceURL, true);
|
|
1100
|
+
http.setRequestHeader("Content-type", "application/json");
|
|
1101
|
+
http.setRequestHeader("Authorization", "Bearer " + options.access_token);
|
|
1102
|
+
http.send();
|
|
1103
|
+
} catch (ex) {
|
|
1104
|
+
reject(ex);
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1051
1109
|
// accept scope Consent
|
|
1052
1110
|
WebAuth.prototype.acceptScopeConsent = function (options) {
|
|
1053
1111
|
var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/scope/accept";
|
|
@@ -1495,7 +1553,7 @@ WebAuth.prototype.enrollVerification = function (options) {
|
|
|
1495
1553
|
// updateSocket
|
|
1496
1554
|
WebAuth.prototype.updateSocket = function (status_id) {
|
|
1497
1555
|
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
1498
|
-
return createPostPromise(
|
|
1556
|
+
return createPostPromise(undefined, _serviceURL, undefined);
|
|
1499
1557
|
};
|
|
1500
1558
|
|
|
1501
1559
|
// setupFidoVerification
|