@asgardeo/auth-react 0.2.14 → 0.2.15
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 +3 -3
- package/dist/src/api.d.ts +3 -2
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/authenticate.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +14 -3
- package/package.json +2 -2
- package/src/api.ts +6 -6
- package/src/authenticate.tsx +7 -7
package/dist/src/api.d.ts
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AuthClientConfig, BasicUserInfo, Config,
|
|
18
|
+
import { AuthClientConfig, BasicUserInfo, Config, DecodedIDTokenPayload, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig } from "@asgardeo/auth-spa";
|
|
19
|
+
import { SPACustomGrantConfig } from "@asgardeo/auth-spa/src/models/request-custom-grant";
|
|
19
20
|
import { AuthStateInterface } from "./models";
|
|
20
21
|
declare class AuthAPI {
|
|
21
22
|
static DEFAULT_STATE: AuthStateInterface;
|
|
@@ -92,7 +93,7 @@ declare class AuthAPI {
|
|
|
92
93
|
* @return {Promise<HttpResponse<any> | SignInResponse>} - A Promise that resolves with
|
|
93
94
|
* the value returned by the custom grant request.
|
|
94
95
|
*/
|
|
95
|
-
requestCustomGrant(config:
|
|
96
|
+
requestCustomGrant(config: SPACustomGrantConfig, callback: (response: BasicUserInfo | HttpResponse<any>) => void, dispatch: (state: AuthStateInterface) => void): Promise<BasicUserInfo | HttpResponse<any>>;
|
|
96
97
|
/**
|
|
97
98
|
* This method ends a user session. The access token is revoked and the session information is destroyed.
|
|
98
99
|
*
|
package/dist/src/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings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OAIG;IACU,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAInD;;;;OAIG;IACU,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAInF;;;;;;;OAOG;IACI,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1F,EAAE,CACL,IAAI,EACE,KAAK,CAAC,iBAAiB,GACvB,KAAK,CAAC,gBAAgB,GACtB,KAAK,CAAC,iBAAiB,GACvB,KAAK,CAAC,gBAAgB,GACtB,KAAK,CAAC,kBAAkB,GACxB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,MAAM,GACZ,KAAK,CAAC,OAAO,EACnB,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI,GACnC,OAAO,CAAC,IAAI,CAAC;IAShB;;;;;;;;;;;;OAYG;IACU,iBAAiB,CAC1B,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAC9C,OAAO,CAAC,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;CAmClD;AAYD,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,OAAc,EACV,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authenticate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,OAAc,EACV,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EAMZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAe,MAAM,GAAG,CAAC;AAC5C,OAAO,OAAO,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AASrF,QAAA,MAAM,UAAU,SAAgB,CAAC;AAOjC,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;CAC1B;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAiKlF,CAAC;AAEF,QAAA,MAAM,cAAc,QAAO,oBAE1B,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -406,14 +406,18 @@
|
|
|
406
406
|
"signature": "3edc1ec4c12ee0daeab68101174cf35cfebb1759ed1acf0ca77fa37388450d0e",
|
|
407
407
|
"affectsGlobalScope": false
|
|
408
408
|
},
|
|
409
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts": {
|
|
410
|
+
"version": "d4551be00948f205f7308e09464d715e062deed201dc3398db97d2db12247bbc",
|
|
411
|
+
"affectsGlobalScope": false
|
|
412
|
+
},
|
|
409
413
|
"../src/models.ts": {
|
|
410
414
|
"version": "68821090b6c7b75c8cfd17beddff5e06bb0424f9499178b706891bc4d31827f1",
|
|
411
415
|
"signature": "ef98881a82152837495b3266a0e9a4c261bba36f95abdc434fdb86e9c6f4638d",
|
|
412
416
|
"affectsGlobalScope": false
|
|
413
417
|
},
|
|
414
418
|
"../src/api.ts": {
|
|
415
|
-
"version": "
|
|
416
|
-
"signature": "
|
|
419
|
+
"version": "8a5e3b050ba92d7b4e16e09cc71def74bb30279a1024cd8176fdc08eef6e54a6",
|
|
420
|
+
"signature": "9fb3711e9bc6c53d16a605665ce36c21ec8c9cf9a20f4191ef57b06edcd9c436",
|
|
417
421
|
"affectsGlobalScope": false
|
|
418
422
|
},
|
|
419
423
|
"../../node_modules/@types/react/global.d.ts": {
|
|
@@ -527,7 +531,7 @@
|
|
|
527
531
|
"affectsGlobalScope": false
|
|
528
532
|
},
|
|
529
533
|
"../src/authenticate.tsx": {
|
|
530
|
-
"version": "
|
|
534
|
+
"version": "4834ea3d30997223d582a345c4c2b1686fee710e36e5b8c37019b07c30061775",
|
|
531
535
|
"signature": "336cb282ec49398aece02113130600346cc39c172377aad24e5cb639ce3d226b",
|
|
532
536
|
"affectsGlobalScope": false
|
|
533
537
|
},
|
|
@@ -1094,10 +1098,12 @@
|
|
|
1094
1098
|
],
|
|
1095
1099
|
"../src/api.ts": [
|
|
1096
1100
|
"../../node_modules/@asgardeo/auth-spa/dist/src/index.d.ts",
|
|
1101
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts",
|
|
1097
1102
|
"../src/models.ts"
|
|
1098
1103
|
],
|
|
1099
1104
|
"../src/authenticate.tsx": [
|
|
1100
1105
|
"../../node_modules/@asgardeo/auth-spa/dist/src/index.d.ts",
|
|
1106
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts",
|
|
1101
1107
|
"../../node_modules/@types/react/index.d.ts",
|
|
1102
1108
|
"../src/api.ts",
|
|
1103
1109
|
"../src/index.ts",
|
|
@@ -1269,6 +1275,9 @@
|
|
|
1269
1275
|
"../../node_modules/@asgardeo/auth-spa/dist/src/models/index.d.ts",
|
|
1270
1276
|
"../../node_modules/@asgardeo/auth-spa/dist/src/utils/spa-utils.d.ts"
|
|
1271
1277
|
],
|
|
1278
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts": [
|
|
1279
|
+
"../../node_modules/@asgardeo/auth-js/dist/src/index.d.ts"
|
|
1280
|
+
],
|
|
1272
1281
|
"../../node_modules/@types/glob/index.d.ts": [
|
|
1273
1282
|
"../../node_modules/@types/minimatch/index.d.ts",
|
|
1274
1283
|
"../node_modules/@types/node/events.d.ts",
|
|
@@ -1576,6 +1585,7 @@
|
|
|
1576
1585
|
],
|
|
1577
1586
|
"../src/api.ts": [
|
|
1578
1587
|
"../../node_modules/@asgardeo/auth-spa/dist/src/index.d.ts",
|
|
1588
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts",
|
|
1579
1589
|
"../src/models.ts"
|
|
1580
1590
|
],
|
|
1581
1591
|
"../src/authenticate.tsx": [
|
|
@@ -2026,6 +2036,7 @@
|
|
|
2026
2036
|
"../../node_modules/@asgardeo/auth-spa/dist/src/models/web-worker.d.ts",
|
|
2027
2037
|
"../../node_modules/@asgardeo/auth-spa/dist/src/public-api.d.ts",
|
|
2028
2038
|
"../../node_modules/@asgardeo/auth-spa/dist/src/utils/spa-utils.d.ts",
|
|
2039
|
+
"../../node_modules/@asgardeo/auth-spa/src/models/request-custom-grant.ts",
|
|
2029
2040
|
"../../node_modules/@types/eslint-visitor-keys/index.d.ts",
|
|
2030
2041
|
"../../node_modules/@types/glob/index.d.ts",
|
|
2031
2042
|
"../../node_modules/@types/history/DOMUtils.d.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/auth-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Asgardeo Auth React SDK for React Applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"WSO2",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"author": "WSO2",
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@asgardeo/auth-spa": "^0.2.
|
|
39
|
+
"@asgardeo/auth-spa": "^0.2.19"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@babel/cli": "^7.10.5",
|
package/src/api.ts
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
AuthClientConfig,
|
|
22
22
|
BasicUserInfo,
|
|
23
23
|
Config,
|
|
24
|
-
CustomGrantConfig,
|
|
25
24
|
DecodedIDTokenPayload,
|
|
26
25
|
Hooks,
|
|
27
26
|
HttpClientInstance,
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
OIDCEndpoints,
|
|
31
30
|
SignInConfig
|
|
32
31
|
} from "@asgardeo/auth-spa";
|
|
32
|
+
import { SPACustomGrantConfig } from "@asgardeo/auth-spa/src/models/request-custom-grant";
|
|
33
33
|
import { AuthStateInterface } from "./models";
|
|
34
34
|
|
|
35
35
|
class AuthAPI {
|
|
@@ -197,7 +197,7 @@ class AuthAPI {
|
|
|
197
197
|
* the value returned by the custom grant request.
|
|
198
198
|
*/
|
|
199
199
|
public requestCustomGrant(
|
|
200
|
-
config:
|
|
200
|
+
config: SPACustomGrantConfig,
|
|
201
201
|
callback: (response: BasicUserInfo | HttpResponse<any>) => void,
|
|
202
202
|
dispatch: (state: AuthStateInterface) => void
|
|
203
203
|
): Promise<BasicUserInfo | HttpResponse<any>> {
|
|
@@ -405,9 +405,9 @@ class AuthAPI {
|
|
|
405
405
|
email: basicUserInfo.email,
|
|
406
406
|
isAuthenticated: true,
|
|
407
407
|
isLoading: false,
|
|
408
|
-
username: basicUserInfo.username,
|
|
409
408
|
isSigningOut: false,
|
|
410
|
-
sub: basicUserInfo.sub
|
|
409
|
+
sub: basicUserInfo.sub,
|
|
410
|
+
username: basicUserInfo.username
|
|
411
411
|
};
|
|
412
412
|
|
|
413
413
|
this.updateState(stateToUpdate);
|
|
@@ -429,8 +429,8 @@ AuthAPI.DEFAULT_STATE = {
|
|
|
429
429
|
email: "",
|
|
430
430
|
isAuthenticated: false,
|
|
431
431
|
isLoading: true,
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
sub: "",
|
|
433
|
+
username: ""
|
|
434
434
|
};
|
|
435
435
|
|
|
436
436
|
export default AuthAPI;
|
package/src/authenticate.tsx
CHANGED
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
import {
|
|
20
20
|
AuthClientConfig,
|
|
21
21
|
BasicUserInfo,
|
|
22
|
-
CustomGrantConfig,
|
|
23
22
|
Hooks,
|
|
24
23
|
HttpRequestConfig,
|
|
25
24
|
HttpResponse,
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
SPAUtils,
|
|
26
|
+
SignInConfig
|
|
28
27
|
} from "@asgardeo/auth-spa";
|
|
28
|
+
import { SPACustomGrantConfig } from "@asgardeo/auth-spa/src/models/request-custom-grant";
|
|
29
29
|
import React, {
|
|
30
30
|
FunctionComponent,
|
|
31
31
|
PropsWithChildren,
|
|
32
|
+
ReactNode,
|
|
32
33
|
createContext,
|
|
33
34
|
useContext,
|
|
34
35
|
useEffect,
|
|
35
36
|
useMemo,
|
|
36
|
-
useState
|
|
37
|
-
ReactNode
|
|
37
|
+
useState
|
|
38
38
|
} from "react";
|
|
39
39
|
import { AuthParams, ReactConfig } from ".";
|
|
40
40
|
import AuthAPI from "./api";
|
|
@@ -88,7 +88,7 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
88
88
|
const httpRequest = (config: HttpRequestConfig) => AuthClient.httpRequest(config);
|
|
89
89
|
const httpRequestAll = (configs: HttpRequestConfig[]) => AuthClient.httpRequestAll(configs);
|
|
90
90
|
const requestCustomGrant = (
|
|
91
|
-
config:
|
|
91
|
+
config: SPACustomGrantConfig,
|
|
92
92
|
callback?: (response: BasicUserInfo | HttpResponse<any>) => void
|
|
93
93
|
) => AuthClient.requestCustomGrant(config, callback, dispatch);
|
|
94
94
|
const revokeAccessToken = () => AuthClient.revokeAccessToken(dispatch);
|
|
@@ -178,7 +178,7 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
|
|
|
178
178
|
// This uses the RP iframe to get the session. Hence, will not work if 3rd party cookies are disabled.
|
|
179
179
|
// If the browser has these cookies disabled, we'll not be able to retrieve the session on refreshes.
|
|
180
180
|
await trySignInSilently()
|
|
181
|
-
.then((
|
|
181
|
+
.then(() => {
|
|
182
182
|
// TODO: Add logs when a logger is available.
|
|
183
183
|
// Tracked here https://github.com/asgardeo/asgardeo-auth-js-sdk/issues/151.
|
|
184
184
|
})
|