@adatechnology/auth-keycloak 0.0.6 → 0.0.8

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/README.md CHANGED
@@ -5,34 +5,35 @@ Módulo Keycloak para autenticação de clients e usuários, seguindo o padrão
5
5
  Este pacote fornece um cliente leve para interagir com o Keycloak (obter/refresh de tokens, introspecção, userinfo)
6
6
  e um interceptor opcional. O módulo foi projetado para ser usado junto ao `@adatechnology/http-client`.
7
7
 
8
- Principais exportações
8
+ ### Principais exportações
9
9
 
10
- - `KeycloakModule` — módulo principal. Suporta `KeycloakModule.forRoot(config?)` (padrão dinâmico).
11
- - `KEYCLOAK_CLIENT` — provider token para injetar o cliente Keycloak (use `@Inject(KEYCLOAK_CLIENT)`).
12
- - `KEYCLOAK_HTTP_INTERCEPTOR` — provider token para injetar o interceptor (se necessário).
10
+ - `KeycloakModule` — módulo principal. Suporta `KeycloakModule.forRoot(config?)`.
11
+ - `KEYCLOAK_CLIENT` — provider token para injetar o cliente Keycloak (`@Inject(KEYCLOAK_CLIENT)`).
12
+ - `KEYCLOAK_HTTP_INTERCEPTOR` — provider token para injetar o interceptor (opcional).
13
+ - `Roles` / `RolesGuard` — decorator e guard para autorização baseada em roles.
14
+ - `KeycloakError` — classe de erro tipada com `statusCode` e `details`.
13
15
 
14
- Instalação
16
+ ### Instalação
15
17
 
16
- Este pacote já declara dependência interna de workspace para `@adatechnology/http-client`. Em um monorepo PNPM/Turbo o pacote é resolvido automaticamente.
17
-
18
- Uso
18
+ ```bash
19
+ # Este pacote já declara dependências de workspace para http-client, logger e cache.
20
+ # Em um monorepo PNPM/Turbo os pacotes são resolvidos automaticamente.
21
+ ```
19
22
 
20
- - Configuração via código (recomendado quando quiser injetar configuração manualmente):
23
+ ### Uso básico
21
24
 
22
25
  ```ts
23
26
  import { Module } from "@nestjs/common";
24
- import { HttpModule } from "@adatechnology/http-client";
25
27
  import { KeycloakModule } from "@adatechnology/auth-keycloak";
26
28
 
27
29
  @Module({
28
30
  imports: [
29
- HttpModule.forRoot({ baseURL: "https://pokeapi.co/api/v2", timeout: 5000 }),
30
31
  KeycloakModule.forRoot({
31
32
  baseUrl: "https://keycloak.example.com",
32
- realm: "BACKEND",
33
+ realm: "myrealm",
33
34
  credentials: {
34
- clientId: "backend-api",
35
- clientSecret: "backend-api-secret",
35
+ clientId: "my-client",
36
+ clientSecret: "my-secret",
36
37
  grantType: "client_credentials",
37
38
  },
38
39
  }),
@@ -41,68 +42,125 @@ import { KeycloakModule } from "@adatechnology/auth-keycloak";
41
42
  export class AppModule {}
42
43
  ```
43
44
 
44
- - Configuração via `ConfigService` / variáveis de ambiente (padrão quando não passar `forRoot`):
45
+ ### Injeção do cliente
45
46
 
46
- As variáveis usadas pelo módulo interno são:
47
+ ```ts
48
+ import { Inject } from '@nestjs/common';
49
+ import { KEYCLOAK_CLIENT } from '@adatechnology/auth-keycloak';
50
+ import type { KeycloakClientInterface } from '@adatechnology/auth-keycloak';
47
51
 
48
- - `KEYCLOAK_BASE_URL` (padrão: `http://localhost:8081`)
49
- - `KEYCLOAK_REALM` (padrão: `BACKEND`)
50
- - `KEYCLOAK_CLIENT_ID` (padrão: `backend-api`)
51
- - `KEYCLOAK_CLIENT_SECRET` (padrão: `backend-api-secret`)
52
+ constructor(
53
+ @Inject(KEYCLOAK_CLIENT) private readonly keycloakClient: KeycloakClientInterface,
54
+ ) {}
55
+ ```
56
+
57
+ ### API do cliente
52
58
 
53
- API rápida (via token)
59
+ | Método | Descrição |
60
+ |---|---|
61
+ | `getAccessToken()` | Obtém token com cache automático e deduplicação de requisições |
62
+ | `getTokenWithCredentials({ username, password })` | Login com credenciais (resource-owner password grant) |
63
+ | `refreshToken(refreshToken)` | Renova token e atualiza o cache interno |
64
+ | `validateToken(token)` | Introspecção via endpoint `/token/introspect` |
65
+ | `getUserInfo(token)` | Retorna claims via endpoint `/userinfo` |
66
+ | `clearTokenCache()` | Remove o token do cache (útil para forçar renovação) |
54
67
 
55
- - `KEYCLOAK_CLIENT.getAccessToken()` obtém token com cache e deduplicação de requisições.
56
- - `KEYCLOAK_CLIENT.refreshToken(refreshToken)` — renova token.
57
- - `KEYCLOAK_CLIENT.validateToken(token)` — introspecção no Keycloak.
58
- - `KEYCLOAK_CLIENT.getUserInfo(token)` — retorna userinfo.
68
+ ### Cache de token
59
69
 
60
- Exemplo de injeção no NestJS:
70
+ O `KeycloakClient` usa `@adatechnology/cache` para armazenar o access token obtido via `client_credentials`.
71
+ Por padrão é criado um `InMemoryCacheProvider` local. Você pode substituir por Redis ou qualquer implementação
72
+ de `CacheProviderInterface` injetando o provider `CACHE_PROVIDER` no contexto do módulo:
61
73
 
62
74
  ```ts
63
- import { Inject } from '@nestjs/common';
64
- import { KEYCLOAK_CLIENT } from '@adatechnology/auth-keycloak';
65
- import type { KeycloakClientInterface } from '@adatechnology/auth-keycloak';
75
+ import { Module } from "@nestjs/common";
76
+ import { CacheModule } from "@adatechnology/cache";
77
+ import { KeycloakModule } from "@adatechnology/auth-keycloak";
78
+
79
+ @Module({
80
+ imports: [
81
+ // Registra CACHE_PROVIDER como Redis — KeycloakClient o usará automaticamente
82
+ CacheModule.forRoot({
83
+ type: 'redis',
84
+ redis: { host: 'localhost', port: 6379 },
85
+ }),
86
+ KeycloakModule.forRoot({ ... }),
87
+ ],
88
+ })
89
+ export class AppModule {}
90
+ ```
66
91
 
67
- constructor(@Inject(KEYCLOAK_CLIENT) private readonly keycloakClient: KeycloakClientInterface) {}
92
+ Se `CACHE_PROVIDER` não for registrado no módulo, o `KeycloakClient` cria um `InMemoryCacheProvider`
93
+ interno sem necessidade de configuração adicional.
94
+
95
+ O TTL do cache é derivado do campo `expires_in` do token (com 60 segundos de margem). Você pode
96
+ sobrescrever com a opção `tokenCacheTtl` (em **milissegundos**):
97
+
98
+ ```ts
99
+ KeycloakModule.forRoot({
100
+ ...
101
+ tokenCacheTtl: 60_000, // força TTL de 60 s independente do token
102
+ })
68
103
  ```
69
104
 
70
- Notas
105
+ ### Propagação de contexto de log (cascade)
71
106
 
72
- - Este módulo depende de `@adatechnology/http-client` (provider `HTTP_PROVIDER`) para realizar chamadas HTTP ao Keycloak. Configure o `HttpModule` conforme necessário na aplicação que consome este pacote.
73
- - O interceptor `KeycloakHttpInterceptor` é fornecido caso queira integrar com outras camadas que aceitem interceptors.
107
+ O cliente o `logContext` do `AsyncLocalStorage` da lib `@adatechnology/logger`. Para que os logs
108
+ de downstream (keycloak cache) mostrem `className.methodName` da origem correta, use `runWithContext`
109
+ no controller:
74
110
 
75
- ## Autorização (decorator @Roles)
111
+ ```ts
112
+ import { getContext, runWithContext } from '@adatechnology/logger';
76
113
 
77
- O pacote agora fornece um decorator `@Roles()` e um `RolesGuard` para uso nas rotas do NestJS. Exemplos:
114
+ // No controller
115
+ private withCtx<T>(logContext: object, fn: () => Promise<T>): Promise<T> {
116
+ return runWithContext({ ...(getContext() ?? {}), logContext }, fn);
117
+ }
118
+
119
+ async getToken() {
120
+ const logContext = { className: 'MyController', methodName: 'getToken' };
121
+ return this.withCtx(logContext, () => this.keycloakService.getAccessToken());
122
+ }
123
+ ```
124
+
125
+ Resultado no log:
126
+ ```
127
+ [MyController.getToken][KeycloakClient.getAccessToken] → cache miss → request token
128
+ [MyController.getToken][InMemoryCacheProvider.set] → token cached
129
+ ```
130
+
131
+ ### Autorização com @Roles
78
132
 
79
133
  ```ts
80
134
  import { Controller, Get, UseGuards } from "@nestjs/common";
81
- import { Roles } from "@adatechnology/auth-keycloak";
82
- import { RolesGuard } from "@adatechnology/auth-keycloak";
135
+ import { Roles, RolesGuard } from "@adatechnology/auth-keycloak";
83
136
 
84
137
  @Controller("secure")
85
- @UseGuards(RolesGuard)
86
138
  export class SecureController {
139
+ @Get("public")
140
+ @UseGuards(RolesGuard)
141
+ public() {
142
+ return { ok: true };
143
+ }
144
+
87
145
  @Get("admin")
88
- @Roles("admin") // aceita um ou mais roles (OR por padrão)
146
+ @UseGuards(RolesGuard)
147
+ @Roles("admin")
89
148
  adminOnly() {
90
149
  return { ok: true };
91
150
  }
92
151
 
93
152
  @Get("team")
94
- @Roles({ roles: ["manager", "lead"], mode: "all" }) // requer ambos (AND)
153
+ @UseGuards(RolesGuard)
154
+ @Roles({ roles: ["manager", "lead"], mode: "all" }) // AND — requer ambas as roles
95
155
  teamOnly() {
96
156
  return { ok: true };
97
157
  }
98
158
  }
99
159
  ```
100
160
 
101
- O `RolesGuard` extrai roles do payload do JWT (claims `realm_access.roles` e `resource_access[clientId].roles`). Por padrão o decorator verifica ambos (realm e client). Você pode ajustar o comportamento usando as opções `{ type: 'realm'|'client'|'both' }`.
161
+ O `RolesGuard` extrai roles de `realm_access.roles` e `resource_access[clientId].roles` do JWT.
102
162
 
103
- ## Erros
104
-
105
- O pacote exporta `KeycloakError` (classe) que é usada para representar falhas nas chamadas HTTP ao Keycloak. A classe contém `statusCode` e `details` para permitir um tratamento declarativo dos erros na aplicação que consome a biblioteca. Exemplo:
163
+ ### Tratamento de erros
106
164
 
107
165
  ```ts
108
166
  import { KeycloakError } from "@adatechnology/auth-keycloak";
@@ -111,17 +169,31 @@ try {
111
169
  await keycloakClient.getUserInfo(token);
112
170
  } catch (e) {
113
171
  if (e instanceof KeycloakError) {
114
- // tratar problema específico de Keycloak
115
- console.error(e.statusCode, e.details);
172
+ console.error(e.statusCode, e.details, e.keycloakError);
116
173
  }
117
174
  throw e;
118
175
  }
119
176
  ```
120
177
 
121
- Contribuições
178
+ ### Variáveis de ambiente (referência)
179
+
180
+ | Variável | Padrão |
181
+ |---|---|
182
+ | `KEYCLOAK_BASE_URL` | `http://localhost:8081` |
183
+ | `KEYCLOAK_REALM` | `BACKEND` |
184
+ | `KEYCLOAK_CLIENT_ID` | `backend-api` |
185
+ | `KEYCLOAK_CLIENT_SECRET` | `backend-api-secret` |
186
+
187
+ ### Notas
188
+
189
+ - Este módulo depende de `@adatechnology/http-client` para chamadas HTTP ao Keycloak.
190
+ - O interceptor `KeycloakHttpInterceptor` pode ser registrado como `APP_INTERCEPTOR` para integração global.
191
+ - `clearTokenCache()` é assíncrono desde a versão `0.0.7` (retorna `Promise<void>`).
192
+
193
+ ### Contribuições
122
194
 
123
195
  Relate issues/PRs no repositório principal. Mantenha compatibilidade com o padrão usado pelo `HttpModule`.
124
196
 
125
- Licença
197
+ ### Licença
126
198
 
127
199
  MIT
package/dist/index.d.ts CHANGED
@@ -52,6 +52,14 @@ interface KeycloakClientInterface {
52
52
  * Get access token
53
53
  */
54
54
  getAccessToken(): Promise<string>;
55
+ /**
56
+ * Obtain a token using resource-owner credentials (username/password).
57
+ * Returns the full Keycloak token response so callers can access refresh tokens and other fields.
58
+ */
59
+ getTokenWithCredentials(params: {
60
+ username: string;
61
+ password: string;
62
+ }): Promise<KeycloakTokenResponse>;
55
63
  /**
56
64
  * Refresh access token
57
65
  */
@@ -64,7 +72,16 @@ interface KeycloakClientInterface {
64
72
  * Get user info
65
73
  */
66
74
  getUserInfo(token: string): Promise<Record<string, unknown>>;
75
+ /**
76
+ * Clear the internal access token cache maintained by the client.
77
+ */
78
+ clearTokenCache(): Promise<void>;
67
79
  }
80
+ /**
81
+ * Provider-facing interface type to be used when injecting the keycloak provider token.
82
+ * Exported separately to make the intended injection type explicit.
83
+ */
84
+ type KeycloakProviderInterface = KeycloakClientInterface;
68
85
 
69
86
  declare class KeycloakModule {
70
87
  static forRoot(config: KeycloakConfig, httpConfig?: AxiosRequestConfig | AxiosInstance): DynamicModule;
@@ -73,6 +90,7 @@ declare class KeycloakModule {
73
90
  declare const KEYCLOAK_CONFIG = "KEYCLOAK_CONFIG";
74
91
  declare const KEYCLOAK_CLIENT = "KEYCLOAK_CLIENT";
75
92
  declare const KEYCLOAK_HTTP_INTERCEPTOR = "KEYCLOAK_HTTP_INTERCEPTOR";
93
+ declare const KEYCLOAK_PROVIDER = "KEYCLOAK_PROVIDER";
76
94
 
77
95
  type RolesMode = "any" | "all";
78
96
  type RolesType = "realm" | "client" | "both";
@@ -111,4 +129,4 @@ declare class KeycloakError extends Error {
111
129
  });
112
130
  }
113
131
 
114
- export { KEYCLOAK_CLIENT, KEYCLOAK_CONFIG, KEYCLOAK_HTTP_INTERCEPTOR, type KeycloakClientInterface, type KeycloakConfig, KeycloakError, KeycloakModule, type KeycloakTokenResponse, Roles, RolesGuard };
132
+ export { KEYCLOAK_CLIENT, KEYCLOAK_CONFIG, KEYCLOAK_HTTP_INTERCEPTOR, KEYCLOAK_PROVIDER, type KeycloakClientInterface, type KeycloakConfig, KeycloakError, KeycloakModule, type KeycloakProviderInterface, type KeycloakTokenResponse, Roles, RolesGuard };
package/dist/index.js CHANGED
@@ -271,6 +271,7 @@ __export(index_exports, {
271
271
  KEYCLOAK_CLIENT: () => KEYCLOAK_CLIENT,
272
272
  KEYCLOAK_CONFIG: () => KEYCLOAK_CONFIG,
273
273
  KEYCLOAK_HTTP_INTERCEPTOR: () => KEYCLOAK_HTTP_INTERCEPTOR,
274
+ KEYCLOAK_PROVIDER: () => KEYCLOAK_PROVIDER,
274
275
  KeycloakError: () => KeycloakError,
275
276
  KeycloakModule: () => KeycloakModule,
276
277
  Roles: () => Roles,
@@ -283,11 +284,14 @@ var import_common5 = require("@nestjs/common");
283
284
  var import_core2 = require("@nestjs/core");
284
285
  var import_http_client2 = require("@adatechnology/http-client");
285
286
  var import_logger2 = require("@adatechnology/logger");
287
+ var import_cache3 = require("@adatechnology/cache");
286
288
 
287
289
  // src/keycloak.client.ts
288
290
  var import_common = require("@nestjs/common");
289
291
  var import_http_client = require("@adatechnology/http-client");
290
292
  var import_logger = require("@adatechnology/logger");
293
+ var import_cache = require("@adatechnology/cache");
294
+ var import_cache2 = require("@adatechnology/cache");
291
295
 
292
296
  // src/errors/keycloak-error.ts
293
297
  var KeycloakError = class _KeycloakError extends Error {
@@ -306,7 +310,8 @@ var KeycloakError = class _KeycloakError extends Error {
306
310
 
307
311
  // src/keycloak.client.ts
308
312
  var LIB_NAME = "@adatechnology/auth-keycloak";
309
- var LIB_VERSION = "0.0.2";
313
+ var LIB_VERSION = "0.0.7";
314
+ var TOKEN_CACHE_KEY = "keycloak:access_token";
310
315
  function extractErrorInfo(err) {
311
316
  var _a, _b, _c, _d, _e;
312
317
  const statusCode = (err == null ? void 0 : err.status) ?? ((_a = err == null ? void 0 : err.response) == null ? void 0 : _a.status);
@@ -332,18 +337,21 @@ function extractErrorInfo(err) {
332
337
  };
333
338
  }
334
339
  var KeycloakClient = class {
335
- constructor(config, httpProvider, logger) {
340
+ constructor(config, httpProvider, logger, cacheProvider) {
336
341
  this.config = config;
337
342
  this.httpProvider = httpProvider;
338
343
  this.logger = logger;
344
+ this.cacheProvider = cacheProvider ?? new import_cache.InMemoryCacheProvider(logger);
339
345
  }
340
- tokenCache = null;
346
+ cacheProvider;
341
347
  tokenPromise = null;
342
348
  log(level, message, libMethod, meta) {
343
349
  if (!this.logger) return;
350
+ const loggerCtx = (0, import_logger.getContext)();
344
351
  const httpCtx = (0, import_http_client.getHttpRequestContext)();
345
- const requestId = httpCtx == null ? void 0 : httpCtx.requestId;
346
- const source = (httpCtx == null ? void 0 : httpCtx.className) && (httpCtx == null ? void 0 : httpCtx.methodName) ? `${httpCtx.className}.${httpCtx.methodName}` : void 0;
352
+ const logContext = loggerCtx == null ? void 0 : loggerCtx.logContext;
353
+ const requestId = (loggerCtx == null ? void 0 : loggerCtx.requestId) ?? (httpCtx == null ? void 0 : httpCtx.requestId);
354
+ const source = (logContext == null ? void 0 : logContext.className) && (logContext == null ? void 0 : logContext.methodName) ? `${logContext.className}.${logContext.methodName}` : (httpCtx == null ? void 0 : httpCtx.className) && (httpCtx == null ? void 0 : httpCtx.methodName) ? `${httpCtx.className}.${httpCtx.methodName}` : void 0;
347
355
  const payload = {
348
356
  message,
349
357
  context: "KeycloakClient",
@@ -362,10 +370,10 @@ var KeycloakClient = class {
362
370
  async getAccessToken() {
363
371
  const method = "getAccessToken";
364
372
  this.log("debug", `${method} - Start`, method);
365
- const now = Date.now();
366
- if (this.tokenCache && now < this.tokenCache.expiresAt) {
373
+ const cached = await this.cacheProvider.get(TOKEN_CACHE_KEY);
374
+ if (cached) {
367
375
  this.log("debug", `${method} - Returning cached token`, method);
368
- return this.tokenCache.token;
376
+ return cached;
369
377
  }
370
378
  if (this.tokenPromise) {
371
379
  this.log("debug", `${method} - Waiting for existing token request`, method);
@@ -374,8 +382,8 @@ var KeycloakClient = class {
374
382
  this.tokenPromise = (async () => {
375
383
  try {
376
384
  const tokenResponse = await this.requestToken();
377
- const expiresAt = this.config.tokenCacheTtl ? Date.now() + this.config.tokenCacheTtl : Date.now() + (tokenResponse.expires_in - 60) * 1e3;
378
- this.tokenCache = { token: tokenResponse.access_token, expiresAt };
385
+ const ttlSeconds = this.config.tokenCacheTtl ? Math.floor(this.config.tokenCacheTtl / 1e3) : tokenResponse.expires_in - 60;
386
+ await this.cacheProvider.set(TOKEN_CACHE_KEY, tokenResponse.access_token, ttlSeconds);
379
387
  this.log("debug", `${method} - Token obtained and cached`, method);
380
388
  return tokenResponse.access_token;
381
389
  } finally {
@@ -478,8 +486,8 @@ var KeycloakClient = class {
478
486
  logContext: { className: "KeycloakClient", methodName: method }
479
487
  }
480
488
  });
481
- const expiresAt = this.config.tokenCacheTtl ? Date.now() + this.config.tokenCacheTtl : Date.now() + (response.data.expires_in - 60) * 1e3;
482
- this.tokenCache = { token: response.data.access_token, expiresAt };
489
+ const ttlSeconds = this.config.tokenCacheTtl ? Math.floor(this.config.tokenCacheTtl / 1e3) : response.data.expires_in - 60;
490
+ await this.cacheProvider.set(TOKEN_CACHE_KEY, response.data.access_token, ttlSeconds);
483
491
  this.log("debug", `${method} - Success`, method);
484
492
  return response.data;
485
493
  } catch (err) {
@@ -549,12 +557,8 @@ var KeycloakClient = class {
549
557
  });
550
558
  }
551
559
  }
552
- clearTokenCache() {
553
- this.tokenCache = null;
554
- }
555
- static maskToken(token, visibleChars = 8) {
556
- if (!token || typeof token !== "string") return "";
557
- return token.length <= visibleChars ? token : `${token.slice(0, visibleChars)}...`;
560
+ async clearTokenCache() {
561
+ await this.cacheProvider.del(TOKEN_CACHE_KEY);
558
562
  }
559
563
  static scopesToString(scopes) {
560
564
  if (!scopes) return "openid profile email";
@@ -565,7 +569,9 @@ KeycloakClient = __decorateClass([
565
569
  (0, import_common.Injectable)(),
566
570
  __decorateParam(1, (0, import_common.Inject)(import_http_client.HTTP_PROVIDER)),
567
571
  __decorateParam(2, (0, import_common.Optional)()),
568
- __decorateParam(2, (0, import_common.Inject)(import_logger.LOGGER_PROVIDER))
572
+ __decorateParam(2, (0, import_common.Inject)(import_logger.LOGGER_PROVIDER)),
573
+ __decorateParam(3, (0, import_common.Optional)()),
574
+ __decorateParam(3, (0, import_common.Inject)(import_cache2.CACHE_PROVIDER))
569
575
  ], KeycloakClient);
570
576
 
571
577
  // src/keycloak.http.interceptor.ts
@@ -610,6 +616,7 @@ function Roles(...args) {
610
616
  var KEYCLOAK_CONFIG = "KEYCLOAK_CONFIG";
611
617
  var KEYCLOAK_CLIENT = "KEYCLOAK_CLIENT";
612
618
  var KEYCLOAK_HTTP_INTERCEPTOR = "KEYCLOAK_HTTP_INTERCEPTOR";
619
+ var KEYCLOAK_PROVIDER = "KEYCLOAK_PROVIDER";
613
620
 
614
621
  // src/roles.guard.ts
615
622
  var import_shared = __toESM(require_dist());
@@ -709,8 +716,17 @@ var KeycloakModule = class {
709
716
  { provide: KEYCLOAK_CONFIG, useValue: config },
710
717
  {
711
718
  provide: KEYCLOAK_CLIENT,
712
- useFactory: (cfg, httpProvider, logger) => new KeycloakClient(cfg, httpProvider, logger),
713
- inject: [KEYCLOAK_CONFIG, import_http_client2.HTTP_PROVIDER, { token: import_logger2.LOGGER_PROVIDER, optional: true }]
719
+ useFactory: (cfg, httpProvider, logger, cacheProvider) => new KeycloakClient(cfg, httpProvider, logger, cacheProvider),
720
+ inject: [
721
+ KEYCLOAK_CONFIG,
722
+ import_http_client2.HTTP_PROVIDER,
723
+ { token: import_logger2.LOGGER_PROVIDER, optional: true },
724
+ { token: import_cache3.CACHE_PROVIDER, optional: true }
725
+ ]
726
+ },
727
+ {
728
+ provide: KEYCLOAK_PROVIDER,
729
+ useExisting: KEYCLOAK_CLIENT
714
730
  },
715
731
  {
716
732
  provide: KEYCLOAK_HTTP_INTERCEPTOR,
@@ -721,6 +737,7 @@ var KeycloakModule = class {
721
737
  exports: [
722
738
  import_core2.Reflector,
723
739
  KEYCLOAK_CLIENT,
740
+ KEYCLOAK_PROVIDER,
724
741
  KEYCLOAK_HTTP_INTERCEPTOR,
725
742
  KEYCLOAK_CONFIG,
726
743
  RolesGuard
@@ -736,6 +753,7 @@ KeycloakModule = __decorateClass([
736
753
  KEYCLOAK_CLIENT,
737
754
  KEYCLOAK_CONFIG,
738
755
  KEYCLOAK_HTTP_INTERCEPTOR,
756
+ KEYCLOAK_PROVIDER,
739
757
  KeycloakError,
740
758
  KeycloakModule,
741
759
  Roles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/auth-keycloak",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,8 +11,9 @@
11
11
  "dist"
12
12
  ],
13
13
  "dependencies": {
14
- "@adatechnology/http-client": "0.0.6",
15
- "@adatechnology/logger": "0.0.5"
14
+ "@adatechnology/cache": "0.0.7",
15
+ "@adatechnology/http-client": "0.0.8",
16
+ "@adatechnology/logger": "0.0.6"
16
17
  },
17
18
  "peerDependencies": {
18
19
  "@nestjs/common": "^11.0.16",