cidaas-javascript-sdk 2.4.3 → 2.5.0
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 +5 -3
- package/README.md +2 -3
- package/package.json +10 -12
- package/src/main/authentication/index.ts +223 -0
- package/src/main/global.d.ts +10 -0
- package/src/main/index.ts +6 -0
- package/src/main/web-auth/ConsentService.ts +98 -0
- package/src/main/web-auth/Entities.ts +645 -0
- package/src/main/web-auth/Helper.ts +75 -0
- package/src/main/web-auth/LoginService.ts +248 -0
- package/src/main/web-auth/TokenService.ts +196 -0
- package/src/main/web-auth/UserService.ts +388 -0
- package/src/main/web-auth/VerificationService.ts +267 -0
- package/src/main/web-auth/WebAuth.ts +1706 -0
- package/types/authentication/index.d.ts +55 -0
- package/types/authentication/index.js +262 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +9 -0
- package/types/web-auth/ConsentService.d.ts +59 -0
- package/types/web-auth/ConsentService.js +97 -0
- package/types/web-auth/Entities.d.ts +567 -0
- package/types/web-auth/Entities.js +88 -0
- package/types/web-auth/Helper.d.ts +24 -0
- package/types/web-auth/Helper.js +89 -0
- package/types/web-auth/LoginService.d.ts +102 -0
- package/types/web-auth/LoginService.js +248 -0
- package/types/web-auth/TokenService.d.ts +48 -0
- package/types/web-auth/TokenService.js +210 -0
- package/types/web-auth/UserService.d.ts +143 -0
- package/types/web-auth/UserService.js +408 -0
- package/types/web-auth/VerificationService.d.ts +125 -0
- package/types/web-auth/VerificationService.js +273 -0
- package/types/web-auth/WebAuth.d.ts +895 -0
- package/types/web-auth/WebAuth.js +1767 -0
- package/src/main/.gitkeep +0 -0
- package/src/main/authentication/index.js +0 -213
- package/src/main/index.js +0 -11
- package/src/main/web-auth/exception.js +0 -7
- package/src/main/web-auth/webauth.js +0 -1899
- package/src/test/sum.js +0 -4
- package/src/test/test.js +0 -5
- package/types/.DS_Store +0 -0
- package/types/main/authentication/index.d.ts +0 -15
- package/types/main/index.d.ts +0 -5
- package/types/main/web-auth/exception.d.ts +0 -7
- package/types/main/web-auth/webauth.d.ts +0 -141
- package/types/test/sum.d.ts +0 -2
- package/types/test/test.d.ts +0 -1
package/src/main/.gitkeep
DELETED
|
File without changes
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// authentication class
|
|
2
|
-
function Authentication() {
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// redirect sign in
|
|
7
|
-
Authentication.prototype.redirectSignIn = function(view_type) {
|
|
8
|
-
try {
|
|
9
|
-
if (window.usermanager) {
|
|
10
|
-
|
|
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";
|
|
32
|
-
}
|
|
33
|
-
} catch (ex) {
|
|
34
|
-
console.log("user manager instance is empty : " + ex);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// redirect sign in callback
|
|
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
|
-
};
|
|
60
|
-
|
|
61
|
-
// redirect sign out
|
|
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
|
-
};
|
|
82
|
-
|
|
83
|
-
// redirect sign out callback
|
|
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
|
-
};
|
|
99
|
-
|
|
100
|
-
// pop up sign in
|
|
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
|
-
};
|
|
115
|
-
|
|
116
|
-
// pop up sign in callback
|
|
117
|
-
Authentication.prototype.popupSignInCallback = function() {
|
|
118
|
-
try {
|
|
119
|
-
if (window.usermanager) {
|
|
120
|
-
window.usermanager.signinPopupCallback();
|
|
121
|
-
}
|
|
122
|
-
} catch (ex) {}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// pop up sign out
|
|
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
|
-
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// pop up sign out callback
|
|
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
|
-
};
|
|
151
|
-
|
|
152
|
-
// silent sign in
|
|
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
|
-
};
|
|
166
|
-
|
|
167
|
-
// silent sign in callback
|
|
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
|
-
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// silent sign out callback
|
|
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) {}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
module.exports = Authentication;
|
package/src/main/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var Authentication = require('./authentication');
|
|
2
|
-
var pjson = require('../../package.json');
|
|
3
|
-
var WebAuth = require('./web-auth/webauth');
|
|
4
|
-
var CustomException = require('./web-auth/exception');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
WebAuth: WebAuth,
|
|
8
|
-
CustomException:CustomException,
|
|
9
|
-
Authentication: Authentication,
|
|
10
|
-
Version: pjson.version
|
|
11
|
-
};
|