@ssplib/react-components 0.0.328 → 0.0.329
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/components/providers/KeycloakAuthProvider.d.ts +29 -3
- package/components/providers/OAuthProvider.d.ts +2 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.esm.js +2 -2
- package/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/types/auth.d.ts +61 -7
|
@@ -1,10 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { User } from '../../types/auth';
|
|
1
3
|
export declare const cookieName = "nextauth.token";
|
|
2
|
-
|
|
4
|
+
interface KeycloakAuthProviderProps {
|
|
5
|
+
/** URL do servidor Keycloak */
|
|
3
6
|
url: string;
|
|
7
|
+
/** Realm do Keycloak */
|
|
4
8
|
realm: string;
|
|
9
|
+
/** Client ID registrado no Keycloak */
|
|
5
10
|
clientId: string;
|
|
6
|
-
|
|
11
|
+
/** Componentes filhos */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/** Tipo de autenticação */
|
|
7
14
|
type?: 'govbr' | 'ad';
|
|
15
|
+
/** Nome do recurso para extrair roles */
|
|
8
16
|
resource_name?: string;
|
|
17
|
+
/** URL de redirecionamento após login */
|
|
9
18
|
redirectUri?: string;
|
|
10
|
-
|
|
19
|
+
/** Callback executado quando autenticação é bem-sucedida */
|
|
20
|
+
onAuthSuccess?: (user: User) => void;
|
|
21
|
+
/** Callback executado quando autenticação falha */
|
|
22
|
+
onAuthError?: (error: Error) => void;
|
|
23
|
+
/** Habilita logs de debug (apenas em desenvolvimento) */
|
|
24
|
+
enableDebugLogs?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Provider de autenticação Keycloak
|
|
28
|
+
*
|
|
29
|
+
* Gerencia todo o fluxo de autenticação incluindo:
|
|
30
|
+
* - Inicialização e verificação de SSO
|
|
31
|
+
* - Renovação automática de tokens
|
|
32
|
+
* - Login e logout com callbacks personalizáveis
|
|
33
|
+
* - Verificação de roles
|
|
34
|
+
*/
|
|
35
|
+
export declare function KeycloakAuthProvider({ url, realm, clientId, children, type, resource_name, redirectUri, onAuthSuccess, onAuthError, enableDebugLogs, }: KeycloakAuthProviderProps): JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
interface OiDcConfig {
|
|
2
3
|
client_id: string;
|
|
3
4
|
scope: string;
|
|
@@ -6,7 +7,7 @@ interface OiDcConfig {
|
|
|
6
7
|
}
|
|
7
8
|
export declare const cookieName = "nextauth.token";
|
|
8
9
|
export declare function OAuthProvider({ children, AUTH_URL, oidcConfig, redirectURL, validateTokenRoute, testToken, testIP, logoutURL, }: {
|
|
9
|
-
children:
|
|
10
|
+
children: React.ReactNode;
|
|
10
11
|
AUTH_URL: string;
|
|
11
12
|
oidcConfig: OiDcConfig;
|
|
12
13
|
redirectURL: string;
|