cidaas-javascript-sdk 3.1.2 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## [3.1.2](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v3.1.1...v3.1.2) (2023-09-05)
1
+ ## [3.1.4](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/compare/v3.1.3...v3.1.4) (2023-09-06)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * semantic release format ([e73ccc3](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/e73ccc377ad14bdf7de3e89c91dca0b3d1c0c1d1))
6
+ * update ci ([6bb80e0](https://gitlab.widas.de/cidaas-public-devkits/cidaas-public-sdks/cidaas-javascript-sdk/commit/6bb80e01aed3cd92a18303d0bf4ea74d29e8d9f6))
package/README.md CHANGED
@@ -2613,4 +2613,3 @@ The SDK will throws Custom Exception if something went wrong during the operatio
2613
2613
  |----------------- | ----------------------- |
2614
2614
  | 500 | during creation of WebAuth instance |
2615
2615
  | 417 | if there are any other failure |
2616
-
@@ -0,0 +1,55 @@
1
+ import { UserManager, UserManagerSettings } from "oidc-client-ts";
2
+ export declare class Authentication {
3
+ webAuthSettings: UserManagerSettings;
4
+ userManager: UserManager;
5
+ constructor(webAuthSettings: UserManagerSettings, userManager: UserManager);
6
+ /**
7
+ * redirect sign in
8
+ * @param view_type
9
+ */
10
+ redirectSignIn(view_type: string): void;
11
+ /**
12
+ * redirect sign in callback
13
+ * @returns
14
+ */
15
+ redirectSignInCallback(): Promise<unknown>;
16
+ /**
17
+ * redirect sign out
18
+ * @returns
19
+ */
20
+ redirectSignOut(): Promise<unknown>;
21
+ /**
22
+ * redirect sign out callback
23
+ * @returns
24
+ */
25
+ redirectSignOutCallback(): Promise<unknown>;
26
+ /**
27
+ * pop up sign in
28
+ */
29
+ popupSignIn(): void;
30
+ /**
31
+ * pop up sign in callback
32
+ */
33
+ popupSignInCallback(): void;
34
+ /**
35
+ * pop up sign out
36
+ */
37
+ popupSignOut(): void;
38
+ /**
39
+ * silent sign in
40
+ */
41
+ silentSignIn(): void;
42
+ /**
43
+ * silent sign in callback
44
+ */
45
+ silentSignInCallback(): void;
46
+ /**
47
+ * silent sign in callback v2
48
+ * @returns
49
+ */
50
+ silentSignInCallbackV2(): Promise<unknown>;
51
+ /**
52
+ * silent sign out callback
53
+ */
54
+ popupSignOutCallback(): void;
55
+ }
@@ -1,14 +1,16 @@
1
- import { UserManager, UserManagerSettings } from "oidc-client-ts";
2
-
3
- export class Authentication {
4
-
5
- constructor(public webAuthSettings: UserManagerSettings, public userManager: UserManager) { }
6
-
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Authentication = void 0;
4
+ var Authentication = /** @class */ (function () {
5
+ function Authentication(webAuthSettings, userManager) {
6
+ this.webAuthSettings = webAuthSettings;
7
+ this.userManager = userManager;
8
+ }
7
9
  /**
8
10
  * redirect sign in
9
- * @param view_type
11
+ * @param view_type
10
12
  */
11
- redirectSignIn(view_type: string) {
13
+ Authentication.prototype.redirectSignIn = function (view_type) {
12
14
  try {
13
15
  if (this.userManager) {
14
16
  if (this.webAuthSettings) {
@@ -28,196 +30,233 @@ export class Authentication {
28
30
  }).then(function () {
29
31
  console.log("Redirect logged in using cidaas sdk");
30
32
  });
31
- } else {
33
+ }
34
+ else {
32
35
  throw "user manager is null";
33
36
  }
34
- } catch (ex) {
37
+ }
38
+ catch (ex) {
35
39
  console.log("user manager instance is empty : " + ex);
36
40
  }
37
41
  };
38
-
42
+ ;
39
43
  /**
40
44
  * redirect sign in callback
41
- * @returns
45
+ * @returns
42
46
  */
43
- redirectSignInCallback() {
44
- return new Promise((resolve, reject) => {
47
+ Authentication.prototype.redirectSignInCallback = function () {
48
+ var _this = this;
49
+ return new Promise(function (resolve, reject) {
45
50
  try {
46
- if (this.userManager) {
47
- this.userManager.signinRedirectCallback()
48
- .then(function (user: any) {
49
- if (user) {
50
- resolve(user);
51
- return;
52
- }
53
- resolve(undefined);
54
- });
55
- } else {
51
+ if (_this.userManager) {
52
+ _this.userManager.signinRedirectCallback()
53
+ .then(function (user) {
54
+ if (user) {
55
+ resolve(user);
56
+ return;
57
+ }
58
+ resolve(undefined);
59
+ });
60
+ }
61
+ else {
56
62
  throw "user manager is null";
57
63
  }
58
- } catch (ex) {
64
+ }
65
+ catch (ex) {
59
66
  reject(ex);
60
67
  }
61
68
  });
62
- }
63
-
69
+ };
64
70
  /**
65
71
  * redirect sign out
66
- * @returns
72
+ * @returns
67
73
  */
68
- redirectSignOut() {
69
- return new Promise((resolve, reject) => {
74
+ Authentication.prototype.redirectSignOut = function () {
75
+ var _this = this;
76
+ return new Promise(function (resolve, reject) {
70
77
  try {
71
- if (this.userManager && this.webAuthSettings) {
72
- this.userManager.signoutRedirect({
73
- state: this.webAuthSettings
74
- }).then(function (resp: any) {
78
+ if (_this.userManager && _this.webAuthSettings) {
79
+ _this.userManager.signoutRedirect({
80
+ state: _this.webAuthSettings
81
+ }).then(function (resp) {
75
82
  console.log('signed out', resp);
76
- window.authentication.redirectSignOutCallback().then(function (resp: any) {
83
+ window.authentication.redirectSignOutCallback().then(function (resp) {
77
84
  resolve(resp);
78
85
  });
79
86
  });
80
- } else {
87
+ }
88
+ else {
81
89
  throw "user manager or settings is null";
82
90
  }
83
- } catch (ex) {
91
+ }
92
+ catch (ex) {
84
93
  reject(ex);
85
94
  }
86
95
  });
87
96
  };
88
-
97
+ ;
89
98
  /**
90
99
  * redirect sign out callback
91
- * @returns
100
+ * @returns
92
101
  */
93
- redirectSignOutCallback() {
94
- return new Promise((resolve, reject) => {
102
+ Authentication.prototype.redirectSignOutCallback = function () {
103
+ var _this = this;
104
+ return new Promise(function (resolve, reject) {
95
105
  try {
96
- if (this.userManager) {
97
- this.userManager.signoutRedirectCallback().then(function (resp: any) {
106
+ if (_this.userManager) {
107
+ _this.userManager.signoutRedirectCallback().then(function (resp) {
98
108
  console.log("Signed out");
99
109
  resolve(resp);
100
110
  });
101
- } else {
111
+ }
112
+ else {
102
113
  resolve(undefined);
103
114
  throw "user manager is null";
104
115
  }
105
- } catch (ex) {
116
+ }
117
+ catch (ex) {
106
118
  reject(ex);
107
119
  }
108
120
  });
109
121
  };
110
-
122
+ ;
111
123
  /**
112
124
  * pop up sign in
113
125
  */
114
- popupSignIn() {
126
+ Authentication.prototype.popupSignIn = function () {
115
127
  try {
116
128
  if (this.userManager && this.webAuthSettings) {
117
129
  this.userManager.signinPopup().then(function () {
118
130
  console.log("signed in");
119
131
  });
120
- } else {
132
+ }
133
+ else {
121
134
  throw "user manager or settings is null";
122
135
  }
123
- } catch (ex) { console.error(ex) }
136
+ }
137
+ catch (ex) {
138
+ console.error(ex);
139
+ }
124
140
  };
125
-
141
+ ;
126
142
  /**
127
143
  * pop up sign in callback
128
144
  */
129
- popupSignInCallback() {
145
+ Authentication.prototype.popupSignInCallback = function () {
130
146
  try {
131
147
  if (this.userManager) {
132
148
  this.userManager.signinPopupCallback();
133
149
  }
134
- } catch (ex) { console.error(ex) }
150
+ }
151
+ catch (ex) {
152
+ console.error(ex);
153
+ }
135
154
  };
136
-
155
+ ;
137
156
  /**
138
157
  * pop up sign out
139
158
  */
140
- popupSignOut() {
159
+ Authentication.prototype.popupSignOut = function () {
141
160
  try {
142
161
  if (this.userManager && this.webAuthSettings) {
143
162
  this.userManager.signoutPopup({
144
163
  state: this.webAuthSettings
145
- }).then(function (resp: any) {
164
+ }).then(function (resp) {
146
165
  console.log('signed out', resp);
147
166
  });
148
- } else {
167
+ }
168
+ else {
149
169
  throw "user manager or settings is null";
150
170
  }
151
- } catch (ex) { console.error(ex) }
152
-
171
+ }
172
+ catch (ex) {
173
+ console.error(ex);
174
+ }
153
175
  };
154
-
176
+ ;
155
177
  /**
156
178
  * silent sign in
157
179
  */
158
- silentSignIn() {
180
+ Authentication.prototype.silentSignIn = function () {
159
181
  try {
160
182
  if (this.userManager && this.webAuthSettings) {
161
183
  this.userManager.signinSilent({
162
184
  state: this.webAuthSettings
163
- }).then(function (user: any) {
185
+ }).then(function (user) {
164
186
  console.log("signed in : " + user.access_token);
165
187
  });
166
- } else {
188
+ }
189
+ else {
167
190
  throw "user manager is null";
168
191
  }
169
- } catch (ex) { console.error(ex) }
192
+ }
193
+ catch (ex) {
194
+ console.error(ex);
195
+ }
170
196
  };
171
-
197
+ ;
172
198
  /**
173
199
  * silent sign in callback
174
200
  */
175
- silentSignInCallback() {
201
+ Authentication.prototype.silentSignInCallback = function () {
176
202
  try {
177
203
  if (this.userManager) {
178
204
  this.userManager.signinSilentCallback();
179
- } else {
205
+ }
206
+ else {
180
207
  throw "user manager is null";
181
208
  }
182
- } catch (ex) { console.error(ex) }
209
+ }
210
+ catch (ex) {
211
+ console.error(ex);
212
+ }
183
213
  };
184
-
214
+ ;
185
215
  /**
186
216
  * silent sign in callback v2
187
- * @returns
217
+ * @returns
188
218
  */
189
- silentSignInCallbackV2() {
190
- return new Promise((resolve, reject) => {
219
+ Authentication.prototype.silentSignInCallbackV2 = function () {
220
+ var _this = this;
221
+ return new Promise(function (resolve, reject) {
191
222
  try {
192
- if (this.userManager) {
193
- this.userManager.signinSilentCallback(this.webAuthSettings.silent_redirect_uri)
194
- .then(function (user: any) {
195
- if (user) {
196
- resolve(user);
197
- return;
198
- }
199
- resolve(undefined);
200
- });
201
- } else {
223
+ if (_this.userManager) {
224
+ _this.userManager.signinSilentCallback(_this.webAuthSettings.silent_redirect_uri)
225
+ .then(function (user) {
226
+ if (user) {
227
+ resolve(user);
228
+ return;
229
+ }
230
+ resolve(undefined);
231
+ });
232
+ }
233
+ else {
202
234
  throw "user manager is null";
203
235
  }
204
- } catch (ex) {
236
+ }
237
+ catch (ex) {
205
238
  reject(ex);
206
239
  }
207
240
  });
208
-
209
241
  };
210
-
242
+ ;
211
243
  /**
212
244
  * silent sign out callback
213
245
  */
214
- popupSignOutCallback() {
246
+ Authentication.prototype.popupSignOutCallback = function () {
215
247
  try {
216
248
  if (this.userManager) {
217
249
  this.userManager.signoutPopupCallback(this.webAuthSettings.post_logout_redirect_uri, true);
218
- } else {
250
+ }
251
+ else {
219
252
  throw "user manager is null";
220
253
  }
221
- } catch (ex) { console.error(ex) }
254
+ }
255
+ catch (ex) {
256
+ console.error(ex);
257
+ }
222
258
  };
223
- }
259
+ ;
260
+ return Authentication;
261
+ }());
262
+ exports.Authentication = Authentication;
@@ -0,0 +1,3 @@
1
+ import { Authentication } from "./authentication";
2
+ import { WebAuth } from "./web-auth/WebAuth";
3
+ export { WebAuth, Authentication };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Authentication = exports.WebAuth = void 0;
4
+ var authentication_1 = require("./authentication");
5
+ exports.Authentication = authentication_1.Authentication;
6
+ var WebAuth_1 = require("./web-auth/WebAuth");
7
+ exports.WebAuth = WebAuth_1.WebAuth;
@@ -0,0 +1,59 @@
1
+ import { IConsentAcceptEntity } from "./Entities";
2
+ export declare namespace ConsentService {
3
+ /**
4
+ * get user consent details
5
+ * @param options
6
+ * @returns
7
+ */
8
+ function getConsentDetailsV2(options: {
9
+ consent_id: string;
10
+ consent_version_id: string;
11
+ sub: string;
12
+ }): Promise<unknown>;
13
+ /**
14
+ * accept constn v2
15
+ * @param options
16
+ * @returns
17
+ */
18
+ function acceptConsentV2(options: IConsentAcceptEntity): Promise<unknown>;
19
+ /**
20
+ * get scope consent version details
21
+ * @param options
22
+ * @returns
23
+ */
24
+ function getScopeConsentVersionDetailsV2(options: {
25
+ scopeid: string;
26
+ locale: string;
27
+ access_token: string;
28
+ }): Promise<unknown>;
29
+ /**
30
+ * accept scope Consent
31
+ * @param options
32
+ * @returns
33
+ */
34
+ function acceptScopeConsent(options: {
35
+ client_id: string;
36
+ sub: string;
37
+ scopes: string[];
38
+ }): Promise<unknown>;
39
+ /**
40
+ * accept claim Consent
41
+ * @param options
42
+ * @returns
43
+ */
44
+ function acceptClaimConsent(options: {
45
+ client_id: string;
46
+ sub: string;
47
+ accepted_claims: string[];
48
+ }): Promise<unknown>;
49
+ /**
50
+ * revoke claim Consent
51
+ * @param options
52
+ * @returns
53
+ */
54
+ function revokeClaimConsent(options: {
55
+ client_id: string;
56
+ sub: string;
57
+ revoked_claims: string[];
58
+ }): Promise<unknown>;
59
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.ConsentService = void 0;
4
+ var Helper_1 = require("./Helper");
5
+ var ConsentService;
6
+ (function (ConsentService) {
7
+ /**
8
+ * get user consent details
9
+ * @param options
10
+ * @returns
11
+ */
12
+ function getConsentDetailsV2(options) {
13
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/v2/consent/usage/public/info";
14
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
15
+ }
16
+ ConsentService.getConsentDetailsV2 = getConsentDetailsV2;
17
+ ;
18
+ /**
19
+ * accept constn v2
20
+ * @param options
21
+ * @returns
22
+ */
23
+ function acceptConsentV2(options) {
24
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/v2/consent/usage/accept";
25
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
26
+ }
27
+ ConsentService.acceptConsentV2 = acceptConsentV2;
28
+ ;
29
+ /**
30
+ * get scope consent version details
31
+ * @param options
32
+ * @returns
33
+ */
34
+ function getScopeConsentVersionDetailsV2(options) {
35
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/v2/consent/versions/details/" + options.scopeid + "?locale=" + options.locale;
36
+ return Helper_1.Helper.createPostPromise(undefined, _serviceURL, false, "GET", options.access_token);
37
+ }
38
+ ConsentService.getScopeConsentVersionDetailsV2 = getScopeConsentVersionDetailsV2;
39
+ ;
40
+ /**
41
+ * accept scope Consent
42
+ * @param options
43
+ * @returns
44
+ */
45
+ function acceptScopeConsent(options) {
46
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/scope/accept";
47
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
48
+ }
49
+ ConsentService.acceptScopeConsent = acceptScopeConsent;
50
+ ;
51
+ /**
52
+ * accept claim Consent
53
+ * @param options
54
+ * @returns
55
+ */
56
+ function acceptClaimConsent(options) {
57
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/accept";
58
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
59
+ }
60
+ ConsentService.acceptClaimConsent = acceptClaimConsent;
61
+ ;
62
+ /**
63
+ * revoke claim Consent
64
+ * @param options
65
+ * @returns
66
+ */
67
+ function revokeClaimConsent(options) {
68
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/revoke";
69
+ return Helper_1.Helper.createPostPromise(options, _serviceURL, false, "POST");
70
+ }
71
+ ConsentService.revokeClaimConsent = revokeClaimConsent;
72
+ ;
73
+ })(ConsentService = exports.ConsentService || (exports.ConsentService = {}));