@asgardeo/auth-react 1.1.18 → 1.1.20
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/dist/main.js +6 -6
- package/dist/src/authenticate.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +3 -3
- package/package.json +4 -3
- package/src/authenticate.tsx +30 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEH,iBAAiB,EAQpB,MAAM,oBAAoB,CAAC;AAE5B,OAAc,EACV,iBAAiB,EAEjB,iBAAiB,EACjB,SAAS,EAOZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAe,MAAM,GAAG,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAcrF,UAAU,0BAA0B;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEH,iBAAiB,EAQpB,MAAM,oBAAoB,CAAC;AAE5B,OAAc,EACV,iBAAiB,EAEjB,iBAAiB,EACjB,SAAS,EAOZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAe,MAAM,GAAG,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAcrF,UAAU,0BAA0B;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CA6OlF,CAAC;AAEF,QAAA,MAAM,cAAc,QAAO,oBAE1B,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -447,8 +447,8 @@
|
|
|
447
447
|
"affectsGlobalScope": false
|
|
448
448
|
},
|
|
449
449
|
"../../node_modules/@asgardeo/auth-spa/dist/src/helpers/authentication-helper.d.ts": {
|
|
450
|
-
"version": "
|
|
451
|
-
"signature": "
|
|
450
|
+
"version": "d1f48e47f7da8b8bd55d928bfec7a25ed129acee01e2ceab603cd6d283084957",
|
|
451
|
+
"signature": "d1f48e47f7da8b8bd55d928bfec7a25ed129acee01e2ceab603cd6d283084957",
|
|
452
452
|
"affectsGlobalScope": false
|
|
453
453
|
},
|
|
454
454
|
"../../node_modules/@asgardeo/auth-spa/dist/src/helpers/session-management-helper.d.ts": {
|
|
@@ -621,7 +621,7 @@
|
|
|
621
621
|
"affectsGlobalScope": false
|
|
622
622
|
},
|
|
623
623
|
"../src/authenticate.tsx": {
|
|
624
|
-
"version": "
|
|
624
|
+
"version": "a3632fa1bf637067b6aa5dfd7ab8ad0486e4349dc7d1129055b2e43d179a3d50",
|
|
625
625
|
"signature": "150d2de23192873482689c0b27ce8d8aa18d83441455f5402821f15f64b59133",
|
|
626
626
|
"affectsGlobalScope": false
|
|
627
627
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/auth-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Asgardeo Auth React SDK for React Applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"WSO2",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"lint": "eslint --ext .js,.ts .",
|
|
22
22
|
"fix-lint": "eslint --ext .js,.ts . --fix",
|
|
23
|
-
"build": "rimraf dist && npm run type-check && webpack -p --env.NODE_ENV=production",
|
|
23
|
+
"build": "rimraf dist && npm run type-check && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack -p --env.NODE_ENV=production",
|
|
24
24
|
"build:dev": "rimraf dist && npm run type-check && webpack -p --env.NODE_ENV=development",
|
|
25
25
|
"build:watch": "npm run build:dev -- --watch",
|
|
26
26
|
"type-check": "tsc --emitDeclarationOnly",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"author": "WSO2",
|
|
38
38
|
"license": "Apache-2.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@asgardeo/auth-spa": "^0.4.
|
|
40
|
+
"@asgardeo/auth-spa": "^0.4.10"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/cli": "^7.10.5",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@typescript-eslint/parser": "^3.10.1",
|
|
55
55
|
"babel-loader": "^8.1.0",
|
|
56
56
|
"core-js": "^3.8.3",
|
|
57
|
+
"cross-env": "^7.0.3",
|
|
57
58
|
"eslint": "^7.20.0",
|
|
58
59
|
"eslint-plugin-import": "^2.20.2",
|
|
59
60
|
"eslint-plugin-react": "^7.18.3",
|
package/src/authenticate.tsx
CHANGED
|
@@ -141,6 +141,7 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
141
141
|
}
|
|
142
142
|
(async () => {
|
|
143
143
|
setInitialized(await AuthClient.init(config));
|
|
144
|
+
checkIsAuthenticated();
|
|
144
145
|
})();
|
|
145
146
|
|
|
146
147
|
}, [ config ]);
|
|
@@ -238,6 +239,35 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
238
239
|
|
|
239
240
|
}, [ config ]);
|
|
240
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Check if the user is authenticated and update the state.isAuthenticated value.
|
|
244
|
+
*/
|
|
245
|
+
const checkIsAuthenticated = async () => {
|
|
246
|
+
const isAuthenticatedState = await AuthClient.isAuthenticated();
|
|
247
|
+
|
|
248
|
+
if (isAuthenticatedState) {
|
|
249
|
+
const response = await AuthClient.getBasicUserInfo();
|
|
250
|
+
|
|
251
|
+
if (response) {
|
|
252
|
+
const stateToUpdate ={
|
|
253
|
+
allowedScopes: response.allowedScopes,
|
|
254
|
+
displayName: response.displayName,
|
|
255
|
+
email: response.email,
|
|
256
|
+
isAuthenticated: true,
|
|
257
|
+
isLoading: false,
|
|
258
|
+
isSigningOut: false,
|
|
259
|
+
sub: response.sub,
|
|
260
|
+
username: response.username
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
AuthClient.updateState(stateToUpdate);
|
|
264
|
+
dispatch({ ...state, ...stateToUpdate });
|
|
265
|
+
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
241
271
|
/**
|
|
242
272
|
* Render state and special case actions
|
|
243
273
|
*/
|