@frontegg/rest-api 3.0.9 → 3.0.12
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.js +1 -1
- package/auth/interfaces.d.ts +16 -4
- package/auth/secutiry-poilicy/index.d.ts +23 -1
- package/auth/secutiry-poilicy/index.js +16 -1
- package/auth/secutiry-poilicy/interfaces.d.ts +23 -0
- package/auth/secutiry-poilicy/interfaces.js +6 -1
- package/constants.d.ts +5 -0
- package/constants.js +5 -0
- package/index.js +1 -1
- package/node/auth/index.js +1 -1
- package/node/auth/secutiry-poilicy/index.js +25 -0
- package/node/auth/secutiry-poilicy/interfaces.js +9 -1
- package/node/constants.js +5 -0
- package/node/index.js +1 -1
- package/package.json +1 -1
package/auth/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function generateLoginResponseFromOAuthResponse(oauthResponse) {
|
|
|
52
52
|
accessToken: oauthResponse.id_token,
|
|
53
53
|
refreshToken: oauthResponse.refresh_token
|
|
54
54
|
}, decodedContent, me, {
|
|
55
|
-
expiresIn: decodedContent.exp ? decodedContent.exp - new Date().getTime() / 1000 : 300
|
|
55
|
+
expiresIn: decodedContent.exp ? Math.ceil(decodedContent.exp - new Date().getTime() / 1000) : 300
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
ContextHolder.setUser(user);
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -277,12 +277,18 @@ export interface IAllowedToRememberMfaDevice {
|
|
|
277
277
|
isAllowedToRemember: boolean;
|
|
278
278
|
mfaDeviceExpiration: number;
|
|
279
279
|
}
|
|
280
|
-
export interface
|
|
281
|
-
email: string;
|
|
280
|
+
export interface IBasePasswordlessPreLogin {
|
|
282
281
|
recaptchaToken?: string;
|
|
283
282
|
type: AuthStrategyEnum;
|
|
284
283
|
invitationToken?: string;
|
|
285
284
|
}
|
|
285
|
+
export interface IEmailPasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
286
|
+
email: string;
|
|
287
|
+
}
|
|
288
|
+
export interface IUserIDPasswordlessPreLogin extends IBasePasswordlessPreLogin {
|
|
289
|
+
userId: string;
|
|
290
|
+
}
|
|
291
|
+
export declare type IPasswordlessPreLogin = IEmailPasswordlessPreLogin | IUserIDPasswordlessPreLogin;
|
|
286
292
|
export interface IPasswordlessPostLogin {
|
|
287
293
|
token: string;
|
|
288
294
|
recaptchaToken?: string;
|
|
@@ -367,10 +373,16 @@ interface WebAuthnLoginResponse {
|
|
|
367
373
|
signature: string;
|
|
368
374
|
userHandle?: string;
|
|
369
375
|
}
|
|
370
|
-
export interface
|
|
371
|
-
email: string;
|
|
376
|
+
export interface IBaseWebAuthnPreLogin {
|
|
372
377
|
recaptchaToken?: string;
|
|
373
378
|
}
|
|
379
|
+
export interface IEmailWebAuthnPreLogin extends IBaseWebAuthnPreLogin {
|
|
380
|
+
email: string;
|
|
381
|
+
}
|
|
382
|
+
export interface IUserIDWebAuthnPreLogin extends IBaseWebAuthnPreLogin {
|
|
383
|
+
userId: string;
|
|
384
|
+
}
|
|
385
|
+
export declare type IWebAuthnPreLogin = IEmailWebAuthnPreLogin | IUserIDWebAuthnPreLogin;
|
|
374
386
|
interface AllowCredentials {
|
|
375
387
|
type: string;
|
|
376
388
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISaveSecurityPolicyMfa, ISaveSecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyLockout, ISecurityPolicyCaptcha, ISecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, ISecurityPolicy } from './interfaces';
|
|
1
|
+
import { ISaveSecurityPolicyMfa, ISaveSecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyLockout, ISecurityPolicyCaptcha, ISecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, ISecurityPolicy, DomainRestriction, DomainRestrictionConfig, CreateDomainRestriction, UpdateDomainRestrictionsConfig } from './interfaces';
|
|
2
2
|
/**
|
|
3
3
|
* Get global secure access configuration
|
|
4
4
|
*/
|
|
@@ -39,3 +39,25 @@ export declare function savePasswordHistoryPolicy(body: ISaveSecurityPolicyPassw
|
|
|
39
39
|
* load vendor password configuration.
|
|
40
40
|
*/
|
|
41
41
|
export declare function getPasswordConfigPolicy(): Promise<ISecurityPolicyPasswordConfig>;
|
|
42
|
+
/**
|
|
43
|
+
* Get domain restrictions for tenant
|
|
44
|
+
*/
|
|
45
|
+
export declare function getDomainRestrictions(): Promise<{
|
|
46
|
+
items: DomainRestriction[];
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Get domain restrictions config for tenant
|
|
50
|
+
*/
|
|
51
|
+
export declare function getDomainRestrictionsConfig(): Promise<DomainRestrictionConfig>;
|
|
52
|
+
/**
|
|
53
|
+
* Create domain restriction for tenant
|
|
54
|
+
*/
|
|
55
|
+
export declare function createDomainRestriction(body: CreateDomainRestriction): Promise<DomainRestriction>;
|
|
56
|
+
/**
|
|
57
|
+
* Update domain restrictions config for tenant
|
|
58
|
+
*/
|
|
59
|
+
export declare function updateDomainRestrictionConfig(body: UpdateDomainRestrictionsConfig): Promise<DomainRestrictionConfig>;
|
|
60
|
+
/**
|
|
61
|
+
* Delete domain restriction for tenant by id
|
|
62
|
+
*/
|
|
63
|
+
export declare function deleteDomainRestriction(id: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Get, Patch, Post } from '../../fetch';
|
|
1
|
+
import { Delete, Get, Patch, Post } from '../../fetch';
|
|
2
2
|
import { urls } from '../../constants';
|
|
3
3
|
export async function getGlobalSecurityPolicy() {
|
|
4
4
|
return Get(urls.identity.configurations.v1);
|
|
@@ -45,4 +45,19 @@ export async function savePasswordHistoryPolicy(body) {
|
|
|
45
45
|
}
|
|
46
46
|
export async function getPasswordConfigPolicy() {
|
|
47
47
|
return Get(`${urls.identity.configurations.v1}/password`);
|
|
48
|
+
}
|
|
49
|
+
export async function getDomainRestrictions() {
|
|
50
|
+
return Get(`${urls.identity.restrictions.emailDomain.v1}`);
|
|
51
|
+
}
|
|
52
|
+
export async function getDomainRestrictionsConfig() {
|
|
53
|
+
return Get(`${urls.identity.restrictions.emailDomain.v1}/config`);
|
|
54
|
+
}
|
|
55
|
+
export async function createDomainRestriction(body) {
|
|
56
|
+
return Post(`${urls.identity.restrictions.emailDomain.v1}`, body);
|
|
57
|
+
}
|
|
58
|
+
export async function updateDomainRestrictionConfig(body) {
|
|
59
|
+
return Post(`${urls.identity.restrictions.emailDomain.v1}/config`, body);
|
|
60
|
+
}
|
|
61
|
+
export async function deleteDomainRestriction(id) {
|
|
62
|
+
return Delete(`${urls.identity.restrictions.emailDomain.v1}/${id}`);
|
|
48
63
|
}
|
|
@@ -68,3 +68,26 @@ export interface TestConfig {
|
|
|
68
68
|
minOptionalTestsToPass: number;
|
|
69
69
|
}
|
|
70
70
|
export declare type ISecurityPolicyPasswordConfig = Partial<TestConfig>;
|
|
71
|
+
export declare enum RestrictionType {
|
|
72
|
+
ALLOW = "ALLOW",
|
|
73
|
+
BLOCK = "BLOCK"
|
|
74
|
+
}
|
|
75
|
+
export interface UpdateDomainRestrictionsConfig {
|
|
76
|
+
active: boolean;
|
|
77
|
+
blockPublicDomains?: boolean;
|
|
78
|
+
type?: RestrictionType;
|
|
79
|
+
}
|
|
80
|
+
export interface CreateDomainRestriction {
|
|
81
|
+
domain: string;
|
|
82
|
+
type: RestrictionType;
|
|
83
|
+
}
|
|
84
|
+
export interface DomainRestriction {
|
|
85
|
+
id: string;
|
|
86
|
+
domain: string;
|
|
87
|
+
type: RestrictionType;
|
|
88
|
+
}
|
|
89
|
+
export interface DomainRestrictionConfig {
|
|
90
|
+
active: boolean;
|
|
91
|
+
listType: RestrictionType;
|
|
92
|
+
blockPublicDomains: boolean;
|
|
93
|
+
}
|
package/constants.d.ts
CHANGED
package/constants.js
CHANGED
|
@@ -32,6 +32,11 @@ export const urls = {
|
|
|
32
32
|
configurations: {
|
|
33
33
|
v1: '/identity/resources/configurations/v1'
|
|
34
34
|
},
|
|
35
|
+
restrictions: {
|
|
36
|
+
emailDomain: {
|
|
37
|
+
v1: "/identity/resources/configurations/restrictions/v1/email-domain"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
35
40
|
sso: {
|
|
36
41
|
v1: '/identity/resources/sso/v1',
|
|
37
42
|
v2: '/identity/resources/sso/v2'
|
package/index.js
CHANGED
package/node/auth/index.js
CHANGED
|
@@ -274,7 +274,7 @@ async function generateLoginResponseFromOAuthResponse(oauthResponse) {
|
|
|
274
274
|
accessToken: oauthResponse.id_token,
|
|
275
275
|
refreshToken: oauthResponse.refresh_token
|
|
276
276
|
}, decodedContent, me, {
|
|
277
|
-
expiresIn: decodedContent.exp ? decodedContent.exp - new Date().getTime() / 1000 : 300
|
|
277
|
+
expiresIn: decodedContent.exp ? Math.ceil(decodedContent.exp - new Date().getTime() / 1000) : 300
|
|
278
278
|
});
|
|
279
279
|
|
|
280
280
|
_ContextHolder.ContextHolder.setUser(user);
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.createDomainRestriction = createDomainRestriction;
|
|
7
|
+
exports.deleteDomainRestriction = deleteDomainRestriction;
|
|
6
8
|
exports.getCaptchaPolicy = getCaptchaPolicy;
|
|
9
|
+
exports.getDomainRestrictions = getDomainRestrictions;
|
|
10
|
+
exports.getDomainRestrictionsConfig = getDomainRestrictionsConfig;
|
|
7
11
|
exports.getGlobalSecurityPolicy = getGlobalSecurityPolicy;
|
|
8
12
|
exports.getLockoutPolicy = getLockoutPolicy;
|
|
9
13
|
exports.getMfaPolicy = getMfaPolicy;
|
|
@@ -13,6 +17,7 @@ exports.getVendorMfaPolicy = getVendorMfaPolicy;
|
|
|
13
17
|
exports.saveLockoutPolicy = saveLockoutPolicy;
|
|
14
18
|
exports.saveMfaPolicy = saveMfaPolicy;
|
|
15
19
|
exports.savePasswordHistoryPolicy = savePasswordHistoryPolicy;
|
|
20
|
+
exports.updateDomainRestrictionConfig = updateDomainRestrictionConfig;
|
|
16
21
|
|
|
17
22
|
var _fetch = require("../../fetch");
|
|
18
23
|
|
|
@@ -72,4 +77,24 @@ async function savePasswordHistoryPolicy(body) {
|
|
|
72
77
|
|
|
73
78
|
async function getPasswordConfigPolicy() {
|
|
74
79
|
return (0, _fetch.Get)(`${_constants.urls.identity.configurations.v1}/password`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function getDomainRestrictions() {
|
|
83
|
+
return (0, _fetch.Get)(`${_constants.urls.identity.restrictions.emailDomain.v1}`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function getDomainRestrictionsConfig() {
|
|
87
|
+
return (0, _fetch.Get)(`${_constants.urls.identity.restrictions.emailDomain.v1}/config`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function createDomainRestriction(body) {
|
|
91
|
+
return (0, _fetch.Post)(`${_constants.urls.identity.restrictions.emailDomain.v1}`, body);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function updateDomainRestrictionConfig(body) {
|
|
95
|
+
return (0, _fetch.Post)(`${_constants.urls.identity.restrictions.emailDomain.v1}/config`, body);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function deleteDomainRestriction(id) {
|
|
99
|
+
return (0, _fetch.Delete)(`${_constants.urls.identity.restrictions.emailDomain.v1}/${id}`);
|
|
75
100
|
}
|
|
@@ -2,4 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.RestrictionType = void 0;
|
|
7
|
+
let RestrictionType;
|
|
8
|
+
exports.RestrictionType = RestrictionType;
|
|
9
|
+
|
|
10
|
+
(function (RestrictionType) {
|
|
11
|
+
RestrictionType["ALLOW"] = "ALLOW";
|
|
12
|
+
RestrictionType["BLOCK"] = "BLOCK";
|
|
13
|
+
})(RestrictionType || (exports.RestrictionType = RestrictionType = {}));
|
package/node/constants.js
CHANGED
|
@@ -38,6 +38,11 @@ const urls = {
|
|
|
38
38
|
configurations: {
|
|
39
39
|
v1: '/identity/resources/configurations/v1'
|
|
40
40
|
},
|
|
41
|
+
restrictions: {
|
|
42
|
+
emailDomain: {
|
|
43
|
+
v1: "/identity/resources/configurations/restrictions/v1/email-domain"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
41
46
|
sso: {
|
|
42
47
|
v1: '/identity/resources/sso/v1',
|
|
43
48
|
v2: '/identity/resources/sso/v2'
|
package/node/index.js
CHANGED