@nsshunt/stsutils 1.8.2 → 1.8.5
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/authutilsbrowser.js +2 -23
- package/oauth2terms.js +3 -2
- package/package.json +1 -1
package/authutilsbrowser.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
const debug = require('debug')(`stsutils`);
|
|
2
|
-
const colors = require('colors');
|
|
3
2
|
const axios = require('axios');
|
|
4
3
|
|
|
5
4
|
class AuthUtilsBrowser
|
|
6
5
|
{
|
|
7
|
-
constructor()
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
#GetDurationColour(duration)
|
|
13
|
-
{
|
|
14
|
-
if (duration > 250) {
|
|
15
|
-
return colors.red;
|
|
16
|
-
} else if (duration > 150) {
|
|
17
|
-
return colors.magenta;
|
|
18
|
-
} else if (duration > 50) {
|
|
19
|
-
return colors.blue;
|
|
20
|
-
} else if (duration > 10) {
|
|
21
|
-
return colors.green;
|
|
22
|
-
} else {
|
|
23
|
-
return colors.black;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
6
|
LoginBrowser = async (options) => {
|
|
28
7
|
const { authendpoint, authUserName, authUserEMail, authUserPassword, defaultTimeout, publishDebug } = options;
|
|
29
8
|
try {
|
|
@@ -38,7 +17,7 @@ class AuthUtilsBrowser
|
|
|
38
17
|
,timeout: defaultTimeout
|
|
39
18
|
});
|
|
40
19
|
duration = (performance.now() - processStart).toFixed(4);
|
|
41
|
-
if (publishDebug) debug(
|
|
20
|
+
if (publishDebug) debug(`AuthUtilsBrowser.LoginBrowser request duration: [${duration}]`);
|
|
42
21
|
accessToken = retVal.data.detail.token;
|
|
43
22
|
return {
|
|
44
23
|
accessToken: accessToken,
|
|
@@ -71,7 +50,7 @@ class AuthUtilsBrowser
|
|
|
71
50
|
,withCredentials: true
|
|
72
51
|
});
|
|
73
52
|
duration = (performance.now() - processStart).toFixed(4);
|
|
74
|
-
if (publishDebug) debug(
|
|
53
|
+
if (publishDebug) debug(`AuthUtilsBrowser.RefreshAuthTokenBrowser request duration: [${duration}]`);
|
|
75
54
|
accessToken = retVal.data.detail.token;
|
|
76
55
|
return {
|
|
77
56
|
accessToken: accessToken,
|
package/oauth2terms.js
CHANGED
|
@@ -66,7 +66,8 @@ const OIDCStandardClaim = Object.freeze({
|
|
|
66
66
|
PHONE_NUMBER: 'phone_number',
|
|
67
67
|
PHONE_NUMBER_VERIFIED: 'phone_number_verified',
|
|
68
68
|
ADDRESS: 'address',
|
|
69
|
-
CLIENT_SECRET: '
|
|
69
|
+
CLIENT_SECRET: 'client_secret',
|
|
70
|
+
NONCE: 'nonce' // STS Extension
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
const OIDCAddressClaim = Object.freeze({
|
|
@@ -80,7 +81,7 @@ const OIDCAddressClaim = Object.freeze({
|
|
|
80
81
|
const compareParameterTypes = (source1, source2, authParameterTypes) => {
|
|
81
82
|
let errors = [ ];
|
|
82
83
|
authParameterTypes.forEach(authParameterType => {
|
|
83
|
-
if (source1[authParameterType
|
|
84
|
+
if (source1[authParameterType].localeCompare(source2[authParameterType]) !== 0) {
|
|
84
85
|
errors.push({
|
|
85
86
|
[OAuth2ParameterType.ERROR]: OAuth2ParameterErrorType.NOT_EQUAL.description,
|
|
86
87
|
[OAuth2ParameterType.ERROR_DESCRIPTION]: `${OAuth2ParameterErrorType.NOT_EQUAL.description}: Parameter: [${authParameterType}]`,
|