authscape 1.0.240 → 1.0.242
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/index.js +69 -23
- package/package.json +1 -1
- package/src/services/authService.js +21 -0
package/index.js
CHANGED
|
@@ -3122,8 +3122,54 @@ var authService = function authService() {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
return challenge_from_verifier;
|
|
3124
3124
|
}(),
|
|
3125
|
+
inviteUsers: function () {
|
|
3126
|
+
var _inviteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(inviteRequests) {
|
|
3127
|
+
var response;
|
|
3128
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3130
|
+
case 0:
|
|
3131
|
+
_context2.next = 2;
|
|
3132
|
+
return apiService().post(process.env.authorityUri + "/Invite/InviteUsers", inviteRequests);
|
|
3133
|
+
case 2:
|
|
3134
|
+
response = _context2.sent;
|
|
3135
|
+
return _context2.abrupt("return", response);
|
|
3136
|
+
case 4:
|
|
3137
|
+
case "end":
|
|
3138
|
+
return _context2.stop();
|
|
3139
|
+
}
|
|
3140
|
+
}, _callee2);
|
|
3141
|
+
}));
|
|
3142
|
+
function inviteUsers(_x2) {
|
|
3143
|
+
return _inviteUsers.apply(this, arguments);
|
|
3144
|
+
}
|
|
3145
|
+
return inviteUsers;
|
|
3146
|
+
}(),
|
|
3147
|
+
inviteUser: function () {
|
|
3148
|
+
var _inviteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(inviteRequest) {
|
|
3149
|
+
var inviteRequests, response;
|
|
3150
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3151
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3152
|
+
case 0:
|
|
3153
|
+
inviteRequests = [];
|
|
3154
|
+
inviteRequests.push(inviteRequest);
|
|
3155
|
+
_context3.next = 4;
|
|
3156
|
+
return apiService().post(process.env.authorityUri + "/Invite/InviteUsers", inviteRequests);
|
|
3157
|
+
case 4:
|
|
3158
|
+
response = _context3.sent;
|
|
3159
|
+
return _context3.abrupt("return", response);
|
|
3160
|
+
case 6:
|
|
3161
|
+
case "end":
|
|
3162
|
+
return _context3.stop();
|
|
3163
|
+
}
|
|
3164
|
+
}, _callee3);
|
|
3165
|
+
}));
|
|
3166
|
+
function inviteUser(_x3) {
|
|
3167
|
+
return _inviteUser.apply(this, arguments);
|
|
3168
|
+
}
|
|
3169
|
+
return inviteUser;
|
|
3170
|
+
}(),
|
|
3125
3171
|
login: function () {
|
|
3126
|
-
var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3172
|
+
var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3127
3173
|
var redirectUserUri,
|
|
3128
3174
|
dnsRecord,
|
|
3129
3175
|
deviceId,
|
|
@@ -3132,22 +3178,22 @@ var authService = function authService() {
|
|
|
3132
3178
|
challenge,
|
|
3133
3179
|
redirectUri,
|
|
3134
3180
|
loginUri,
|
|
3135
|
-
|
|
3136
|
-
return _regeneratorRuntime().wrap(function
|
|
3137
|
-
while (1) switch (
|
|
3181
|
+
_args4 = arguments;
|
|
3182
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3183
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3138
3184
|
case 0:
|
|
3139
|
-
redirectUserUri =
|
|
3140
|
-
dnsRecord =
|
|
3141
|
-
deviceId =
|
|
3185
|
+
redirectUserUri = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
|
|
3186
|
+
dnsRecord = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
|
|
3187
|
+
deviceId = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : null;
|
|
3142
3188
|
state = "1234";
|
|
3143
3189
|
if (redirectUserUri != null) {
|
|
3144
3190
|
localStorage.setItem("redirectUri", redirectUserUri);
|
|
3145
3191
|
}
|
|
3146
3192
|
verifier = authService().generateRandomString();
|
|
3147
|
-
|
|
3193
|
+
_context4.next = 8;
|
|
3148
3194
|
return authService().challenge_from_verifier(verifier);
|
|
3149
3195
|
case 8:
|
|
3150
|
-
challenge =
|
|
3196
|
+
challenge = _context4.sent;
|
|
3151
3197
|
window.localStorage.setItem("verifier", verifier);
|
|
3152
3198
|
redirectUri = window.location.origin + "/signin-oidc";
|
|
3153
3199
|
loginUri = process.env.authorityUri + "/connect/authorize?response_type=code&state=" + state + "&client_id=" + process.env.client_id + "&scope=email%20openid%20offline_access%20profile%20api1&redirect_uri=" + redirectUri + "&code_challenge=" + challenge + "&code_challenge_method=S256";
|
|
@@ -3158,9 +3204,9 @@ var authService = function authService() {
|
|
|
3158
3204
|
window.location.href = loginUri;
|
|
3159
3205
|
case 14:
|
|
3160
3206
|
case "end":
|
|
3161
|
-
return
|
|
3207
|
+
return _context4.stop();
|
|
3162
3208
|
}
|
|
3163
|
-
},
|
|
3209
|
+
}, _callee4);
|
|
3164
3210
|
}));
|
|
3165
3211
|
function login() {
|
|
3166
3212
|
return _login.apply(this, arguments);
|
|
@@ -3181,16 +3227,16 @@ var authService = function authService() {
|
|
|
3181
3227
|
window.location.href = url;
|
|
3182
3228
|
},
|
|
3183
3229
|
manageAccount: function () {
|
|
3184
|
-
var _manageAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3185
|
-
return _regeneratorRuntime().wrap(function
|
|
3186
|
-
while (1) switch (
|
|
3230
|
+
var _manageAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
3231
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3232
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3187
3233
|
case 0:
|
|
3188
3234
|
window.location.href = process.env.authorityUri + "/Identity/Account/Manage";
|
|
3189
3235
|
case 1:
|
|
3190
3236
|
case "end":
|
|
3191
|
-
return
|
|
3237
|
+
return _context5.stop();
|
|
3192
3238
|
}
|
|
3193
|
-
},
|
|
3239
|
+
}, _callee5);
|
|
3194
3240
|
}));
|
|
3195
3241
|
function manageAccount() {
|
|
3196
3242
|
return _manageAccount.apply(this, arguments);
|
|
@@ -3198,15 +3244,15 @@ var authService = function authService() {
|
|
|
3198
3244
|
return manageAccount;
|
|
3199
3245
|
}(),
|
|
3200
3246
|
logout: function () {
|
|
3201
|
-
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3247
|
+
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3202
3248
|
var redirectUri,
|
|
3203
3249
|
domainHost,
|
|
3204
3250
|
AuthUri,
|
|
3205
|
-
|
|
3206
|
-
return _regeneratorRuntime().wrap(function
|
|
3207
|
-
while (1) switch (
|
|
3251
|
+
_args6 = arguments;
|
|
3252
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3253
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3208
3254
|
case 0:
|
|
3209
|
-
redirectUri =
|
|
3255
|
+
redirectUri = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
3210
3256
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
3211
3257
|
AuthUri = process.env.authorityUri;
|
|
3212
3258
|
(0, _nookies.destroyCookie)({}, "access_token", {
|
|
@@ -3233,9 +3279,9 @@ var authService = function authService() {
|
|
|
3233
3279
|
}, 500);
|
|
3234
3280
|
case 7:
|
|
3235
3281
|
case "end":
|
|
3236
|
-
return
|
|
3282
|
+
return _context6.stop();
|
|
3237
3283
|
}
|
|
3238
|
-
},
|
|
3284
|
+
}, _callee6);
|
|
3239
3285
|
}));
|
|
3240
3286
|
function logout() {
|
|
3241
3287
|
return _logout.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -35,6 +35,27 @@ export const authService = () => {
|
|
|
35
35
|
let base64encoded = authService().base64urlencode(hashed);
|
|
36
36
|
return base64encoded;
|
|
37
37
|
},
|
|
38
|
+
inviteUsers: async (inviteRequests) => {
|
|
39
|
+
|
|
40
|
+
let response = await apiService().post(
|
|
41
|
+
process.env.authorityUri + "/Invite/InviteUsers",
|
|
42
|
+
inviteRequests
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return response;
|
|
46
|
+
},
|
|
47
|
+
inviteUser: async (inviteRequest) => {
|
|
48
|
+
|
|
49
|
+
let inviteRequests = [];
|
|
50
|
+
inviteRequests.push(inviteRequest);
|
|
51
|
+
|
|
52
|
+
let response = await apiService().post(
|
|
53
|
+
process.env.authorityUri + "/Invite/InviteUsers",
|
|
54
|
+
inviteRequests
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return response;
|
|
58
|
+
},
|
|
38
59
|
login: async (redirectUserUri = null, dnsRecord = null, deviceId = null) => {
|
|
39
60
|
|
|
40
61
|
let state = "1234";
|