@adatechnology/auth-keycloak 0.0.6 → 0.0.7
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 +19 -1
- package/dist/index.js +13 -1
- package/package.json +3 -3
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(): 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,
|
|
@@ -610,6 +611,7 @@ function Roles(...args) {
|
|
|
610
611
|
var KEYCLOAK_CONFIG = "KEYCLOAK_CONFIG";
|
|
611
612
|
var KEYCLOAK_CLIENT = "KEYCLOAK_CLIENT";
|
|
612
613
|
var KEYCLOAK_HTTP_INTERCEPTOR = "KEYCLOAK_HTTP_INTERCEPTOR";
|
|
614
|
+
var KEYCLOAK_PROVIDER = "KEYCLOAK_PROVIDER";
|
|
613
615
|
|
|
614
616
|
// src/roles.guard.ts
|
|
615
617
|
var import_shared = __toESM(require_dist());
|
|
@@ -710,7 +712,15 @@ var KeycloakModule = class {
|
|
|
710
712
|
{
|
|
711
713
|
provide: KEYCLOAK_CLIENT,
|
|
712
714
|
useFactory: (cfg, httpProvider, logger) => new KeycloakClient(cfg, httpProvider, logger),
|
|
713
|
-
inject: [
|
|
715
|
+
inject: [
|
|
716
|
+
KEYCLOAK_CONFIG,
|
|
717
|
+
import_http_client2.HTTP_PROVIDER,
|
|
718
|
+
{ token: import_logger2.LOGGER_PROVIDER, optional: true }
|
|
719
|
+
]
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
provide: KEYCLOAK_PROVIDER,
|
|
723
|
+
useExisting: KEYCLOAK_CLIENT
|
|
714
724
|
},
|
|
715
725
|
{
|
|
716
726
|
provide: KEYCLOAK_HTTP_INTERCEPTOR,
|
|
@@ -721,6 +731,7 @@ var KeycloakModule = class {
|
|
|
721
731
|
exports: [
|
|
722
732
|
import_core2.Reflector,
|
|
723
733
|
KEYCLOAK_CLIENT,
|
|
734
|
+
KEYCLOAK_PROVIDER,
|
|
724
735
|
KEYCLOAK_HTTP_INTERCEPTOR,
|
|
725
736
|
KEYCLOAK_CONFIG,
|
|
726
737
|
RolesGuard
|
|
@@ -736,6 +747,7 @@ KeycloakModule = __decorateClass([
|
|
|
736
747
|
KEYCLOAK_CLIENT,
|
|
737
748
|
KEYCLOAK_CONFIG,
|
|
738
749
|
KEYCLOAK_HTTP_INTERCEPTOR,
|
|
750
|
+
KEYCLOAK_PROVIDER,
|
|
739
751
|
KeycloakError,
|
|
740
752
|
KeycloakModule,
|
|
741
753
|
Roles,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adatechnology/auth-keycloak",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@adatechnology/http-client": "0.0.
|
|
15
|
-
"@adatechnology/logger": "0.0.
|
|
14
|
+
"@adatechnology/http-client": "0.0.7",
|
|
15
|
+
"@adatechnology/logger": "0.0.6"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@nestjs/common": "^11.0.16",
|