@archbase/security 4.2.5 → 4.3.0
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.
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import * as I from "inversify";
|
|
3
|
-
import { decorate as
|
|
4
|
-
import { compressString as
|
|
3
|
+
import { decorate as Bt, injectable as Lt } from "inversify";
|
|
4
|
+
import { compressString as Ot, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ht, getI18nextInstance as x, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
|
|
5
5
|
import q from "crypto-js";
|
|
6
6
|
import { jwtDecode as qt } from "jwt-decode";
|
|
7
7
|
import { jsx as o, jsxs as C, Fragment as ie } from "react/jsx-runtime";
|
|
8
|
-
import it, { useState as p, useEffect as X, createContext as
|
|
8
|
+
import it, { useState as p, useEffect as X, createContext as He, useMemo as at, useRef as ct, useCallback as Ie, useContext as Ve } from "react";
|
|
9
9
|
import { BehaviorSubject as Ze } from "rxjs";
|
|
10
10
|
import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
|
|
11
11
|
import { v4 as Z } from "uuid";
|
|
@@ -38,11 +38,11 @@ class pt {
|
|
|
38
38
|
return new pt({});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc",
|
|
41
|
+
const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", $e = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Be = "602b05c5-ec46-451e-aba6-187e463bc245", Le = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
|
|
42
42
|
class or {
|
|
43
43
|
getUsernameAndPassword() {
|
|
44
44
|
try {
|
|
45
|
-
const e = localStorage.getItem(
|
|
45
|
+
const e = localStorage.getItem($e);
|
|
46
46
|
if (e) {
|
|
47
47
|
const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), n = atob(t).split(":");
|
|
48
48
|
return { username: n[0], password: n[1], remember: !0 };
|
|
@@ -54,11 +54,11 @@ class or {
|
|
|
54
54
|
}
|
|
55
55
|
saveUsernameAndPassword(e, t) {
|
|
56
56
|
const s = btoa(`${e}:${t}`), n = q.AES.encrypt(s, le).toString();
|
|
57
|
-
localStorage.setItem(
|
|
57
|
+
localStorage.setItem($e, n);
|
|
58
58
|
}
|
|
59
59
|
getUsername() {
|
|
60
60
|
try {
|
|
61
|
-
const e = localStorage.getItem(
|
|
61
|
+
const e = localStorage.getItem(Be);
|
|
62
62
|
if (e) {
|
|
63
63
|
const t = q.AES.decrypt(e, le).toString(q.enc.Utf8);
|
|
64
64
|
return atob(t);
|
|
@@ -70,7 +70,7 @@ class or {
|
|
|
70
70
|
}
|
|
71
71
|
saveUsername(e) {
|
|
72
72
|
const t = btoa(e), s = q.AES.encrypt(t, le).toString();
|
|
73
|
-
localStorage.setItem(
|
|
73
|
+
localStorage.setItem(Be, s);
|
|
74
74
|
}
|
|
75
75
|
isTokenExpired(e, t = 300) {
|
|
76
76
|
let s = e;
|
|
@@ -88,13 +88,13 @@ class or {
|
|
|
88
88
|
}
|
|
89
89
|
saveToken(e) {
|
|
90
90
|
if (e) {
|
|
91
|
-
const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n =
|
|
91
|
+
const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n = Ot(s);
|
|
92
92
|
localStorage.setItem(Ne, n);
|
|
93
93
|
} else
|
|
94
94
|
this.clearToken();
|
|
95
95
|
}
|
|
96
96
|
clearUsernameAndPassword() {
|
|
97
|
-
localStorage.removeItem(
|
|
97
|
+
localStorage.removeItem($e), localStorage.removeItem(Be);
|
|
98
98
|
}
|
|
99
99
|
clearToken() {
|
|
100
100
|
localStorage.removeItem(Ne);
|
|
@@ -113,24 +113,24 @@ class or {
|
|
|
113
113
|
saveContext(e) {
|
|
114
114
|
try {
|
|
115
115
|
const t = q.AES.encrypt(e, le).toString();
|
|
116
|
-
localStorage.setItem(
|
|
116
|
+
localStorage.setItem(Le, t);
|
|
117
117
|
} catch (t) {
|
|
118
118
|
console.warn("Erro ao salvar contexto:", t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
getContext() {
|
|
122
122
|
try {
|
|
123
|
-
const e = localStorage.getItem(
|
|
123
|
+
const e = localStorage.getItem(Le);
|
|
124
124
|
return e ? q.AES.decrypt(e, le).toString(q.enc.Utf8) : null;
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
clearContext() {
|
|
130
|
-
localStorage.removeItem(
|
|
130
|
+
localStorage.removeItem(Le);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
Bt(Lt(), or);
|
|
134
134
|
function ft(r) {
|
|
135
135
|
const t = new Uint8Array(1);
|
|
136
136
|
return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
|
|
@@ -368,7 +368,7 @@ const Te = (r) => {
|
|
|
368
368
|
Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
|
-
}, br =
|
|
371
|
+
}, br = He({
|
|
372
372
|
token: "",
|
|
373
373
|
login: () => null,
|
|
374
374
|
logOut: () => null,
|
|
@@ -383,7 +383,7 @@ const Te = (r) => {
|
|
|
383
383
|
"ROCP_refreshTokenExpire",
|
|
384
384
|
pe(2 * fe),
|
|
385
385
|
t.storage
|
|
386
|
-
), [i, d] = de("ROCP_token", "", t.storage), [y,
|
|
386
|
+
), [i, d] = de("ROCP_token", "", t.storage), [y, k] = de(
|
|
387
387
|
"ROCP_tokenExpire",
|
|
388
388
|
pe(fe),
|
|
389
389
|
t.storage
|
|
@@ -399,16 +399,16 @@ const Te = (r) => {
|
|
|
399
399
|
"ROCP_refreshInProgress",
|
|
400
400
|
!1,
|
|
401
401
|
t.storage
|
|
402
|
-
), [M,
|
|
402
|
+
), [M, B] = p(), [H, _] = p(), [b, m] = p(null);
|
|
403
403
|
let R;
|
|
404
|
-
function
|
|
405
|
-
n(void 0), d(""),
|
|
404
|
+
function V() {
|
|
405
|
+
n(void 0), d(""), k(pe(fe)), c(pe(fe)), U(void 0), B(void 0), _(void 0), w(!1);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
407
|
+
function L(g, v) {
|
|
408
|
+
V(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
|
|
409
409
|
}
|
|
410
410
|
function N(g) {
|
|
411
|
-
|
|
411
|
+
V(), w(!0);
|
|
412
412
|
let v = g;
|
|
413
413
|
g && typeof g != "string" && (console.warn(
|
|
414
414
|
`O estado de login aprovado deve ser do tipo 'string'. Recebido'${g}'. Ignorando o valor...`
|
|
@@ -419,7 +419,7 @@ const Te = (r) => {
|
|
|
419
419
|
function T(g) {
|
|
420
420
|
d(g.access_token), n(g.refresh_token);
|
|
421
421
|
const v = t.tokenExpiresIn ?? g.expires_in ?? fe;
|
|
422
|
-
|
|
422
|
+
k(pe(v));
|
|
423
423
|
const K = t.refreshTokenExpiresIn ?? wr(v, g);
|
|
424
424
|
c(pe(K)), U(g.id_token);
|
|
425
425
|
try {
|
|
@@ -428,7 +428,7 @@ const Te = (r) => {
|
|
|
428
428
|
console.warn(`Falha ao decodificar idToken: ${W.message}`);
|
|
429
429
|
}
|
|
430
430
|
try {
|
|
431
|
-
t.decodeToken &&
|
|
431
|
+
t.decodeToken && B(Te(g.access_token));
|
|
432
432
|
} catch (W) {
|
|
433
433
|
console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
|
|
434
434
|
}
|
|
@@ -465,7 +465,7 @@ const Te = (r) => {
|
|
|
465
465
|
const g = new URLSearchParams(window.location.search);
|
|
466
466
|
if (!g.get("code")) {
|
|
467
467
|
const v = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
|
|
468
|
-
console.error(v), m(v),
|
|
468
|
+
console.error(v), m(v), L();
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
471
|
if (!se.current) {
|
|
@@ -493,7 +493,7 @@ const Te = (r) => {
|
|
|
493
493
|
console.warn(`Falha ao decodificar idToken: ${g.message}`);
|
|
494
494
|
}
|
|
495
495
|
try {
|
|
496
|
-
t.decodeToken &&
|
|
496
|
+
t.decodeToken && B(Te(i));
|
|
497
497
|
} catch (g) {
|
|
498
498
|
console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
|
|
499
499
|
}
|
|
@@ -501,7 +501,7 @@ const Te = (r) => {
|
|
|
501
501
|
}, []), /* @__PURE__ */ o(
|
|
502
502
|
br.Provider,
|
|
503
503
|
{
|
|
504
|
-
value: { token: i, tokenData: M, idToken: h, idTokenData:
|
|
504
|
+
value: { token: i, tokenData: M, idToken: h, idTokenData: H, login: N, logOut: L, error: b, loginInProgress: A },
|
|
505
505
|
children: e
|
|
506
506
|
}
|
|
507
507
|
);
|
|
@@ -632,7 +632,7 @@ class J {
|
|
|
632
632
|
function Jr() {
|
|
633
633
|
return J.getInstance();
|
|
634
634
|
}
|
|
635
|
-
var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty,
|
|
635
|
+
var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, S = (r, e, t, s) => {
|
|
636
636
|
for (var n = void 0, a = r.length - 1, c; a >= 0; a--)
|
|
637
637
|
(c = r[a]) && (n = c(e, t, n) || n);
|
|
638
638
|
return n && Ar(e, t, n), n;
|
|
@@ -655,7 +655,7 @@ const wt = class bt {
|
|
|
655
655
|
intervals: []
|
|
656
656
|
});
|
|
657
657
|
};
|
|
658
|
-
|
|
658
|
+
S([
|
|
659
659
|
Q({
|
|
660
660
|
message: "archbase:Informe a descrição do cronograma de acesso"
|
|
661
661
|
})
|
|
@@ -683,15 +683,15 @@ const _e = class Et {
|
|
|
683
683
|
endTime: "17:00"
|
|
684
684
|
});
|
|
685
685
|
};
|
|
686
|
-
|
|
686
|
+
S([
|
|
687
687
|
ae()
|
|
688
688
|
], _e.prototype, "accessSchedule");
|
|
689
|
-
|
|
689
|
+
S([
|
|
690
690
|
Q({
|
|
691
691
|
message: "archbase:Informe a hora de início"
|
|
692
692
|
})
|
|
693
693
|
], _e.prototype, "startTime");
|
|
694
|
-
|
|
694
|
+
S([
|
|
695
695
|
Q({
|
|
696
696
|
message: "archbase:Informe a hora de término"
|
|
697
697
|
})
|
|
@@ -712,17 +712,17 @@ class ye {
|
|
|
712
712
|
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [];
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
|
-
|
|
715
|
+
S([
|
|
716
716
|
Q({
|
|
717
717
|
message: "archbase:Informe o nome"
|
|
718
718
|
})
|
|
719
719
|
], ye.prototype, "name");
|
|
720
|
-
|
|
720
|
+
S([
|
|
721
721
|
Q({
|
|
722
722
|
message: "archbase:Informe a descrição"
|
|
723
723
|
})
|
|
724
724
|
], ye.prototype, "description");
|
|
725
|
-
|
|
725
|
+
S([
|
|
726
726
|
ae()
|
|
727
727
|
], ye.prototype, "actions");
|
|
728
728
|
const ve = class xt {
|
|
@@ -741,7 +741,7 @@ const ve = class xt {
|
|
|
741
741
|
actionVersion;
|
|
742
742
|
isNewAction;
|
|
743
743
|
constructor(e) {
|
|
744
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new
|
|
744
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new kt(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
|
|
745
745
|
}
|
|
746
746
|
static newInstance = () => new xt({
|
|
747
747
|
id: Z(),
|
|
@@ -749,35 +749,35 @@ const ve = class xt {
|
|
|
749
749
|
isNewAction: !0
|
|
750
750
|
});
|
|
751
751
|
};
|
|
752
|
-
|
|
752
|
+
S([
|
|
753
753
|
Q({
|
|
754
754
|
message: "archbase:Informe o nome para a ação"
|
|
755
755
|
})
|
|
756
756
|
], ve.prototype, "name");
|
|
757
|
-
|
|
757
|
+
S([
|
|
758
758
|
Q({
|
|
759
759
|
message: "archbase:Informe a descrição para a ação"
|
|
760
760
|
})
|
|
761
761
|
], ve.prototype, "description");
|
|
762
|
-
|
|
762
|
+
S([
|
|
763
763
|
ae()
|
|
764
764
|
], ve.prototype, "resource");
|
|
765
|
-
|
|
765
|
+
S([
|
|
766
766
|
Q({
|
|
767
767
|
message: "archbase:Informe a categoria para a ação"
|
|
768
768
|
})
|
|
769
769
|
], ve.prototype, "category");
|
|
770
|
-
|
|
770
|
+
S([
|
|
771
771
|
re()
|
|
772
772
|
], ve.prototype, "active");
|
|
773
|
-
let
|
|
774
|
-
class
|
|
773
|
+
let Sr = ve;
|
|
774
|
+
class Se extends ye {
|
|
775
775
|
type;
|
|
776
776
|
isNewProfile;
|
|
777
777
|
constructor(e) {
|
|
778
778
|
super(e), this.type = me.PROFILE, this.isNewProfile = e.isNewProfile || !1;
|
|
779
779
|
}
|
|
780
|
-
static newInstance = () => new
|
|
780
|
+
static newInstance = () => new Se({
|
|
781
781
|
id: Z(),
|
|
782
782
|
isNewProfile: !0
|
|
783
783
|
});
|
|
@@ -792,25 +792,25 @@ class Ge {
|
|
|
792
792
|
lastModifiedByUser;
|
|
793
793
|
group;
|
|
794
794
|
constructor(e) {
|
|
795
|
-
this.id = e.id, this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.group = e.group ? new
|
|
795
|
+
this.id = e.id, this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.group = e.group ? new ke(e.group) : void 0;
|
|
796
796
|
}
|
|
797
797
|
static newInstance = (e) => new Ge({
|
|
798
798
|
id: Z(),
|
|
799
799
|
group: e
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
|
-
class
|
|
802
|
+
class ke extends ye {
|
|
803
803
|
type;
|
|
804
804
|
isNewGroup;
|
|
805
805
|
constructor(e) {
|
|
806
806
|
super(e), this.type = me.GROUP, this.isNewGroup = e.isNewGroup || !1;
|
|
807
807
|
}
|
|
808
|
-
static newInstance = () => new
|
|
808
|
+
static newInstance = () => new ke({
|
|
809
809
|
id: Z(),
|
|
810
810
|
isNewGroup: !0
|
|
811
811
|
});
|
|
812
812
|
}
|
|
813
|
-
const Re = class
|
|
813
|
+
const Re = class St {
|
|
814
814
|
id;
|
|
815
815
|
code;
|
|
816
816
|
version;
|
|
@@ -827,27 +827,27 @@ const Re = class kt {
|
|
|
827
827
|
constructor(e) {
|
|
828
828
|
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [], this.active = e.active || !1, this.type = e.type || "VIEW", this.isNewResource = e.isNewResource || !1;
|
|
829
829
|
}
|
|
830
|
-
static newInstance = () => new
|
|
830
|
+
static newInstance = () => new St({
|
|
831
831
|
id: Z(),
|
|
832
832
|
actions: [],
|
|
833
833
|
active: !0,
|
|
834
834
|
isNewResource: !0
|
|
835
835
|
});
|
|
836
836
|
};
|
|
837
|
-
|
|
837
|
+
S([
|
|
838
838
|
Q({
|
|
839
839
|
message: "archbase:Informe o nome para o recurso"
|
|
840
840
|
})
|
|
841
841
|
], Re.prototype, "name");
|
|
842
|
-
|
|
842
|
+
S([
|
|
843
843
|
Q({
|
|
844
844
|
message: "archbase:Informe a descrição para o recurso"
|
|
845
845
|
})
|
|
846
846
|
], Re.prototype, "description");
|
|
847
|
-
|
|
847
|
+
S([
|
|
848
848
|
re()
|
|
849
849
|
], Re.prototype, "active");
|
|
850
|
-
let
|
|
850
|
+
let kt = Re;
|
|
851
851
|
const F = class It extends ye {
|
|
852
852
|
userName;
|
|
853
853
|
password;
|
|
@@ -869,7 +869,7 @@ const F = class It extends ye {
|
|
|
869
869
|
type;
|
|
870
870
|
isNewUser;
|
|
871
871
|
constructor(e) {
|
|
872
|
-
super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new
|
|
872
|
+
super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new Se(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
|
|
873
873
|
}
|
|
874
874
|
static newInstance = () => new It({
|
|
875
875
|
id: Z(),
|
|
@@ -883,48 +883,48 @@ const F = class It extends ye {
|
|
|
883
883
|
isNewUser: !0
|
|
884
884
|
});
|
|
885
885
|
};
|
|
886
|
-
|
|
886
|
+
S([
|
|
887
887
|
Q({
|
|
888
888
|
message: "archbase:Informe o nome de usuário"
|
|
889
889
|
})
|
|
890
890
|
], F.prototype, "userName");
|
|
891
|
-
|
|
891
|
+
S([
|
|
892
892
|
re()
|
|
893
893
|
], F.prototype, "changePasswordOnNextLogin");
|
|
894
|
-
|
|
894
|
+
S([
|
|
895
895
|
re()
|
|
896
896
|
], F.prototype, "allowPasswordChange");
|
|
897
|
-
|
|
897
|
+
S([
|
|
898
898
|
re()
|
|
899
899
|
], F.prototype, "allowMultipleLogins");
|
|
900
|
-
|
|
900
|
+
S([
|
|
901
901
|
re()
|
|
902
902
|
], F.prototype, "passwordNeverExpires");
|
|
903
|
-
|
|
903
|
+
S([
|
|
904
904
|
ae()
|
|
905
905
|
], F.prototype, "passwordChangedAt");
|
|
906
|
-
|
|
906
|
+
S([
|
|
907
907
|
re()
|
|
908
908
|
], F.prototype, "accountDeactivated");
|
|
909
|
-
|
|
909
|
+
S([
|
|
910
910
|
re()
|
|
911
911
|
], F.prototype, "accountLocked");
|
|
912
|
-
|
|
912
|
+
S([
|
|
913
913
|
re()
|
|
914
914
|
], F.prototype, "unlimitedAccessHours");
|
|
915
|
-
|
|
915
|
+
S([
|
|
916
916
|
re()
|
|
917
917
|
], F.prototype, "isAdministrator");
|
|
918
|
-
|
|
918
|
+
S([
|
|
919
919
|
ae()
|
|
920
920
|
], F.prototype, "accessSchedule");
|
|
921
|
-
|
|
921
|
+
S([
|
|
922
922
|
ae()
|
|
923
923
|
], F.prototype, "groups");
|
|
924
|
-
|
|
924
|
+
S([
|
|
925
925
|
ae()
|
|
926
926
|
], F.prototype, "profile");
|
|
927
|
-
|
|
927
|
+
S([
|
|
928
928
|
Ft(
|
|
929
929
|
{},
|
|
930
930
|
{
|
|
@@ -947,14 +947,14 @@ const Je = class Fe {
|
|
|
947
947
|
companyId;
|
|
948
948
|
projectId;
|
|
949
949
|
constructor(e) {
|
|
950
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new
|
|
950
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new Sr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
|
|
951
951
|
}
|
|
952
952
|
static createDtoFromJson(e) {
|
|
953
953
|
switch (e.type) {
|
|
954
954
|
case "profile":
|
|
955
|
-
return new ke(e);
|
|
956
|
-
case "group":
|
|
957
955
|
return new Se(e);
|
|
956
|
+
case "group":
|
|
957
|
+
return new ke(e);
|
|
958
958
|
case "user":
|
|
959
959
|
return new Me(e);
|
|
960
960
|
default:
|
|
@@ -968,10 +968,10 @@ const Je = class Fe {
|
|
|
968
968
|
projectId: ""
|
|
969
969
|
});
|
|
970
970
|
};
|
|
971
|
-
|
|
971
|
+
S([
|
|
972
972
|
ae()
|
|
973
973
|
], Je.prototype, "security");
|
|
974
|
-
|
|
974
|
+
S([
|
|
975
975
|
ae()
|
|
976
976
|
], Je.prototype, "action");
|
|
977
977
|
let Kr = Je;
|
|
@@ -1061,7 +1061,7 @@ class Pt extends ge {
|
|
|
1061
1061
|
return J.getInstance().getHeaders();
|
|
1062
1062
|
}
|
|
1063
1063
|
transform(e) {
|
|
1064
|
-
return new
|
|
1064
|
+
return new ke(e);
|
|
1065
1065
|
}
|
|
1066
1066
|
getEndpoint() {
|
|
1067
1067
|
return "/api/v1/group";
|
|
@@ -1083,7 +1083,7 @@ class Tt extends ge {
|
|
|
1083
1083
|
return J.getInstance().getHeaders();
|
|
1084
1084
|
}
|
|
1085
1085
|
transform(e) {
|
|
1086
|
-
return new
|
|
1086
|
+
return new Se(e);
|
|
1087
1087
|
}
|
|
1088
1088
|
getEndpoint() {
|
|
1089
1089
|
return "/api/v1/userProfile";
|
|
@@ -1171,7 +1171,7 @@ class _t extends ge {
|
|
|
1171
1171
|
return J.getInstance().getHeaders();
|
|
1172
1172
|
}
|
|
1173
1173
|
transform(e) {
|
|
1174
|
-
return new
|
|
1174
|
+
return new kt(e);
|
|
1175
1175
|
}
|
|
1176
1176
|
getEndpoint() {
|
|
1177
1177
|
return "/api/v1/resource";
|
|
@@ -1238,6 +1238,13 @@ class Rt {
|
|
|
1238
1238
|
getEndpoint() {
|
|
1239
1239
|
return "/api/v1/security/diagnostics";
|
|
1240
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Base própria: a trilha vive fora do diagnóstico porque tem chave própria no backend
|
|
1243
|
+
* ({@code archbase.security.audit.enabled}) e some inteira quando ela está desligada.
|
|
1244
|
+
*/
|
|
1245
|
+
getAuditEndpoint() {
|
|
1246
|
+
return "/api/v1/security/audit";
|
|
1247
|
+
}
|
|
1241
1248
|
/** Retrato do tenant: contagens do catálogo e o estado das proteções configuráveis. */
|
|
1242
1249
|
async getOverview() {
|
|
1243
1250
|
return this.client.get(`${this.getEndpoint()}/overview`, this.configureHeaders());
|
|
@@ -1321,6 +1328,22 @@ class Rt {
|
|
|
1321
1328
|
this.configureHeaders()
|
|
1322
1329
|
);
|
|
1323
1330
|
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Os acontecimentos de segurança, do mais recente para o mais antigo.
|
|
1333
|
+
*
|
|
1334
|
+
* <p>Sem período informado o servidor assume os últimos trinta dias — a primeira consulta de
|
|
1335
|
+
* quem abre a tela não deve varrer a tabela inteira.
|
|
1336
|
+
*
|
|
1337
|
+
* <p>Devolve 403 para quem não é administrador, e 404 quando a trilha está desligada: os dois
|
|
1338
|
+
* casos precisam ser distinguidos na tela, porque significam coisas diferentes.
|
|
1339
|
+
*/
|
|
1340
|
+
async getAuditEvents(e = {}) {
|
|
1341
|
+
const t = new URLSearchParams();
|
|
1342
|
+
return e.usuario && t.set("usuario", e.usuario), e.tipo && t.set("tipo", e.tipo), e.inicio && t.set("inicio", e.inicio), e.fim && t.set("fim", e.fim), t.set("page", String(e.page ?? 0)), t.set("size", String(e.size ?? 50)), this.client.get(
|
|
1343
|
+
`${this.getAuditEndpoint()}/events?${t.toString()}`,
|
|
1344
|
+
this.configureHeaders()
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1324
1347
|
}
|
|
1325
1348
|
I.decorate(I.inject(Y.ApiClient), Rt, 0);
|
|
1326
1349
|
I.decorate(I.injectable(), Rt);
|
|
@@ -1335,7 +1358,7 @@ function qr({
|
|
|
1335
1358
|
mockUsers: i = [],
|
|
1336
1359
|
mockUsersGroupMap: d,
|
|
1337
1360
|
options: y = {},
|
|
1338
|
-
onChangeUsername:
|
|
1361
|
+
onChangeUsername: k,
|
|
1339
1362
|
disabledLogin: h = !1,
|
|
1340
1363
|
isCheckingUsername: U = !1,
|
|
1341
1364
|
showSignIn: A = !0,
|
|
@@ -1343,23 +1366,23 @@ function qr({
|
|
|
1343
1366
|
onVerifyMfa: E,
|
|
1344
1367
|
mfaError: P,
|
|
1345
1368
|
onCancelMfa: M,
|
|
1346
|
-
isVerifyingMfa:
|
|
1369
|
+
isVerifyingMfa: B = !1
|
|
1347
1370
|
}) {
|
|
1348
|
-
const
|
|
1371
|
+
const H = ut(), {
|
|
1349
1372
|
username: _,
|
|
1350
1373
|
password: b,
|
|
1351
1374
|
rememberMe: m,
|
|
1352
1375
|
clearRememberMe: R
|
|
1353
|
-
} =
|
|
1376
|
+
} = Ht(), [V, L] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
|
|
1354
1377
|
X(() => {
|
|
1355
1378
|
g(!!e);
|
|
1356
1379
|
}, [e]), X(() => {
|
|
1357
|
-
_ !==
|
|
1380
|
+
_ !== V && (L(_), k?.(_)), b !== N && T(b), m !== ee && te(m);
|
|
1358
1381
|
}, [_, b, m]);
|
|
1359
1382
|
const he = () => {
|
|
1360
1383
|
g(!1);
|
|
1361
|
-
},
|
|
1362
|
-
|
|
1384
|
+
}, $ = () => {
|
|
1385
|
+
V && N && r(V, N, ee).finally(() => g(!0));
|
|
1363
1386
|
}, ce = () => {
|
|
1364
1387
|
const l = W.trim();
|
|
1365
1388
|
l && E && E(l);
|
|
@@ -1383,7 +1406,7 @@ function qr({
|
|
|
1383
1406
|
}, be = () => {
|
|
1384
1407
|
if (v) {
|
|
1385
1408
|
const l = i.find((f) => f.email === v);
|
|
1386
|
-
l && (
|
|
1409
|
+
l && (L(l.email), T(l.password), he());
|
|
1387
1410
|
}
|
|
1388
1411
|
}, u = {
|
|
1389
1412
|
withBorder: !0,
|
|
@@ -1399,7 +1422,7 @@ function qr({
|
|
|
1399
1422
|
{
|
|
1400
1423
|
...u,
|
|
1401
1424
|
pos: "relative",
|
|
1402
|
-
ref:
|
|
1425
|
+
ref: H,
|
|
1403
1426
|
children: [
|
|
1404
1427
|
A && /* @__PURE__ */ C(ie, { children: [
|
|
1405
1428
|
/* @__PURE__ */ o(
|
|
@@ -1442,8 +1465,8 @@ function qr({
|
|
|
1442
1465
|
G,
|
|
1443
1466
|
{
|
|
1444
1467
|
fullWidth: !0,
|
|
1445
|
-
disabled: !W.trim() ||
|
|
1446
|
-
loading:
|
|
1468
|
+
disabled: !W.trim() || B,
|
|
1469
|
+
loading: B,
|
|
1447
1470
|
onClick: ce,
|
|
1448
1471
|
children: x().t("archbase:mfa.verify", "Verificar")
|
|
1449
1472
|
}
|
|
@@ -1496,10 +1519,10 @@ function qr({
|
|
|
1496
1519
|
label: s,
|
|
1497
1520
|
placeholder: n ?? x().t("archbase:usuario@email.com"),
|
|
1498
1521
|
rightSection: U ? /* @__PURE__ */ o(dt, { size: "xs" }) : null,
|
|
1499
|
-
value:
|
|
1522
|
+
value: V || "",
|
|
1500
1523
|
required: !0,
|
|
1501
1524
|
onChange: (l) => {
|
|
1502
|
-
|
|
1525
|
+
L(l.currentTarget.value), k?.(l.currentTarget.value), he();
|
|
1503
1526
|
}
|
|
1504
1527
|
}
|
|
1505
1528
|
),
|
|
@@ -1545,10 +1568,10 @@ function qr({
|
|
|
1545
1568
|
/* @__PURE__ */ o(
|
|
1546
1569
|
G,
|
|
1547
1570
|
{
|
|
1548
|
-
disabled: !N || !
|
|
1571
|
+
disabled: !N || !V || h,
|
|
1549
1572
|
fullWidth: !0,
|
|
1550
1573
|
mt: "xl",
|
|
1551
|
-
onClick:
|
|
1574
|
+
onClick: $,
|
|
1552
1575
|
children: x().t("archbase:signIn")
|
|
1553
1576
|
}
|
|
1554
1577
|
)
|
|
@@ -1559,7 +1582,7 @@ function qr({
|
|
|
1559
1582
|
}
|
|
1560
1583
|
);
|
|
1561
1584
|
}
|
|
1562
|
-
const
|
|
1585
|
+
const O = (r, e) => x().t(r, e);
|
|
1563
1586
|
function Yr({
|
|
1564
1587
|
enabled: r,
|
|
1565
1588
|
onSetup: e,
|
|
@@ -1567,17 +1590,17 @@ function Yr({
|
|
|
1567
1590
|
onDisable: s,
|
|
1568
1591
|
onStatusChange: n
|
|
1569
1592
|
}) {
|
|
1570
|
-
const [a, c] = p("idle"), [i, d] = p(null), [y,
|
|
1593
|
+
const [a, c] = p("idle"), [i, d] = p(null), [y, k] = p(""), [h, U] = p([]), [A, w] = p(!1), [E, P] = p(null), M = async () => {
|
|
1571
1594
|
w(!0), P(null);
|
|
1572
1595
|
try {
|
|
1573
1596
|
const b = await e();
|
|
1574
|
-
d(b),
|
|
1597
|
+
d(b), k(""), c("setup");
|
|
1575
1598
|
} catch (b) {
|
|
1576
1599
|
P(b?.message || String(b));
|
|
1577
1600
|
} finally {
|
|
1578
1601
|
w(!1);
|
|
1579
1602
|
}
|
|
1580
|
-
},
|
|
1603
|
+
}, B = async () => {
|
|
1581
1604
|
const b = y.trim();
|
|
1582
1605
|
if (b) {
|
|
1583
1606
|
w(!0), P(null);
|
|
@@ -1590,7 +1613,7 @@ function Yr({
|
|
|
1590
1613
|
w(!1);
|
|
1591
1614
|
}
|
|
1592
1615
|
}
|
|
1593
|
-
},
|
|
1616
|
+
}, H = async () => {
|
|
1594
1617
|
w(!0), P(null);
|
|
1595
1618
|
try {
|
|
1596
1619
|
await s(), d(null), U([]), c("idle"), n?.(!1);
|
|
@@ -1600,85 +1623,85 @@ function Yr({
|
|
|
1600
1623
|
w(!1);
|
|
1601
1624
|
}
|
|
1602
1625
|
}, _ = () => {
|
|
1603
|
-
U([]), d(null),
|
|
1626
|
+
U([]), d(null), k(""), c("idle");
|
|
1604
1627
|
};
|
|
1605
1628
|
return /* @__PURE__ */ o(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
|
|
1606
1629
|
/* @__PURE__ */ C("div", { children: [
|
|
1607
|
-
/* @__PURE__ */ o(j, { fw: 700, fz: "lg", children:
|
|
1608
|
-
/* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children:
|
|
1630
|
+
/* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: O("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
|
|
1631
|
+
/* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: O(
|
|
1609
1632
|
"archbase:mfa.setup.subtitle",
|
|
1610
1633
|
"Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
|
|
1611
1634
|
) })
|
|
1612
1635
|
] }),
|
|
1613
1636
|
E && /* @__PURE__ */ o(tt, { color: "red", children: E }),
|
|
1614
1637
|
r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
|
|
1615
|
-
/* @__PURE__ */ o(j, { c: "teal", fw: 600, children:
|
|
1616
|
-
/* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick:
|
|
1638
|
+
/* @__PURE__ */ o(j, { c: "teal", fw: 600, children: O("archbase:mfa.setup.active", "MFA ativo") }),
|
|
1639
|
+
/* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: H, children: O("archbase:mfa.setup.disable", "Desativar") })
|
|
1617
1640
|
] }),
|
|
1618
|
-
!r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children:
|
|
1641
|
+
!r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: O("archbase:mfa.setup.enable", "Ativar MFA") }),
|
|
1619
1642
|
a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
|
|
1620
|
-
/* @__PURE__ */ o(j, { fz: "sm", ta: "center", children:
|
|
1643
|
+
/* @__PURE__ */ o(j, { fz: "sm", ta: "center", children: O(
|
|
1621
1644
|
"archbase:mfa.setup.scan",
|
|
1622
1645
|
"Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
|
|
1623
1646
|
) }),
|
|
1624
1647
|
/* @__PURE__ */ o(sr, { value: i.provisioningUri, size: 180, level: "M" }),
|
|
1625
|
-
/* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children:
|
|
1648
|
+
/* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children: O("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
|
|
1626
1649
|
/* @__PURE__ */ C(ue, { gap: "xs", children: [
|
|
1627
1650
|
/* @__PURE__ */ o(rt, { children: i.secret }),
|
|
1628
|
-
/* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ?
|
|
1651
|
+
/* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? O("archbase:mfa.setup.copied", "Copiado") : O("archbase:mfa.setup.copy", "Copiar") }) })
|
|
1629
1652
|
] }),
|
|
1630
1653
|
/* @__PURE__ */ o(
|
|
1631
1654
|
xe,
|
|
1632
1655
|
{
|
|
1633
1656
|
w: "100%",
|
|
1634
|
-
label:
|
|
1657
|
+
label: O("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
|
|
1635
1658
|
placeholder: "000000",
|
|
1636
1659
|
value: y,
|
|
1637
|
-
onChange: (b) =>
|
|
1660
|
+
onChange: (b) => k(b.currentTarget.value),
|
|
1638
1661
|
onKeyDown: (b) => {
|
|
1639
|
-
b.key === "Enter" &&
|
|
1662
|
+
b.key === "Enter" && B();
|
|
1640
1663
|
}
|
|
1641
1664
|
}
|
|
1642
1665
|
),
|
|
1643
1666
|
/* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
|
|
1644
|
-
/* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children:
|
|
1645
|
-
/* @__PURE__ */ o(G, { onClick:
|
|
1667
|
+
/* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: O("archbase:mfa.setup.cancel", "Cancelar") }),
|
|
1668
|
+
/* @__PURE__ */ o(G, { onClick: B, loading: A, disabled: !y.trim(), children: O("archbase:mfa.setup.confirm", "Confirmar e ativar") })
|
|
1646
1669
|
] })
|
|
1647
1670
|
] }),
|
|
1648
1671
|
a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
|
|
1649
|
-
/* @__PURE__ */ o(tt, { color: "yellow", children:
|
|
1672
|
+
/* @__PURE__ */ o(tt, { color: "yellow", children: O(
|
|
1650
1673
|
"archbase:mfa.setup.recoveryWarning",
|
|
1651
1674
|
"Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
|
|
1652
1675
|
) }),
|
|
1653
1676
|
/* @__PURE__ */ o(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ o(rt, { fz: "sm", children: b }, b)) }),
|
|
1654
1677
|
/* @__PURE__ */ C(ue, { justify: "space-between", children: [
|
|
1655
1678
|
/* @__PURE__ */ o(st, { value: h.join(`
|
|
1656
|
-
`), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ?
|
|
1657
|
-
/* @__PURE__ */ o(G, { onClick: _, children:
|
|
1679
|
+
`), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? O("archbase:mfa.setup.copied", "Copiado") : O("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
|
|
1680
|
+
/* @__PURE__ */ o(G, { onClick: _, children: O("archbase:mfa.setup.done", "Guardei os códigos") })
|
|
1658
1681
|
] })
|
|
1659
1682
|
] })
|
|
1660
1683
|
] }) });
|
|
1661
1684
|
}
|
|
1662
|
-
const
|
|
1685
|
+
const kr = {
|
|
1663
1686
|
position: "relative",
|
|
1664
1687
|
width: "90%",
|
|
1665
1688
|
maxWidth: 400,
|
|
1666
1689
|
padding: 30,
|
|
1667
1690
|
marginTop: 30
|
|
1668
1691
|
};
|
|
1669
|
-
function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements:
|
|
1670
|
-
const h = ut(), U =
|
|
1671
|
-
async function we(
|
|
1672
|
-
|
|
1673
|
-
nt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`),
|
|
1692
|
+
function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: k = !0 }) {
|
|
1693
|
+
const h = ut(), U = Vt(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [B, H] = p(""), [_, b] = p(""), [m, R] = p(""), [V, L] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
|
|
1694
|
+
async function we($) {
|
|
1695
|
+
$ && (Gt($) ? await e($).then(() => {
|
|
1696
|
+
nt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
|
|
1674
1697
|
}).catch(() => {
|
|
1675
1698
|
}) : T(`${x().t("archbase:Email inválido")}`));
|
|
1676
1699
|
}
|
|
1677
|
-
async function he(
|
|
1678
|
-
if (
|
|
1700
|
+
async function he($, ce, ne, be) {
|
|
1701
|
+
if ($ && ce && ne) {
|
|
1679
1702
|
let u = "", l = "", f = "";
|
|
1680
|
-
a && (u = a(ce), te(u)), W && (l = Jt(ne, W).error ?? ""), !l && n && (l = n(ne)), g(l), ne !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t(
|
|
1681
|
-
nt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(),
|
|
1703
|
+
a && (u = a(ce), te(u)), W && (l = Jt(ne, W).error ?? ""), !l && n && (l = n(ne)), g(l), ne !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t($, ce, ne).then(() => {
|
|
1704
|
+
nt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
|
|
1682
1705
|
}).catch(() => {
|
|
1683
1706
|
E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
|
|
1684
1707
|
});
|
|
@@ -1688,7 +1711,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1688
1711
|
r && E(r);
|
|
1689
1712
|
}, [r]), X(() => {
|
|
1690
1713
|
E("");
|
|
1691
|
-
}, [P,
|
|
1714
|
+
}, [P, B, _, m]), /* @__PURE__ */ C(
|
|
1692
1715
|
We,
|
|
1693
1716
|
{
|
|
1694
1717
|
withBorder: !0,
|
|
@@ -1696,11 +1719,11 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1696
1719
|
radius: "md",
|
|
1697
1720
|
ref: h,
|
|
1698
1721
|
style: {
|
|
1699
|
-
...
|
|
1722
|
+
...kr,
|
|
1700
1723
|
...d
|
|
1701
1724
|
},
|
|
1702
1725
|
children: [
|
|
1703
|
-
|
|
1726
|
+
V ? /* @__PURE__ */ C(ie, { children: [
|
|
1704
1727
|
/* @__PURE__ */ o(
|
|
1705
1728
|
j,
|
|
1706
1729
|
{
|
|
@@ -1718,10 +1741,10 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1718
1741
|
{
|
|
1719
1742
|
label: x().t("archbase:Código de segurança"),
|
|
1720
1743
|
placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
|
|
1721
|
-
value:
|
|
1744
|
+
value: B || "",
|
|
1722
1745
|
required: !0,
|
|
1723
|
-
onChange: (
|
|
1724
|
-
|
|
1746
|
+
onChange: ($) => {
|
|
1747
|
+
H($.currentTarget.value), te("");
|
|
1725
1748
|
},
|
|
1726
1749
|
error: ee
|
|
1727
1750
|
}
|
|
@@ -1731,8 +1754,8 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1731
1754
|
{
|
|
1732
1755
|
label: x().t("archbase:Nova senha"),
|
|
1733
1756
|
placeholder: x().t("archbase:Nova senha"),
|
|
1734
|
-
onChange: (
|
|
1735
|
-
b(
|
|
1757
|
+
onChange: ($) => {
|
|
1758
|
+
b($.currentTarget.value), g(""), K("");
|
|
1736
1759
|
},
|
|
1737
1760
|
value: _,
|
|
1738
1761
|
required: !0,
|
|
@@ -1744,7 +1767,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1744
1767
|
{
|
|
1745
1768
|
value: _,
|
|
1746
1769
|
policy: W,
|
|
1747
|
-
showRequirements:
|
|
1770
|
+
showRequirements: k
|
|
1748
1771
|
}
|
|
1749
1772
|
),
|
|
1750
1773
|
/* @__PURE__ */ o(
|
|
@@ -1752,8 +1775,8 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1752
1775
|
{
|
|
1753
1776
|
label: x().t("archbase:Confirmar senha"),
|
|
1754
1777
|
placeholder: x().t("archbase:Confirmar senha"),
|
|
1755
|
-
onChange: (
|
|
1756
|
-
R(
|
|
1778
|
+
onChange: ($) => {
|
|
1779
|
+
R($.currentTarget.value), K("");
|
|
1757
1780
|
},
|
|
1758
1781
|
value: m || "",
|
|
1759
1782
|
required: !0,
|
|
@@ -1763,10 +1786,10 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1763
1786
|
/* @__PURE__ */ o(
|
|
1764
1787
|
G,
|
|
1765
1788
|
{
|
|
1766
|
-
disabled: !P ||
|
|
1789
|
+
disabled: !P || !B || !_ || !m,
|
|
1767
1790
|
mt: "md",
|
|
1768
1791
|
fullWidth: !0,
|
|
1769
|
-
onClick: () => he(P,
|
|
1792
|
+
onClick: () => he(P, B, _, m),
|
|
1770
1793
|
children: `${x().t("archbase:Redefinir senha")}`
|
|
1771
1794
|
}
|
|
1772
1795
|
),
|
|
@@ -1777,7 +1800,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1777
1800
|
fullWidth: !0,
|
|
1778
1801
|
color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
|
|
1779
1802
|
onClick: () => {
|
|
1780
|
-
N ||
|
|
1803
|
+
N || L(!1);
|
|
1781
1804
|
},
|
|
1782
1805
|
children: `${x().t("archbase:Voltar")}`
|
|
1783
1806
|
}
|
|
@@ -1803,8 +1826,8 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1803
1826
|
placeholder: `${x().t("archbase:usuario@email.com")}`,
|
|
1804
1827
|
value: P || "",
|
|
1805
1828
|
required: !0,
|
|
1806
|
-
onChange: (
|
|
1807
|
-
M(
|
|
1829
|
+
onChange: ($) => {
|
|
1830
|
+
M($.currentTarget.value), T("");
|
|
1808
1831
|
},
|
|
1809
1832
|
error: N
|
|
1810
1833
|
}
|
|
@@ -1845,14 +1868,14 @@ const Ir = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourc
|
|
|
1845
1868
|
if (h && h.isAdmin === a)
|
|
1846
1869
|
return h;
|
|
1847
1870
|
}
|
|
1848
|
-
const
|
|
1849
|
-
return s && c && s.setValue(y,
|
|
1871
|
+
const k = new vt(r, e, a);
|
|
1872
|
+
return s && c && s.setValue(y, k), k;
|
|
1850
1873
|
}, [t, r, e, a, c]);
|
|
1851
1874
|
return X(() => {
|
|
1852
1875
|
i.current = c;
|
|
1853
1876
|
}, [c]), { securityManager: d };
|
|
1854
1877
|
};
|
|
1855
|
-
function
|
|
1878
|
+
function Oe(r) {
|
|
1856
1879
|
const e = r?.response?.data ?? r?.data ?? r;
|
|
1857
1880
|
return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
|
|
1858
1881
|
}
|
|
@@ -1866,7 +1889,7 @@ const Zr = ({
|
|
|
1866
1889
|
(u) => u.get(Y.TokenManager)
|
|
1867
1890
|
), s = De(
|
|
1868
1891
|
(u) => u.get(Y.Authenticator)
|
|
1869
|
-
), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [
|
|
1892
|
+
), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [k, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [B, H] = p(null), [_, b] = p(!1), [m, R] = p(!1), [V, L] = p(null), N = lt(Mt), T = {
|
|
1870
1893
|
hasContextualLogin: typeof s.loginWithContext == "function",
|
|
1871
1894
|
hasFlexibleLogin: typeof s.loginFlexible == "function",
|
|
1872
1895
|
hasSocialLogin: typeof s.loginSocial == "function",
|
|
@@ -1880,7 +1903,7 @@ const Zr = ({
|
|
|
1880
1903
|
if (f)
|
|
1881
1904
|
try {
|
|
1882
1905
|
const D = typeof f == "string" ? JSON.parse(f) : f;
|
|
1883
|
-
|
|
1906
|
+
H(D);
|
|
1884
1907
|
} catch (D) {
|
|
1885
1908
|
console.warn("Erro ao carregar contexto salvo:", D);
|
|
1886
1909
|
}
|
|
@@ -1893,14 +1916,14 @@ const Zr = ({
|
|
|
1893
1916
|
}, te = () => {
|
|
1894
1917
|
R(!1);
|
|
1895
1918
|
}, se = (u) => {
|
|
1896
|
-
i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""),
|
|
1919
|
+
i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), H(null), E(""), A(!1), R(!1), N.clearAllValues();
|
|
1897
1920
|
}, g = async (u, l, f) => {
|
|
1898
1921
|
try {
|
|
1899
1922
|
i(!0), h(!1);
|
|
1900
1923
|
const D = await s.login(u, l);
|
|
1901
1924
|
t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
|
|
1902
1925
|
} catch (D) {
|
|
1903
|
-
i(!1), h(!1),
|
|
1926
|
+
i(!1), h(!1), Oe(D) && (M(u), R(!0)), E(oe(D)), A(!0);
|
|
1904
1927
|
}
|
|
1905
1928
|
}, v = async (u, l = !1) => {
|
|
1906
1929
|
if (!T.hasContextualLogin || !s.loginWithContext)
|
|
@@ -1909,7 +1932,7 @@ const Zr = ({
|
|
|
1909
1932
|
i(!0), h(!1);
|
|
1910
1933
|
const { context: f, user: D, ...z } = await s.loginWithContext(u);
|
|
1911
1934
|
if (z.mfa_required) {
|
|
1912
|
-
|
|
1935
|
+
L(z.challenge_token ?? null), b(!0), M(u.email), i(!1);
|
|
1913
1936
|
return;
|
|
1914
1937
|
}
|
|
1915
1938
|
const Ae = {
|
|
@@ -1917,24 +1940,24 @@ const Zr = ({
|
|
|
1917
1940
|
ext_expires_in: z.expires_in,
|
|
1918
1941
|
...z
|
|
1919
1942
|
};
|
|
1920
|
-
t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)),
|
|
1943
|
+
t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(u.email), a(Ae), i(!1), h(!0);
|
|
1921
1944
|
} catch (f) {
|
|
1922
|
-
throw i(!1), h(!1),
|
|
1945
|
+
throw i(!1), h(!1), Oe(f) && (M(u.email), R(!0)), E(oe(f)), A(!0), f;
|
|
1923
1946
|
}
|
|
1924
1947
|
}, K = async (u) => {
|
|
1925
1948
|
if (!s.verifyMfa)
|
|
1926
1949
|
throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1927
|
-
if (!
|
|
1950
|
+
if (!V)
|
|
1928
1951
|
throw new Error("Nenhum desafio de MFA pendente");
|
|
1929
1952
|
try {
|
|
1930
1953
|
i(!0), E(""), A(!1);
|
|
1931
|
-
const l = await s.verifyMfa(
|
|
1932
|
-
t.saveToken(l), t.saveUsername(P), a(l), b(!1),
|
|
1954
|
+
const l = await s.verifyMfa(V, u);
|
|
1955
|
+
t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
|
|
1933
1956
|
} catch (l) {
|
|
1934
1957
|
throw i(!1), E(oe(l)), A(!0), l;
|
|
1935
1958
|
}
|
|
1936
1959
|
}, W = () => {
|
|
1937
|
-
b(!1),
|
|
1960
|
+
b(!1), L(null), E(""), A(!1);
|
|
1938
1961
|
}, we = async (u, l = !1) => {
|
|
1939
1962
|
if (!T.hasFlexibleLogin || !s.loginFlexible)
|
|
1940
1963
|
throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
|
|
@@ -1945,9 +1968,9 @@ const Zr = ({
|
|
|
1945
1968
|
ext_expires_in: z.expires_in,
|
|
1946
1969
|
...z
|
|
1947
1970
|
};
|
|
1948
|
-
t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)),
|
|
1971
|
+
t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
|
|
1949
1972
|
} catch (f) {
|
|
1950
|
-
throw i(!1), h(!1),
|
|
1973
|
+
throw i(!1), h(!1), Oe(f) && (M(u.identifier), R(!0)), E(oe(f)), A(!0), f;
|
|
1951
1974
|
}
|
|
1952
1975
|
}, he = async (u) => {
|
|
1953
1976
|
if (!T.hasSocialLogin || !s.loginSocial)
|
|
@@ -1959,11 +1982,11 @@ const Zr = ({
|
|
|
1959
1982
|
ext_expires_in: D.expires_in,
|
|
1960
1983
|
...D
|
|
1961
1984
|
};
|
|
1962
|
-
t.saveToken(z), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)),
|
|
1985
|
+
t.saveToken(z), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), H(l)), M(f.email), a(z), i(!1), h(!0);
|
|
1963
1986
|
} catch (l) {
|
|
1964
1987
|
throw i(!1), h(!1), E(oe(l)), A(!0), l;
|
|
1965
1988
|
}
|
|
1966
|
-
},
|
|
1989
|
+
}, $ = async (u) => {
|
|
1967
1990
|
if (!T.hasRegistration || !s.register)
|
|
1968
1991
|
throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1969
1992
|
try {
|
|
@@ -1996,7 +2019,7 @@ const Zr = ({
|
|
|
1996
2019
|
login: g,
|
|
1997
2020
|
logout: se,
|
|
1998
2021
|
username: P,
|
|
1999
|
-
isAuthenticated:
|
|
2022
|
+
isAuthenticated: k,
|
|
2000
2023
|
isAuthenticating: c,
|
|
2001
2024
|
isInitializing: d,
|
|
2002
2025
|
isError: U,
|
|
@@ -2007,7 +2030,7 @@ const Zr = ({
|
|
|
2007
2030
|
loginWithContext: T.hasContextualLogin ? v : void 0,
|
|
2008
2031
|
loginFlexible: T.hasFlexibleLogin ? we : void 0,
|
|
2009
2032
|
loginSocial: T.hasSocialLogin ? he : void 0,
|
|
2010
|
-
register: T.hasRegistration ?
|
|
2033
|
+
register: T.hasRegistration ? $ : void 0,
|
|
2011
2034
|
getSupportedContexts: ce,
|
|
2012
2035
|
validateContext: ne,
|
|
2013
2036
|
// MFA / segundo fator (2 passos)
|
|
@@ -2018,7 +2041,7 @@ const Zr = ({
|
|
|
2018
2041
|
passwordChangeRequired: m,
|
|
2019
2042
|
clearPasswordChangeRequired: te,
|
|
2020
2043
|
// Informações de contexto
|
|
2021
|
-
context:
|
|
2044
|
+
context: B,
|
|
2022
2045
|
// Detecção de capacidades
|
|
2023
2046
|
capabilities: T
|
|
2024
2047
|
};
|
|
@@ -2044,9 +2067,9 @@ const Zr = ({
|
|
|
2044
2067
|
throw n(oe(y)), t(!0), y;
|
|
2045
2068
|
}
|
|
2046
2069
|
},
|
|
2047
|
-
resetPassword: async (d, y,
|
|
2070
|
+
resetPassword: async (d, y, k) => {
|
|
2048
2071
|
try {
|
|
2049
|
-
return await r.resetPassword(d, y,
|
|
2072
|
+
return await r.resetPassword(d, y, k);
|
|
2050
2073
|
} catch (h) {
|
|
2051
2074
|
throw n(oe(h)), t(!0), h;
|
|
2052
2075
|
}
|
|
@@ -2068,25 +2091,25 @@ const Zr = ({
|
|
|
2068
2091
|
/* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" }),
|
|
2069
2092
|
/* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" })
|
|
2070
2093
|
] })
|
|
2071
|
-
] }) }), Ye =
|
|
2094
|
+
] }) }), Ye = He(null), rs = ({
|
|
2072
2095
|
children: r,
|
|
2073
2096
|
user: e,
|
|
2074
2097
|
onError: t
|
|
2075
2098
|
}) => {
|
|
2076
|
-
const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]),
|
|
2099
|
+
const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), k = Ie((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ie((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ie((w) => {
|
|
2077
2100
|
c(w), w && t && t(w);
|
|
2078
2101
|
}, [t]), A = {
|
|
2079
2102
|
user: e,
|
|
2080
2103
|
isLoading: s,
|
|
2081
2104
|
hasGlobalPermission: y,
|
|
2082
|
-
hasAnyGlobalPermission:
|
|
2105
|
+
hasAnyGlobalPermission: k,
|
|
2083
2106
|
hasAllGlobalPermissions: h,
|
|
2084
2107
|
isAdmin: d,
|
|
2085
2108
|
error: a,
|
|
2086
2109
|
setError: U
|
|
2087
2110
|
};
|
|
2088
2111
|
return /* @__PURE__ */ o(Ye.Provider, { value: A, children: r });
|
|
2089
|
-
}, Nt =
|
|
2112
|
+
}, Nt = He(null), Pr = ({
|
|
2090
2113
|
children: r,
|
|
2091
2114
|
resourceName: e,
|
|
2092
2115
|
resourceDescription: t,
|
|
@@ -2096,16 +2119,16 @@ const Zr = ({
|
|
|
2096
2119
|
onSecurityReady: c,
|
|
2097
2120
|
onError: i
|
|
2098
2121
|
}) => {
|
|
2099
|
-
const d =
|
|
2122
|
+
const d = Ve(Ye);
|
|
2100
2123
|
if (!d)
|
|
2101
2124
|
throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
2102
|
-
const { user: y, isAdmin:
|
|
2125
|
+
const { user: y, isAdmin: k } = d, [h, U] = p(null), [A, w] = p(!0), [E, P] = p(null);
|
|
2103
2126
|
if (it.useEffect(() => {
|
|
2104
2127
|
if (!y) {
|
|
2105
2128
|
w(!1);
|
|
2106
2129
|
return;
|
|
2107
2130
|
}
|
|
2108
|
-
const m = new vt(e, t,
|
|
2131
|
+
const m = new vt(e, t, k);
|
|
2109
2132
|
(async () => {
|
|
2110
2133
|
w(!0);
|
|
2111
2134
|
try {
|
|
@@ -2113,11 +2136,11 @@ const Zr = ({
|
|
|
2113
2136
|
U(m), w(!1), c && c(m);
|
|
2114
2137
|
});
|
|
2115
2138
|
} catch {
|
|
2116
|
-
const
|
|
2117
|
-
P(
|
|
2139
|
+
const L = m.getError() || "Erro ao carregar permissões";
|
|
2140
|
+
P(L), w(!1), i && i(L);
|
|
2118
2141
|
}
|
|
2119
2142
|
})();
|
|
2120
|
-
}, [e, t, y,
|
|
2143
|
+
}, [e, t, y, k, c, i]), A)
|
|
2121
2144
|
return a ? /* @__PURE__ */ o(ie, { children: a }) : /* @__PURE__ */ o(Cr, {});
|
|
2122
2145
|
if (E)
|
|
2123
2146
|
return /* @__PURE__ */ o("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
|
|
@@ -2149,12 +2172,12 @@ const Zr = ({
|
|
|
2149
2172
|
};
|
|
2150
2173
|
return /* @__PURE__ */ o(Nt.Provider, { value: b, children: r });
|
|
2151
2174
|
}, Tr = () => {
|
|
2152
|
-
const r =
|
|
2175
|
+
const r = Ve(Ye);
|
|
2153
2176
|
if (!r)
|
|
2154
2177
|
throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
2155
2178
|
return r;
|
|
2156
2179
|
}, Xe = () => {
|
|
2157
|
-
const r =
|
|
2180
|
+
const r = Ve(Nt);
|
|
2158
2181
|
if (!r)
|
|
2159
2182
|
throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
|
|
2160
2183
|
return r;
|
|
@@ -2184,7 +2207,7 @@ const Zr = ({
|
|
|
2184
2207
|
checkAll: r.hasAllPermissions,
|
|
2185
2208
|
isAdmin: Tr().isAdmin
|
|
2186
2209
|
};
|
|
2187
|
-
},
|
|
2210
|
+
}, $t = ({
|
|
2188
2211
|
children: r,
|
|
2189
2212
|
actionName: e,
|
|
2190
2213
|
requiredPermissions: t = [],
|
|
@@ -2193,10 +2216,10 @@ const Zr = ({
|
|
|
2193
2216
|
fallback: a = null,
|
|
2194
2217
|
autoRegister: c = !0
|
|
2195
2218
|
}) => {
|
|
2196
|
-
const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction:
|
|
2219
|
+
const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: k } = Xe();
|
|
2197
2220
|
X(() => {
|
|
2198
|
-
c && e && n &&
|
|
2199
|
-
}, [e, n, c,
|
|
2221
|
+
c && e && n && k(e, n);
|
|
2222
|
+
}, [e, n, c, k]);
|
|
2200
2223
|
let h = !1;
|
|
2201
2224
|
return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ie, { children: r }) : /* @__PURE__ */ o(ie, { children: a });
|
|
2202
2225
|
}, os = ({
|
|
@@ -2211,7 +2234,7 @@ const Zr = ({
|
|
|
2211
2234
|
size: d = "medium",
|
|
2212
2235
|
type: y = "button"
|
|
2213
2236
|
}) => {
|
|
2214
|
-
const
|
|
2237
|
+
const k = () => {
|
|
2215
2238
|
const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, w = `archbase-secure-btn--${d}`;
|
|
2216
2239
|
return `${U} ${A} ${w} ${a}`.trim();
|
|
2217
2240
|
}, h = () => {
|
|
@@ -2238,7 +2261,7 @@ const Zr = ({
|
|
|
2238
2261
|
};
|
|
2239
2262
|
};
|
|
2240
2263
|
return /* @__PURE__ */ o(
|
|
2241
|
-
|
|
2264
|
+
$t,
|
|
2242
2265
|
{
|
|
2243
2266
|
actionName: r,
|
|
2244
2267
|
actionDescription: e,
|
|
@@ -2249,7 +2272,7 @@ const Zr = ({
|
|
|
2249
2272
|
type: y,
|
|
2250
2273
|
onClick: s,
|
|
2251
2274
|
disabled: n,
|
|
2252
|
-
className:
|
|
2275
|
+
className: k(),
|
|
2253
2276
|
style: h(),
|
|
2254
2277
|
children: t
|
|
2255
2278
|
}
|
|
@@ -2265,7 +2288,7 @@ const Zr = ({
|
|
|
2265
2288
|
fallbackText: a = "Campo não disponível",
|
|
2266
2289
|
fallbackComponent: c
|
|
2267
2290
|
}) => e ? /* @__PURE__ */ o(
|
|
2268
|
-
|
|
2291
|
+
$t,
|
|
2269
2292
|
{
|
|
2270
2293
|
actionName: e,
|
|
2271
2294
|
actionDescription: t,
|
|
@@ -2306,7 +2329,7 @@ export {
|
|
|
2306
2329
|
xr as AccessIntervalDto,
|
|
2307
2330
|
At as AccessScheduleDto,
|
|
2308
2331
|
qe as AccessTokenDto,
|
|
2309
|
-
|
|
2332
|
+
Sr as ActionDto,
|
|
2310
2333
|
Ke as ApiTokenDto,
|
|
2311
2334
|
Dt as ArchbaseAccessTokenService,
|
|
2312
2335
|
Ut as ArchbaseApiTokenService,
|
|
@@ -2316,7 +2339,7 @@ export {
|
|
|
2316
2339
|
qr as ArchbaseLogin,
|
|
2317
2340
|
Yr as ArchbaseMfaSetup,
|
|
2318
2341
|
Tt as ArchbaseProfileService,
|
|
2319
|
-
|
|
2342
|
+
$t as ArchbaseProtectedComponent,
|
|
2320
2343
|
Xr as ArchbaseResetPassword,
|
|
2321
2344
|
_t as ArchbaseResourceService,
|
|
2322
2345
|
os as ArchbaseSecureActionButton,
|
|
@@ -2330,21 +2353,21 @@ export {
|
|
|
2330
2353
|
pt as ArchbaseUsernameAndPassword,
|
|
2331
2354
|
pt as ArchbaseUsernameAndPasswordImpl,
|
|
2332
2355
|
Pr as ArchbaseViewSecurityProvider,
|
|
2333
|
-
|
|
2356
|
+
Le as CONTEXT_STORAGE_KEY,
|
|
2334
2357
|
or as DefaultArchbaseTokenManager,
|
|
2335
2358
|
Cr as DefaultSecurityLoading,
|
|
2336
2359
|
le as ENCRYPTION_KEY,
|
|
2337
2360
|
mt as FetchError,
|
|
2338
|
-
|
|
2361
|
+
ke as GroupDto,
|
|
2339
2362
|
Kr as PermissionDto,
|
|
2340
|
-
|
|
2341
|
-
|
|
2363
|
+
Se as ProfileDto,
|
|
2364
|
+
kt as ResourceDto,
|
|
2342
2365
|
ye as SecurityDto,
|
|
2343
2366
|
me as SecurityType,
|
|
2344
2367
|
Ne as TOKEN_COOKIE_NAME,
|
|
2345
2368
|
Er as TipoRecurso,
|
|
2346
|
-
|
|
2347
|
-
|
|
2369
|
+
Be as USER_NAME,
|
|
2370
|
+
$e as USER_NAME_AND_PASSWORD,
|
|
2348
2371
|
Me as UserDto,
|
|
2349
2372
|
Ge as UserGroupDto,
|
|
2350
2373
|
gr as createInternalConfig,
|
|
@@ -2357,7 +2380,7 @@ export {
|
|
|
2357
2380
|
ir as generateRandomString,
|
|
2358
2381
|
ft as getRandomInteger,
|
|
2359
2382
|
wr as getRefreshExpiresIn,
|
|
2360
|
-
|
|
2383
|
+
Oe as isCredentialsExpiredError,
|
|
2361
2384
|
lr as postWithXForm,
|
|
2362
2385
|
dr as redirectToLogin,
|
|
2363
2386
|
fr as redirectToLogout,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArchbaseRemoteApiClient } from '@archbase/data';
|
|
2
|
-
import { ArchbaseAccessDecision, ArchbaseAccessOverview, ArchbaseOverviewItemPage, ArchbaseOverviewMetric, ArchbaseGroupReport, ArchbaseReachEntry, ArchbaseTreeBranch, ArchbaseTreeNodePage, ArchbaseEffectiveAccessReport, ArchbaseSimulationRequest } from './SecurityDiagnosticsDomain';
|
|
2
|
+
import { ArchbaseSecurityEventPage, ArchbaseSecurityEventType, ArchbaseAccessDecision, ArchbaseAccessOverview, ArchbaseOverviewItemPage, ArchbaseOverviewMetric, ArchbaseGroupReport, ArchbaseReachEntry, ArchbaseTreeBranch, ArchbaseTreeNodePage, ArchbaseEffectiveAccessReport, ArchbaseSimulationRequest } from './SecurityDiagnosticsDomain';
|
|
3
3
|
/**
|
|
4
4
|
* Leitura do diagnóstico de acesso — `/api/v1/security/diagnostics/*`.
|
|
5
5
|
*
|
|
@@ -17,6 +17,11 @@ export declare class ArchbaseSecurityDiagnosticsService {
|
|
|
17
17
|
constructor(client: ArchbaseRemoteApiClient);
|
|
18
18
|
protected configureHeaders(): Record<string, string>;
|
|
19
19
|
protected getEndpoint(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Base própria: a trilha vive fora do diagnóstico porque tem chave própria no backend
|
|
22
|
+
* ({@code archbase.security.audit.enabled}) e some inteira quando ela está desligada.
|
|
23
|
+
*/
|
|
24
|
+
protected getAuditEndpoint(): string;
|
|
20
25
|
/** Retrato do tenant: contagens do catálogo e o estado das proteções configuráveis. */
|
|
21
26
|
getOverview(): Promise<ArchbaseAccessOverview>;
|
|
22
27
|
/**
|
|
@@ -61,4 +66,21 @@ export declare class ArchbaseSecurityDiagnosticsService {
|
|
|
61
66
|
* que precisa mudar para o acesso passar a existir.
|
|
62
67
|
*/
|
|
63
68
|
simulate(request: ArchbaseSimulationRequest): Promise<ArchbaseAccessDecision>;
|
|
69
|
+
/**
|
|
70
|
+
* Os acontecimentos de segurança, do mais recente para o mais antigo.
|
|
71
|
+
*
|
|
72
|
+
* <p>Sem período informado o servidor assume os últimos trinta dias — a primeira consulta de
|
|
73
|
+
* quem abre a tela não deve varrer a tabela inteira.
|
|
74
|
+
*
|
|
75
|
+
* <p>Devolve 403 para quem não é administrador, e 404 quando a trilha está desligada: os dois
|
|
76
|
+
* casos precisam ser distinguidos na tela, porque significam coisas diferentes.
|
|
77
|
+
*/
|
|
78
|
+
getAuditEvents(options?: {
|
|
79
|
+
usuario?: string;
|
|
80
|
+
tipo?: ArchbaseSecurityEventType;
|
|
81
|
+
inicio?: string;
|
|
82
|
+
fim?: string;
|
|
83
|
+
page?: number;
|
|
84
|
+
size?: number;
|
|
85
|
+
}): Promise<ArchbaseSecurityEventPage>;
|
|
64
86
|
}
|
|
@@ -219,3 +219,32 @@ export interface ArchbaseReachEntry {
|
|
|
219
219
|
kind: string;
|
|
220
220
|
situation: string;
|
|
221
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* O que a trilha registra além das alterações.
|
|
224
|
+
*
|
|
225
|
+
* <p>Entrar, errar a senha e ter acesso negado não mudam tabela nenhuma — a trilha de alterações,
|
|
226
|
+
* por construção, não os vê. São eles que respondem "quem tentou o quê", enquanto a outra metade
|
|
227
|
+
* responde "quem mudou o quê".
|
|
228
|
+
*/
|
|
229
|
+
export type ArchbaseSecurityEventType = 'LOGIN' | 'LOGIN_FALHOU' | 'LOGOUT' | 'ACESSO_NEGADO' | 'SIMULACAO';
|
|
230
|
+
export interface ArchbaseSecurityEvent {
|
|
231
|
+
id: string;
|
|
232
|
+
tipo: ArchbaseSecurityEventType;
|
|
233
|
+
dataHora: string;
|
|
234
|
+
/** Pode não corresponder a ninguém: numa tentativa com e-mail inexistente é esse o dado útil. */
|
|
235
|
+
usuario?: string | null;
|
|
236
|
+
tenantId?: string | null;
|
|
237
|
+
origem?: string | null;
|
|
238
|
+
recurso?: string | null;
|
|
239
|
+
acao?: string | null;
|
|
240
|
+
/** O porquê: o portão que recusou, ou o tipo da falha de autenticação. */
|
|
241
|
+
detalhe?: string | null;
|
|
242
|
+
sucesso: boolean;
|
|
243
|
+
}
|
|
244
|
+
export interface ArchbaseSecurityEventPage {
|
|
245
|
+
content: ArchbaseSecurityEvent[];
|
|
246
|
+
totalElements: number;
|
|
247
|
+
totalPages: number;
|
|
248
|
+
number: number;
|
|
249
|
+
size: number;
|
|
250
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbase/security",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Security and authentication components for Archbase React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"reflect-metadata": "^0.1.13",
|
|
38
38
|
"rxjs": "^7.8.2",
|
|
39
39
|
"uuid": "^9.0.1",
|
|
40
|
-
"@archbase/components": "4.
|
|
41
|
-
"@archbase/core": "4.
|
|
42
|
-
"@archbase/data": "4.
|
|
43
|
-
"@archbase/layout": "4.
|
|
40
|
+
"@archbase/components": "4.3.0",
|
|
41
|
+
"@archbase/core": "4.3.0",
|
|
42
|
+
"@archbase/data": "4.3.0",
|
|
43
|
+
"@archbase/layout": "4.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/crypto-js": "^4.1.1",
|
|
Binary file
|