@frontegg/react-hooks 6.155.0-alpha.2 → 6.155.0-alpha.4
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/auth/index.d.ts +1 -1
- package/auth/index.js +1 -1
- package/auth/stepUp/consts.d.ts +0 -12
- package/auth/stepUp/consts.js +0 -15
- package/auth/stepUp/index.d.ts +2 -0
- package/auth/stepUp/index.js +2 -0
- package/auth/stepUp/interfaces.d.ts +6 -0
- package/auth/stepUp/stepUp.d.ts +2 -4
- package/auth/stepUp/stepUp.js +8 -11
- package/index.js +1 -1
- package/node/auth/index.js +1 -1
- package/node/auth/stepUp/consts.js +1 -19
- package/node/auth/stepUp/index.js +27 -0
- package/node/auth/stepUp/stepUp.js +6 -9
- package/node/index.js +1 -1
- package/package.json +3 -3
package/auth/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './apiTokens';
|
|
|
5
5
|
export * from './forgotPassword';
|
|
6
6
|
export * from './resetPhoneNumber';
|
|
7
7
|
export * from './login';
|
|
8
|
-
export * from './stepUp
|
|
8
|
+
export * from './stepUp';
|
|
9
9
|
export * from './mfa';
|
|
10
10
|
export * from './profile';
|
|
11
11
|
export * from './signup';
|
package/auth/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from './apiTokens';
|
|
|
5
5
|
export * from './forgotPassword';
|
|
6
6
|
export * from './resetPhoneNumber';
|
|
7
7
|
export * from './login';
|
|
8
|
-
export * from './stepUp
|
|
8
|
+
export * from './stepUp';
|
|
9
9
|
export * from './mfa';
|
|
10
10
|
export * from './profile';
|
|
11
11
|
export * from './signup';
|
package/auth/stepUp/consts.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The required ACR (Authorization Context Reference) value for the step up flow
|
|
3
|
-
*/
|
|
4
|
-
export declare const ACR_VALUE = "http://schemas.openid.net/pape/policies/2007/06/multi-factor";
|
|
5
|
-
/**
|
|
6
|
-
* One of the required AMR (Authentication Methods References) values for the step up flow
|
|
7
|
-
*/
|
|
8
|
-
export declare const AMR_MFA_VALUE = "mfa";
|
|
9
|
-
/**
|
|
10
|
-
* One of the required AMR (Authentication Methods References) values should be from the array for the step up flow
|
|
11
|
-
*/
|
|
12
|
-
export declare const AMR_ADDITIONAL_VALUE: string[];
|
|
13
1
|
/**
|
|
14
2
|
* The name of the query param that contains the max age of the step up
|
|
15
3
|
*/
|
package/auth/stepUp/consts.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The required ACR (Authorization Context Reference) value for the step up flow
|
|
3
|
-
*/
|
|
4
|
-
export const ACR_VALUE = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* One of the required AMR (Authentication Methods References) values for the step up flow
|
|
8
|
-
*/
|
|
9
|
-
export const AMR_MFA_VALUE = 'mfa';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* One of the required AMR (Authentication Methods References) values should be from the array for the step up flow
|
|
13
|
-
*/
|
|
14
|
-
export const AMR_ADDITIONAL_VALUE = ['otp', 'sms', 'hwk'];
|
|
15
|
-
|
|
16
1
|
/**
|
|
17
2
|
* The name of the query param that contains the max age of the step up
|
|
18
3
|
*/
|
package/auth/stepUp/stepUp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StepUpState, StepUpActions } from '@frontegg/redux-store';
|
|
2
2
|
import { RedirectOptions } from '@frontegg/rest-api';
|
|
3
|
-
import { StepUpStateMapper } from './interfaces';
|
|
3
|
+
import { StepUpStateMapper, UseIsSteppedUpOptions } from './interfaces';
|
|
4
4
|
export declare function useStepUpState(): StepUpState;
|
|
5
5
|
export declare function useStepUpState<S>(stateMapper: StepUpStateMapper<S>): S;
|
|
6
6
|
export declare const useStepUpActions: () => StepUpActions;
|
|
@@ -24,6 +24,4 @@ export declare const useStepUp: () => any;
|
|
|
24
24
|
* @param options.maxAge - max age of step up
|
|
25
25
|
* @returns true when the user is stepped up, false otherwise
|
|
26
26
|
*/
|
|
27
|
-
export declare const useIsSteppedUp: ({ maxAge }?:
|
|
28
|
-
maxAge?: number | undefined;
|
|
29
|
-
}) => boolean;
|
|
27
|
+
export declare const useIsSteppedUp: ({ maxAge }?: UseIsSteppedUpOptions) => boolean;
|
package/auth/stepUp/stepUp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FRONTEGG_AFTER_AUTH_REDIRECT_URL, stepUpReducers, stepUpActions, getSearchParam } from '@frontegg/redux-store';
|
|
1
|
+
import { FRONTEGG_AFTER_AUTH_REDIRECT_URL, stepUpReducers, stepUpActions, getSearchParam, isSteppedUp } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator, useAuthRoutes, useAuthUser, useOnRedirectTo } from '../hooks';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { STEP_UP_MAX_AGE_PARAM_NAME } from './consts';
|
|
5
5
|
const defaultMapper = state => state;
|
|
6
6
|
export function useStepUpState(stateMapper = defaultMapper) {
|
|
7
7
|
return stateHookGenerator(stateMapper, 'stepUpState');
|
|
@@ -57,13 +57,10 @@ export const useIsSteppedUp = ({
|
|
|
57
57
|
acr = '',
|
|
58
58
|
auth_time
|
|
59
59
|
} = useAuthUser();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const isAMRIncludesMFA = amr.indexOf(AMR_MFA_VALUE) !== -1;
|
|
67
|
-
const isAMRIncludesMethod = AMR_ADDITIONAL_VALUE.find(method => amr.indexOf(method)) !== undefined;
|
|
68
|
-
return isACRValid && isAMRIncludesMFA && isAMRIncludesMethod;
|
|
60
|
+
return isSteppedUp({
|
|
61
|
+
amr,
|
|
62
|
+
acr,
|
|
63
|
+
auth_time,
|
|
64
|
+
maxAge
|
|
65
|
+
});
|
|
69
66
|
};
|
package/index.js
CHANGED
package/node/auth/index.js
CHANGED
|
@@ -134,7 +134,7 @@ Object.keys(_login).forEach(function (key) {
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
|
-
var _stepUp = require("./stepUp
|
|
137
|
+
var _stepUp = require("./stepUp");
|
|
138
138
|
Object.keys(_stepUp).forEach(function (key) {
|
|
139
139
|
if (key === "default" || key === "__esModule") return;
|
|
140
140
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -3,27 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.STEP_UP_MAX_AGE_PARAM_NAME =
|
|
7
|
-
/**
|
|
8
|
-
* The required ACR (Authorization Context Reference) value for the step up flow
|
|
9
|
-
*/
|
|
10
|
-
const ACR_VALUE = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* One of the required AMR (Authentication Methods References) values for the step up flow
|
|
14
|
-
*/
|
|
15
|
-
exports.ACR_VALUE = ACR_VALUE;
|
|
16
|
-
const AMR_MFA_VALUE = 'mfa';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* One of the required AMR (Authentication Methods References) values should be from the array for the step up flow
|
|
20
|
-
*/
|
|
21
|
-
exports.AMR_MFA_VALUE = AMR_MFA_VALUE;
|
|
22
|
-
const AMR_ADDITIONAL_VALUE = ['otp', 'sms', 'hwk'];
|
|
23
|
-
|
|
6
|
+
exports.STEP_UP_MAX_AGE_PARAM_NAME = void 0;
|
|
24
7
|
/**
|
|
25
8
|
* The name of the query param that contains the max age of the step up
|
|
26
9
|
*/
|
|
27
|
-
exports.AMR_ADDITIONAL_VALUE = AMR_ADDITIONAL_VALUE;
|
|
28
10
|
const STEP_UP_MAX_AGE_PARAM_NAME = 'maxAge';
|
|
29
11
|
exports.STEP_UP_MAX_AGE_PARAM_NAME = STEP_UP_MAX_AGE_PARAM_NAME;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _stepUp = require("./stepUp");
|
|
7
|
+
Object.keys(_stepUp).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _stepUp[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _stepUp[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _interfaces = require("./interfaces");
|
|
18
|
+
Object.keys(_interfaces).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _interfaces[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -68,14 +68,11 @@ const useIsSteppedUp = ({
|
|
|
68
68
|
acr = '',
|
|
69
69
|
auth_time
|
|
70
70
|
} = (0, _hooks.useAuthUser)();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const isAMRIncludesMFA = amr.indexOf(_consts.AMR_MFA_VALUE) !== -1;
|
|
78
|
-
const isAMRIncludesMethod = _consts.AMR_ADDITIONAL_VALUE.find(method => amr.indexOf(method)) !== undefined;
|
|
79
|
-
return isACRValid && isAMRIncludesMFA && isAMRIncludesMethod;
|
|
71
|
+
return (0, _reduxStore.isSteppedUp)({
|
|
72
|
+
amr,
|
|
73
|
+
acr,
|
|
74
|
+
auth_time,
|
|
75
|
+
maxAge
|
|
76
|
+
});
|
|
80
77
|
};
|
|
81
78
|
exports.useIsSteppedUp = useIsSteppedUp;
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.155.0-alpha.
|
|
3
|
+
"version": "6.155.0-alpha.4",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/redux-store": "6.155.0-alpha.
|
|
10
|
-
"@frontegg/types": "6.155.0-alpha.
|
|
9
|
+
"@frontegg/redux-store": "6.155.0-alpha.4",
|
|
10
|
+
"@frontegg/types": "6.155.0-alpha.4",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"react-redux": "^7.x"
|