@archbase/security 3.0.0 → 3.0.2
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/index.d.ts +2 -0
- package/dist/src/ArchbaseAccessToken.d.ts +1 -0
- package/dist/src/ArchbaseAccessTokenService.d.ts +11 -0
- package/dist/src/ArchbaseApiTokenService.d.ts +12 -0
- package/dist/src/ArchbaseAuthenticator.d.ts +24 -0
- package/dist/src/ArchbaseGroupService.d.ts +10 -0
- package/dist/src/ArchbaseLogin.d.ts +30 -0
- package/dist/src/ArchbaseProfileService.d.ts +10 -0
- package/dist/src/ArchbaseResetPassword.d.ts +14 -0
- package/dist/src/ArchbaseResourceService.d.ts +16 -0
- package/dist/src/ArchbaseSecurityComponents.d.ts +40 -0
- package/dist/src/ArchbaseSecurityContext.d.ts +41 -0
- package/dist/src/ArchbaseSecurityHooks.d.ts +24 -0
- package/dist/src/ArchbaseSecurityManager.d.ts +58 -0
- package/dist/src/ArchbaseTenantManager.d.ts +22 -0
- package/dist/src/ArchbaseTokenManager.d.ts +1 -0
- package/dist/src/ArchbaseUser.d.ts +19 -0
- package/dist/src/ArchbaseUserService.d.ts +11 -0
- package/dist/src/DefaultArchbaseTokenManager.d.ts +20 -0
- package/dist/src/SecurityDomain.d.ts +221 -0
- package/dist/src/SecurityType.d.ts +5 -0
- package/dist/src/examples/ContextualAuthenticationExample.d.ts +113 -0
- package/dist/src/examples/SecurityExample.d.ts +2 -0
- package/dist/src/hooks/index.d.ts +5 -0
- package/dist/src/hooks/useArchbaseAuthenticationManager.d.ts +36 -0
- package/dist/src/hooks/useArchbaseGetCurrentToken.d.ts +4 -0
- package/dist/src/hooks/useArchbaseGetLoggedUser.d.ts +2 -0
- package/dist/src/hooks/useArchbaseResetPassword.d.ts +8 -0
- package/dist/src/hooks/useArchbaseSecurityManager.d.ts +11 -0
- package/dist/src/index.d.ts +27 -0
- package/dist/src/oauth2/AuthContext.d.ts +4 -0
- package/dist/src/oauth2/Types.d.ts +108 -0
- package/dist/src/oauth2/authConfig.d.ts +3 -0
- package/dist/src/oauth2/authentication.d.ts +9 -0
- package/dist/src/oauth2/decodeJWT.d.ts +5 -0
- package/dist/src/oauth2/errors.d.ts +5 -0
- package/dist/src/oauth2/hooks.d.ts +2 -0
- package/dist/src/oauth2/httpUtils.d.ts +2 -0
- package/dist/src/oauth2/index.d.ts +10 -0
- package/dist/src/oauth2/pkceUtils.d.ts +6 -0
- package/dist/src/oauth2/timeUtils.d.ts +9 -0
- package/dist/src/types/ArchbaseSecurityTypes.d.ts +50 -0
- package/dist/src/types/ContextualAuthentication.d.ts +160 -0
- package/package.json +23 -22
- package/dist/archbase-security-3.0.0.tgz +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ArchbaseAccessToken } from '@archbase/core';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArchbaseEntityTransformer, ArchbaseRemoteApiClient, ArchbaseRemoteApiService } from '@archbase/data';
|
|
2
|
+
import { AccessTokenDto } from './SecurityDomain';
|
|
3
|
+
export declare class ArchbaseAccessTokenService extends ArchbaseRemoteApiService<AccessTokenDto, string> implements ArchbaseEntityTransformer<AccessTokenDto> {
|
|
4
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
5
|
+
protected configureHeaders(): Record<string, string>;
|
|
6
|
+
transform(entity: AccessTokenDto): AccessTokenDto;
|
|
7
|
+
protected getEndpoint(): string;
|
|
8
|
+
getId(entity: AccessTokenDto): string;
|
|
9
|
+
isNewRecord(entity: AccessTokenDto): boolean;
|
|
10
|
+
revoke(token: string): Promise<undefined>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArchbaseEntityTransformer, ArchbaseRemoteApiClient, ArchbaseRemoteApiService } from '@archbase/data';
|
|
2
|
+
import { ApiTokenDto } from './SecurityDomain';
|
|
3
|
+
export declare class ArchbaseApiTokenService extends ArchbaseRemoteApiService<ApiTokenDto, string> implements ArchbaseEntityTransformer<ApiTokenDto> {
|
|
4
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
5
|
+
protected configureHeaders(): Record<string, string>;
|
|
6
|
+
transform(entity: ApiTokenDto): ApiTokenDto;
|
|
7
|
+
protected getEndpoint(): string;
|
|
8
|
+
getId(entity: ApiTokenDto): string;
|
|
9
|
+
isNewRecord(entity: ApiTokenDto): boolean;
|
|
10
|
+
create(email: string, expirationDate: string, name: string, description: string): Promise<ApiTokenDto>;
|
|
11
|
+
revoke(token: string): Promise<undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ArchbaseAccessToken } from './ArchbaseAccessToken';
|
|
2
|
+
import { ContextualAuthenticationResponse, ContextualAuthenticationRequest, FlexibleLoginRequest, SocialLoginRequest, RegisterUserRequest, SupportedContextsResponse, ContextValidationResponse } from './types/ContextualAuthentication';
|
|
3
|
+
export interface ArchbaseAuthenticator {
|
|
4
|
+
login(username: string, password: string): Promise<ArchbaseAccessToken>;
|
|
5
|
+
refreshToken(refresh_token: string): Promise<ArchbaseAccessToken>;
|
|
6
|
+
sendResetPasswordEmail(email: string): Promise<void>;
|
|
7
|
+
resetPassword(email: string, passwordResetToken: string, newPassword: string): Promise<void>;
|
|
8
|
+
/** Login contextual com suporte a enrichers específicos da aplicação */
|
|
9
|
+
loginWithContext?(request: ContextualAuthenticationRequest): Promise<ContextualAuthenticationResponse>;
|
|
10
|
+
/** Login flexível com email ou telefone */
|
|
11
|
+
loginFlexible?(request: FlexibleLoginRequest): Promise<ContextualAuthenticationResponse>;
|
|
12
|
+
/** Login via provedores sociais (Google, Facebook, Apple) */
|
|
13
|
+
loginSocial?(request: SocialLoginRequest): Promise<ContextualAuthenticationResponse>;
|
|
14
|
+
/** Registro de usuário com dados adicionais de negócio */
|
|
15
|
+
register?(request: RegisterUserRequest): Promise<{
|
|
16
|
+
email: string;
|
|
17
|
+
businessId?: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** Lista contextos suportados pela implementação */
|
|
21
|
+
getSupportedContexts?(): Promise<SupportedContextsResponse>;
|
|
22
|
+
/** Valida se um contexto específico é suportado */
|
|
23
|
+
validateContext?(context: string): Promise<ContextValidationResponse>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArchbaseRemoteApiService, ArchbaseEntityTransformer, ArchbaseRemoteApiClient } from '@archbase/data';
|
|
2
|
+
import { GroupDto } from './SecurityDomain';
|
|
3
|
+
export declare class ArchbaseGroupService extends ArchbaseRemoteApiService<GroupDto, string> implements ArchbaseEntityTransformer<GroupDto> {
|
|
4
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
5
|
+
protected configureHeaders(): Record<string, string>;
|
|
6
|
+
transform(entity: GroupDto): GroupDto;
|
|
7
|
+
protected getEndpoint(): string;
|
|
8
|
+
getId(entity: GroupDto): string;
|
|
9
|
+
isNewRecord(entity: GroupDto): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CardProps } from '@mantine/core';
|
|
3
|
+
export interface MockUser {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ArchbaseLoginOptions {
|
|
9
|
+
customContentBefore?: React.ReactNode;
|
|
10
|
+
afterInputs?: React.ReactNode;
|
|
11
|
+
customContentAfter?: React.ReactNode;
|
|
12
|
+
cardProps?: CardProps;
|
|
13
|
+
}
|
|
14
|
+
export interface ArchbaseLoginProps {
|
|
15
|
+
onLogin: (username: string, password: string, rememberMe: boolean) => Promise<void>;
|
|
16
|
+
error?: string;
|
|
17
|
+
onClickForgotPassword?: () => void;
|
|
18
|
+
loginLabel?: string;
|
|
19
|
+
loginPlaceholder?: string;
|
|
20
|
+
afterInputs?: ReactNode;
|
|
21
|
+
showMockUsersSelector?: boolean;
|
|
22
|
+
mockUsers?: MockUser[];
|
|
23
|
+
mockUsersGroupMap?: Record<string, string>;
|
|
24
|
+
options?: ArchbaseLoginOptions;
|
|
25
|
+
onChangeUsername?: (username: string) => void;
|
|
26
|
+
disabledLogin?: boolean;
|
|
27
|
+
isCheckingUsername?: boolean;
|
|
28
|
+
showSignIn?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function ArchbaseLogin({ onLogin, error, onClickForgotPassword, loginLabel, loginPlaceholder, afterInputs, showMockUsersSelector, mockUsers, mockUsersGroupMap, options, onChangeUsername, disabledLogin, isCheckingUsername, showSignIn, }: ArchbaseLoginProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArchbaseRemoteApiService, ArchbaseEntityTransformer, ArchbaseRemoteApiClient } from '@archbase/data';
|
|
2
|
+
import { ProfileDto } from './SecurityDomain';
|
|
3
|
+
export declare class ArchbaseProfileService extends ArchbaseRemoteApiService<ProfileDto, string> implements ArchbaseEntityTransformer<ProfileDto> {
|
|
4
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
5
|
+
protected configureHeaders(): Record<string, string>;
|
|
6
|
+
transform(entity: ProfileDto): ProfileDto;
|
|
7
|
+
protected getEndpoint(): string;
|
|
8
|
+
getId(entity: ProfileDto): string;
|
|
9
|
+
isNewRecord(entity: ProfileDto): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from '@mantine/core';
|
|
2
|
+
export interface ArchbaseResetPasswordProps {
|
|
3
|
+
error?: string;
|
|
4
|
+
initialEmail?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
onSendResetPasswordEmail: (email: string) => Promise<void>;
|
|
7
|
+
onResetPassword: (email: string, passwordResetToken: string, newPassword: string) => Promise<void>;
|
|
8
|
+
onClickBackToLogin: () => void;
|
|
9
|
+
validatePassword?: () => string;
|
|
10
|
+
validateToken?: () => string;
|
|
11
|
+
/** Estilo do card */
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export declare function ArchbaseResetPassword({ error, onSendResetPasswordEmail, onResetPassword, onClickBackToLogin, validatePassword, validateToken, initialEmail, description, style }: ArchbaseResetPasswordProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ArchbaseEntityTransformer, ArchbaseRemoteApiClient, ArchbaseRemoteApiService } from '@archbase/data';
|
|
2
|
+
import { ResouceActionPermissionDto, ResoucePermissionsWithTypeDto, ResourceDto, ResourcePermissionsDto, ResourceRegisterDto } from './SecurityDomain';
|
|
3
|
+
import { SecurityType } from './SecurityType';
|
|
4
|
+
export declare class ArchbaseResourceService extends ArchbaseRemoteApiService<ResourceDto, string> implements ArchbaseEntityTransformer<ResourceDto> {
|
|
5
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
6
|
+
protected configureHeaders(): Record<string, string>;
|
|
7
|
+
transform(entity: ResourceDto): ResourceDto;
|
|
8
|
+
protected getEndpoint(): string;
|
|
9
|
+
getId(entity: ResourceDto): string;
|
|
10
|
+
isNewRecord(entity: ResourceDto): boolean;
|
|
11
|
+
getAllPermissionsAvailable(): Promise<ResoucePermissionsWithTypeDto[]>;
|
|
12
|
+
getPermissionsBySecurityId(securityId: string, type: SecurityType): Promise<ResoucePermissionsWithTypeDto[]>;
|
|
13
|
+
createPermission(securityId: string, actionId: string, type: SecurityType): Promise<ResouceActionPermissionDto>;
|
|
14
|
+
deletePermission(permissionId: string): Promise<void>;
|
|
15
|
+
registerResource(resourceRegister: ResourceRegisterDto): Promise<ResourcePermissionsDto>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface ArchbaseProtectedComponentProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
actionName?: string;
|
|
5
|
+
requiredPermissions?: string[];
|
|
6
|
+
requireAll?: boolean;
|
|
7
|
+
actionDescription?: string;
|
|
8
|
+
fallback?: ReactNode;
|
|
9
|
+
autoRegister?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const ArchbaseProtectedComponent: React.FC<ArchbaseProtectedComponentProps>;
|
|
12
|
+
export interface ArchbaseSecureActionButtonProps {
|
|
13
|
+
actionName: string;
|
|
14
|
+
actionDescription: string;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
variant?: 'primary' | 'secondary' | 'danger' | 'success' | 'warning';
|
|
21
|
+
size?: 'small' | 'medium' | 'large';
|
|
22
|
+
type?: 'button' | 'submit' | 'reset';
|
|
23
|
+
}
|
|
24
|
+
export declare const ArchbaseSecureActionButton: React.FC<ArchbaseSecureActionButtonProps>;
|
|
25
|
+
export interface ArchbaseSecureFormFieldProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
actionName?: string;
|
|
28
|
+
actionDescription?: string;
|
|
29
|
+
showLabel?: boolean;
|
|
30
|
+
label?: string;
|
|
31
|
+
fallbackText?: string;
|
|
32
|
+
fallbackComponent?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const ArchbaseSecureFormField: React.FC<ArchbaseSecureFormFieldProps>;
|
|
35
|
+
export declare function withArchbaseSecurity<P extends object>(WrappedComponent: React.ComponentType<P>, securityOptions: {
|
|
36
|
+
resourceName: string;
|
|
37
|
+
resourceDescription: string;
|
|
38
|
+
requiredPermissions?: string[];
|
|
39
|
+
fallbackComponent?: ReactNode;
|
|
40
|
+
}): (props: P) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ArchbaseSecurityManager } from './ArchbaseSecurityManager';
|
|
3
|
+
import { UserDto } from './SecurityDomain';
|
|
4
|
+
export interface ArchbaseSecurityContextType {
|
|
5
|
+
user: UserDto | null;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
hasGlobalPermission: (actionName: string) => boolean;
|
|
8
|
+
hasAnyGlobalPermission: (actions: string[]) => boolean;
|
|
9
|
+
hasAllGlobalPermissions: (actions: string[]) => boolean;
|
|
10
|
+
isAdmin: boolean;
|
|
11
|
+
error: string | null;
|
|
12
|
+
setError: (error: string | null) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ArchbaseSecurityContext: React.Context<ArchbaseSecurityContextType>;
|
|
15
|
+
export interface ArchbaseSecurityProviderProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
user: UserDto | null;
|
|
18
|
+
onError?: (error: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const ArchbaseSecurityProvider: React.FC<ArchbaseSecurityProviderProps>;
|
|
21
|
+
export interface ArchbaseViewSecurityContextType {
|
|
22
|
+
securityManager: ArchbaseSecurityManager | null;
|
|
23
|
+
hasPermission: (actionName: string) => boolean;
|
|
24
|
+
hasAnyPermission: (actions: string[]) => boolean;
|
|
25
|
+
hasAllPermissions: (actions: string[]) => boolean;
|
|
26
|
+
registerAction: (actionName: string, actionDescription: string) => void;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
error: string | null;
|
|
29
|
+
}
|
|
30
|
+
declare const ArchbaseViewSecurityContext: React.Context<ArchbaseViewSecurityContextType>;
|
|
31
|
+
export interface ArchbaseViewSecurityProviderProps {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
resourceName: string;
|
|
34
|
+
resourceDescription: string;
|
|
35
|
+
requiredPermissions?: string[];
|
|
36
|
+
fallbackComponent?: ReactNode;
|
|
37
|
+
onSecurityReady?: (manager: ArchbaseSecurityManager) => void;
|
|
38
|
+
onError?: (error: string) => void;
|
|
39
|
+
}
|
|
40
|
+
export declare const ArchbaseViewSecurityProvider: React.FC<ArchbaseViewSecurityProviderProps>;
|
|
41
|
+
export { ArchbaseSecurityContext, ArchbaseViewSecurityContext };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ArchbaseSecurityContextType, ArchbaseViewSecurityContextType } from './ArchbaseSecurityContext';
|
|
2
|
+
export declare const useArchbaseSecurity: () => ArchbaseSecurityContextType;
|
|
3
|
+
export declare const useArchbaseViewSecurity: () => ArchbaseViewSecurityContextType;
|
|
4
|
+
export interface UseArchbaseSecureFormReturn {
|
|
5
|
+
hasPermission: (actionName: string) => boolean;
|
|
6
|
+
hasAnyPermission: (actions: string[]) => boolean;
|
|
7
|
+
hasAllPermissions: (actions: string[]) => boolean;
|
|
8
|
+
registerAction: (actionName: string, actionDescription: string) => void;
|
|
9
|
+
securityManager: any;
|
|
10
|
+
canCreate: boolean;
|
|
11
|
+
canEdit: boolean;
|
|
12
|
+
canDelete: boolean;
|
|
13
|
+
canView: boolean;
|
|
14
|
+
canList: boolean;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare const useArchbaseSecureForm: (resourceName?: string, resourceDescription?: string) => UseArchbaseSecureFormReturn;
|
|
19
|
+
export declare const useArchbasePermissionCheck: () => {
|
|
20
|
+
check: (actionName: string) => boolean;
|
|
21
|
+
checkAny: (actions: string[]) => boolean;
|
|
22
|
+
checkAll: (actions: string[]) => boolean;
|
|
23
|
+
isAdmin: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ArchbaseResourceService } from './ArchbaseResourceService';
|
|
2
|
+
import { SimpleActionDto, SimpleResourceDto } from './SecurityDomain';
|
|
3
|
+
export interface ISecurityManager {
|
|
4
|
+
registerAction(actionName: string, actionDescription: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare class ArchbaseSecurityManager implements ISecurityManager {
|
|
7
|
+
protected resourceService: ArchbaseResourceService;
|
|
8
|
+
protected resource: SimpleResourceDto;
|
|
9
|
+
protected actions: SimpleActionDto[];
|
|
10
|
+
protected permissions: string[];
|
|
11
|
+
protected alreadyApplied: boolean;
|
|
12
|
+
protected error: string;
|
|
13
|
+
protected isAdmin: boolean;
|
|
14
|
+
constructor(resourceName: string, resourceDescription: string, isAdmin: boolean);
|
|
15
|
+
registerAction(actionName: string, actionDescription: string): void;
|
|
16
|
+
apply(callback?: Function): Promise<void>;
|
|
17
|
+
hasPermission(actionName: string): boolean;
|
|
18
|
+
isError(): boolean;
|
|
19
|
+
getError(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Retorna todas as permissões atuais
|
|
22
|
+
*/
|
|
23
|
+
getPermissions(): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Retorna o status de carregamento
|
|
26
|
+
*/
|
|
27
|
+
isLoading(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Verifica múltiplas permissões
|
|
30
|
+
*/
|
|
31
|
+
hasAnyPermission(permissions: string[]): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Verifica se tem todas as permissões
|
|
34
|
+
*/
|
|
35
|
+
hasAllPermissions(permissions: string[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Retorna informações detalhadas sobre uma permissão
|
|
38
|
+
*/
|
|
39
|
+
getPermissionInfo(actionName: string): {
|
|
40
|
+
hasPermission: boolean;
|
|
41
|
+
isAdmin: boolean;
|
|
42
|
+
reason: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Registra múltiplas ações de uma vez
|
|
46
|
+
*/
|
|
47
|
+
registerActions(actions: Array<{
|
|
48
|
+
actionName: string;
|
|
49
|
+
actionDescription: string;
|
|
50
|
+
}>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Retorna todas as ações registradas
|
|
53
|
+
*/
|
|
54
|
+
getRegisteredActions(): Array<{
|
|
55
|
+
actionName: string;
|
|
56
|
+
actionDescription: string;
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ArchbaseTenantInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
descricao: string;
|
|
5
|
+
imagemApresentacao?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class ArchbaseTenantManager {
|
|
8
|
+
private static instance;
|
|
9
|
+
private _currentTenant;
|
|
10
|
+
private _availableTenants;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getInstance(): ArchbaseTenantManager;
|
|
13
|
+
get currentTenant$(): import('rxjs').Observable<ArchbaseTenantInfo>;
|
|
14
|
+
get currentTenant(): ArchbaseTenantInfo | null;
|
|
15
|
+
get availableTenants$(): import('rxjs').Observable<ArchbaseTenantInfo[]>;
|
|
16
|
+
get availableTenants(): ArchbaseTenantInfo[];
|
|
17
|
+
setCurrentTenant(tenant: ArchbaseTenantInfo | null): void;
|
|
18
|
+
setAvailableTenants(tenants: ArchbaseTenantInfo[]): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
getHeaders(): Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
export declare function useArchbaseTenantManager(): ArchbaseTenantManager;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ArchbaseTokenManager, ArchbaseAccessToken } from '@archbase/core';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ArchbaseUsernameAndPassword as IArchbaseUsernameAndPassword, ArchbaseUser as IArchbaseUser } from '@archbase/core';
|
|
2
|
+
export declare class ArchbaseUser implements IArchbaseUser {
|
|
3
|
+
id: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
email: string;
|
|
6
|
+
photo: string;
|
|
7
|
+
isAdmin: boolean;
|
|
8
|
+
constructor(data: any);
|
|
9
|
+
static newInstance(): ArchbaseUser;
|
|
10
|
+
}
|
|
11
|
+
export declare class ArchbaseUsernameAndPasswordImpl implements IArchbaseUsernameAndPassword {
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
remember: boolean;
|
|
15
|
+
constructor(data: any);
|
|
16
|
+
static newInstance(): ArchbaseUsernameAndPasswordImpl;
|
|
17
|
+
}
|
|
18
|
+
export { ArchbaseUsernameAndPasswordImpl as ArchbaseUsernameAndPassword };
|
|
19
|
+
export type { ArchbaseUsernameAndPassword as IArchbaseUsernameAndPassword } from '@archbase/core';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArchbaseEntityTransformer, ArchbaseRemoteApiClient, ArchbaseRemoteApiService } from '@archbase/data';
|
|
2
|
+
import { UserDto } from './SecurityDomain';
|
|
3
|
+
export declare class ArchbaseUserService extends ArchbaseRemoteApiService<UserDto, string> implements ArchbaseEntityTransformer<UserDto> {
|
|
4
|
+
constructor(client: ArchbaseRemoteApiClient);
|
|
5
|
+
protected configureHeaders(): Record<string, string>;
|
|
6
|
+
transform(entity: UserDto): UserDto;
|
|
7
|
+
protected getEndpoint(): string;
|
|
8
|
+
getId(entity: UserDto): string;
|
|
9
|
+
isNewRecord(entity: UserDto): boolean;
|
|
10
|
+
getUserByEmail(email: string): Promise<UserDto>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ArchbaseTokenManager, ArchbaseAccessToken, ArchbaseUsernameAndPassword } from '@archbase/core';
|
|
2
|
+
export declare const ENCRYPTION_KEY = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=";
|
|
3
|
+
export declare const TOKEN_COOKIE_NAME = "c1ab58e7-c113-4225-a190-a9e59d1207fc";
|
|
4
|
+
export declare const USER_NAME_AND_PASSWORD = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd";
|
|
5
|
+
export declare const USER_NAME = "602b05c5-ec46-451e-aba6-187e463bc245";
|
|
6
|
+
export declare const CONTEXT_STORAGE_KEY = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
|
|
7
|
+
export declare class DefaultArchbaseTokenManager implements ArchbaseTokenManager {
|
|
8
|
+
getUsernameAndPassword(): ArchbaseUsernameAndPassword | null;
|
|
9
|
+
saveUsernameAndPassword(username: string, password: string): void;
|
|
10
|
+
getUsername(): string | null;
|
|
11
|
+
saveUsername(username: string): void;
|
|
12
|
+
isTokenExpired(token?: ArchbaseAccessToken, expirationThreshold?: number): boolean;
|
|
13
|
+
saveToken(accessToken?: ArchbaseAccessToken): void;
|
|
14
|
+
clearUsernameAndPassword(): void;
|
|
15
|
+
clearToken(): void;
|
|
16
|
+
getToken(): ArchbaseAccessToken | null;
|
|
17
|
+
saveContext(context: string): void;
|
|
18
|
+
getContext(): string | null;
|
|
19
|
+
clearContext(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export declare enum TipoRecurso {
|
|
2
|
+
VIEW = "VIEW",
|
|
3
|
+
API = "API"
|
|
4
|
+
}
|
|
5
|
+
export declare class AccessScheduleDto {
|
|
6
|
+
id: string;
|
|
7
|
+
code: string;
|
|
8
|
+
version: number;
|
|
9
|
+
createEntityDate: string;
|
|
10
|
+
updateEntityDate: string;
|
|
11
|
+
createdByUser: string;
|
|
12
|
+
lastModifiedByUser: string;
|
|
13
|
+
description: string;
|
|
14
|
+
intervals: AccessIntervalDto[];
|
|
15
|
+
constructor(data: any);
|
|
16
|
+
static newInstance: () => AccessScheduleDto;
|
|
17
|
+
}
|
|
18
|
+
export declare class AccessIntervalDto {
|
|
19
|
+
id: string;
|
|
20
|
+
code: string;
|
|
21
|
+
version: number;
|
|
22
|
+
createEntityDate: string;
|
|
23
|
+
updateEntityDate: string;
|
|
24
|
+
createdByUser: string;
|
|
25
|
+
lastModifiedByUser: string;
|
|
26
|
+
accessSchedule?: AccessScheduleDto;
|
|
27
|
+
dayOfWeek: number;
|
|
28
|
+
startTime: string;
|
|
29
|
+
endTime: string;
|
|
30
|
+
constructor(data: any);
|
|
31
|
+
static newInstance: () => AccessIntervalDto;
|
|
32
|
+
}
|
|
33
|
+
export declare abstract class SecurityDto {
|
|
34
|
+
id: string;
|
|
35
|
+
code: string;
|
|
36
|
+
version: number;
|
|
37
|
+
createEntityDate: string;
|
|
38
|
+
updateEntityDate: string;
|
|
39
|
+
createdByUser: string;
|
|
40
|
+
lastModifiedByUser: string;
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
actions: ActionDto[];
|
|
44
|
+
constructor(data: any);
|
|
45
|
+
}
|
|
46
|
+
export declare class ActionDto {
|
|
47
|
+
id: string;
|
|
48
|
+
code: string;
|
|
49
|
+
version: number;
|
|
50
|
+
createEntityDate: string;
|
|
51
|
+
updateEntityDate: string;
|
|
52
|
+
createdByUser: string;
|
|
53
|
+
lastModifiedByUser: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
resource?: ResourceDto;
|
|
57
|
+
category: string;
|
|
58
|
+
active: boolean;
|
|
59
|
+
actionVersion: string;
|
|
60
|
+
isNewAction: boolean;
|
|
61
|
+
constructor(data: any);
|
|
62
|
+
static newInstance: () => ActionDto;
|
|
63
|
+
}
|
|
64
|
+
export declare class ProfileDto extends SecurityDto {
|
|
65
|
+
type: string;
|
|
66
|
+
isNewProfile: boolean;
|
|
67
|
+
constructor(data: any);
|
|
68
|
+
static newInstance: () => ProfileDto;
|
|
69
|
+
}
|
|
70
|
+
export declare class UserGroupDto {
|
|
71
|
+
id: string;
|
|
72
|
+
code: string;
|
|
73
|
+
version: number;
|
|
74
|
+
createEntityDate: string;
|
|
75
|
+
updateEntityDate: string;
|
|
76
|
+
createdByUser: string;
|
|
77
|
+
lastModifiedByUser: string;
|
|
78
|
+
group?: GroupDto;
|
|
79
|
+
constructor(data: any);
|
|
80
|
+
static newInstance: (group: GroupDto) => UserGroupDto;
|
|
81
|
+
}
|
|
82
|
+
export declare class GroupDto extends SecurityDto {
|
|
83
|
+
type: string;
|
|
84
|
+
isNewGroup: boolean;
|
|
85
|
+
constructor(data: any);
|
|
86
|
+
static newInstance: () => GroupDto;
|
|
87
|
+
}
|
|
88
|
+
export declare class ResourceDto {
|
|
89
|
+
id: string;
|
|
90
|
+
code: string;
|
|
91
|
+
version: number;
|
|
92
|
+
createEntityDate: string;
|
|
93
|
+
updateEntityDate: string;
|
|
94
|
+
createdByUser: string;
|
|
95
|
+
lastModifiedByUser: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
actions: ActionDto[];
|
|
99
|
+
active: boolean;
|
|
100
|
+
type: TipoRecurso;
|
|
101
|
+
isNewResource: boolean;
|
|
102
|
+
constructor(data: any);
|
|
103
|
+
static newInstance: () => ResourceDto;
|
|
104
|
+
}
|
|
105
|
+
export declare class UserDto extends SecurityDto {
|
|
106
|
+
userName: string;
|
|
107
|
+
password: string;
|
|
108
|
+
changePasswordOnNextLogin: boolean;
|
|
109
|
+
allowPasswordChange: boolean;
|
|
110
|
+
allowMultipleLogins: boolean;
|
|
111
|
+
passwordNeverExpires: boolean;
|
|
112
|
+
accountDeactivated: boolean;
|
|
113
|
+
accountLocked: boolean;
|
|
114
|
+
unlimitedAccessHours: boolean;
|
|
115
|
+
isAdministrator: boolean;
|
|
116
|
+
accessSchedule?: AccessScheduleDto;
|
|
117
|
+
groups: UserGroupDto[];
|
|
118
|
+
profile?: ProfileDto;
|
|
119
|
+
avatar?: string;
|
|
120
|
+
nickname: string;
|
|
121
|
+
email?: string;
|
|
122
|
+
type: string;
|
|
123
|
+
isNewUser: boolean;
|
|
124
|
+
constructor(data: any);
|
|
125
|
+
static newInstance: () => UserDto;
|
|
126
|
+
}
|
|
127
|
+
export declare class PermissionDto {
|
|
128
|
+
id: string;
|
|
129
|
+
code: string;
|
|
130
|
+
version: number;
|
|
131
|
+
createEntityDate: string;
|
|
132
|
+
updateEntityDate: string;
|
|
133
|
+
createdByUser: string;
|
|
134
|
+
lastModifiedByUser: string;
|
|
135
|
+
security?: SecurityDto;
|
|
136
|
+
action?: ActionDto;
|
|
137
|
+
tenantId: string;
|
|
138
|
+
companyId: string;
|
|
139
|
+
projectId: string;
|
|
140
|
+
constructor(data: any);
|
|
141
|
+
static createDtoFromJson(data: any): SecurityDto;
|
|
142
|
+
static newInstance: () => PermissionDto;
|
|
143
|
+
}
|
|
144
|
+
export declare class ApiTokenDto {
|
|
145
|
+
id: string;
|
|
146
|
+
code: string;
|
|
147
|
+
version: number;
|
|
148
|
+
createEntityDate: string;
|
|
149
|
+
updateEntityDate: string;
|
|
150
|
+
createdByUser: string;
|
|
151
|
+
lastModifiedByUser: string;
|
|
152
|
+
tenantId: string;
|
|
153
|
+
name: string;
|
|
154
|
+
description: string;
|
|
155
|
+
token: string;
|
|
156
|
+
user: UserDto;
|
|
157
|
+
expirationDate: string;
|
|
158
|
+
revoked: boolean;
|
|
159
|
+
activated: boolean;
|
|
160
|
+
isNovoToken: boolean;
|
|
161
|
+
constructor(data: any);
|
|
162
|
+
static newInstance: () => ApiTokenDto;
|
|
163
|
+
}
|
|
164
|
+
export declare class AccessTokenDto {
|
|
165
|
+
id: string;
|
|
166
|
+
code: string;
|
|
167
|
+
version: number;
|
|
168
|
+
createEntityDate: string;
|
|
169
|
+
updateEntityDate: string;
|
|
170
|
+
createdByUser: string;
|
|
171
|
+
lastModifiedByUser: string;
|
|
172
|
+
token: string;
|
|
173
|
+
tokenType: string;
|
|
174
|
+
revoked: boolean;
|
|
175
|
+
expired: boolean;
|
|
176
|
+
expirationTime: number;
|
|
177
|
+
expirationDate: string;
|
|
178
|
+
user: UserDto;
|
|
179
|
+
isNewAccessToken: boolean;
|
|
180
|
+
constructor(data: any);
|
|
181
|
+
static newInstance: () => AccessTokenDto;
|
|
182
|
+
}
|
|
183
|
+
export interface GrantPermissionDto {
|
|
184
|
+
securityId: string;
|
|
185
|
+
actionId: string;
|
|
186
|
+
type: string;
|
|
187
|
+
}
|
|
188
|
+
export interface PermissionWithTypesDto {
|
|
189
|
+
permissionId?: string;
|
|
190
|
+
actionId: string;
|
|
191
|
+
actionDescription: string;
|
|
192
|
+
types?: string[];
|
|
193
|
+
}
|
|
194
|
+
export interface ResoucePermissionsWithTypeDto {
|
|
195
|
+
resourceId: string;
|
|
196
|
+
resourceDescription: string;
|
|
197
|
+
permissions: PermissionWithTypesDto[];
|
|
198
|
+
}
|
|
199
|
+
export interface ResouceActionPermissionDto {
|
|
200
|
+
resourceId: string;
|
|
201
|
+
resourceDescription: string;
|
|
202
|
+
permissionId: string;
|
|
203
|
+
actionId: string;
|
|
204
|
+
actionDescription: string;
|
|
205
|
+
}
|
|
206
|
+
export interface SimpleActionDto {
|
|
207
|
+
actionName: string;
|
|
208
|
+
actionDescription: string;
|
|
209
|
+
}
|
|
210
|
+
export interface SimpleResourceDto {
|
|
211
|
+
resourceName: string;
|
|
212
|
+
resourceDescription: string;
|
|
213
|
+
}
|
|
214
|
+
export interface ResourceRegisterDto {
|
|
215
|
+
resource: SimpleResourceDto;
|
|
216
|
+
actions: SimpleActionDto[];
|
|
217
|
+
}
|
|
218
|
+
export interface ResourcePermissionsDto {
|
|
219
|
+
resourceName: string;
|
|
220
|
+
permissions: string[];
|
|
221
|
+
}
|