@open-pioneer/authentication-keycloak 4.7.0-dev.20260713101438 → 4.7.0-dev.20260727091735

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/CHANGELOG.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # @open-pioneer/authentication-keycloak
2
2
 
3
- ## 4.7.0-dev.20260713101438
3
+ ## 4.7.0-dev.20260727091735
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - e433296: Update Chakra UI to 3.36.0
7
+ - e433296: Update Chakra UI to 3.36.1
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - 9d84f1e: Migrated from eslint to oxlint.
11
12
  - 78aad9d: Refactor: use private javascript properties instead of typescript private keyword.
12
13
 
13
14
  ## 4.6.0
@@ -51,53 +52,53 @@
51
52
 
52
53
  - f67fd7e: Support configuration of keycloak's login options and logout options.
53
54
 
54
- For example, to redirect to a different site after logout:
55
-
56
- ```ts
57
- // app.ts
58
- const element = createCustomElement({
59
- component: AppUI,
60
- appMetadata,
61
- config: {
62
- properties: {
63
- "@open-pioneer/authentication-keycloak": {
64
- keycloakOptions: {
65
- // ...
66
- keycloakLogoutOptions: {
67
- redirectUri: "https://example.com"
68
- }
69
- }
70
- } satisfies KeycloakProperties
71
- }
72
- }
73
- });
74
- ```
75
-
76
- The plugin also supports options for the `logout` method to supply dynamic logout options:
77
-
78
- ```ts
79
- // via auth service
80
- const authService = ...;
81
- authService.logout({
82
- // These are passed directly the keycloak plugin (if it is being used).
83
- pluginOptions: {
84
- redirectUri: "https://example.com",
85
- }
86
- })
87
-
88
- // via direct reference to the plugin ("authentication-keycloak.KeycloakAuthPlugin")
89
- const keycloakAuthPlugin = ...;
90
- keycloakAuthPlugin.logout({
91
- redirectUri: "https://example.com",
92
- });
93
- ```
55
+ For example, to redirect to a different site after logout:
56
+
57
+ ```ts
58
+ // app.ts
59
+ const element = createCustomElement({
60
+ component: AppUI,
61
+ appMetadata,
62
+ config: {
63
+ properties: {
64
+ "@open-pioneer/authentication-keycloak": {
65
+ keycloakOptions: {
66
+ // ...
67
+ keycloakLogoutOptions: {
68
+ redirectUri: "https://example.com",
69
+ },
70
+ },
71
+ } satisfies KeycloakProperties,
72
+ },
73
+ },
74
+ });
75
+ ```
76
+
77
+ The plugin also supports options for the `logout` method to supply dynamic logout options:
78
+
79
+ ```ts
80
+ // via auth service
81
+ const authService = ...;
82
+ authService.logout({
83
+ // These are passed directly the keycloak plugin (if it is being used).
84
+ pluginOptions: {
85
+ redirectUri: "https://example.com",
86
+ }
87
+ })
88
+
89
+ // via direct reference to the plugin ("authentication-keycloak.KeycloakAuthPlugin")
90
+ const keycloakAuthPlugin = ...;
91
+ keycloakAuthPlugin.logout({
92
+ redirectUri: "https://example.com",
93
+ });
94
+ ```
94
95
 
95
96
  - f67fd7e: Make `RefreshOptions` optional with sensible default values. The default values have been changed to:
96
- - `autoRefresh`: true
97
- - `interval` (for token lifetime checks): 10 seconds
98
- - `timeLeft`: 60 seconds (minimum required lifetime during token validity checks)
97
+ - `autoRefresh`: true
98
+ - `interval` (for token lifetime checks): 10 seconds
99
+ - `timeLeft`: 60 seconds (minimum required lifetime during token validity checks)
99
100
 
100
- These values are used when they are not explicitly configured using package properties.
101
+ These values are used when they are not explicitly configured using package properties.
101
102
 
102
103
  ### Patch Changes
103
104
 
@@ -121,13 +122,13 @@
121
122
  ### Major Changes
122
123
 
123
124
  - 9477e54: Update dependencies
124
- - React 19
125
- - Vite 6
126
- - FormatJS 3
127
- - Open Pioneer Build Tools
128
- - ...
125
+ - React 19
126
+ - Vite 6
127
+ - FormatJS 3
128
+ - Open Pioneer Build Tools
129
+ - ...
129
130
 
130
- For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
131
+ For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
131
132
 
132
133
  ## 2.4.0
133
134
 
@@ -135,39 +136,39 @@
135
136
 
136
137
  - 1ce5f11: Replace change events for auth state with signals from Reactivity API
137
138
 
138
- Example: watch for updates of the auth state
139
-
140
- ```typescript
141
- const myAuthService = ...
142
- watch(
143
- () => [myAuthService.getAuthState()],
144
- ([state]) => {
145
- console.log(state);
146
- },
147
- {
148
- immediate: true
149
- }
150
- );
151
- ```
152
-
153
- The Auth Service forwards the auth state from the underlying AuthPlugin.
154
- Therefore, the plugin implementation must use reactive signals when its auth state changes in order to signal changes to the service.
155
-
156
- ```typescript
157
- class DummyPlugin implements AuthPlugin {
158
- #state = reactive<AuthState>({
159
- kind: "not-authenticated"
160
- });
161
-
162
- getAuthState(): AuthState {
163
- return this.#state.value;
164
- }
165
-
166
- $setAuthState(newState: AuthState) {
167
- this.#state.value = newState;
168
- }
139
+ Example: watch for updates of the auth state
140
+
141
+ ```typescript
142
+ const myAuthService = ...
143
+ watch(
144
+ () => [myAuthService.getAuthState()],
145
+ ([state]) => {
146
+ console.log(state);
147
+ },
148
+ {
149
+ immediate: true
150
+ }
151
+ );
152
+ ```
153
+
154
+ The Auth Service forwards the auth state from the underlying AuthPlugin.
155
+ Therefore, the plugin implementation must use reactive signals when its auth state changes in order to signal changes to the service.
156
+
157
+ ```typescript
158
+ class DummyPlugin implements AuthPlugin {
159
+ #state = reactive<AuthState>({
160
+ kind: "not-authenticated",
161
+ });
162
+
163
+ getAuthState(): AuthState {
164
+ return this.#state.value;
165
+ }
166
+
167
+ $setAuthState(newState: AuthState) {
168
+ this.#state.value = newState;
169
169
  }
170
- ```
170
+ }
171
+ ```
171
172
 
172
173
  ### Patch Changes
173
174
 
@@ -1,6 +1,6 @@
1
1
  import { AuthState, LoginBehavior } from "@open-pioneer/authentication";
2
2
  import { NotificationService } from "@open-pioneer/notifier";
3
- import { Service, ServiceOptions, type DECLARE_SERVICE_INTERFACE } from "@open-pioneer/runtime";
3
+ import { Service, ServiceOptions, DECLARE_SERVICE_INTERFACE } from "@open-pioneer/runtime";
4
4
  import { KeycloakLogoutOptions } from "keycloak-js";
5
5
  import { KeycloakAuthPlugin } from "./api";
6
6
  interface References {
@@ -10,7 +10,7 @@ class KeycloakAuthPluginImpl {
10
10
  #intl;
11
11
  #keycloakOptions;
12
12
  #keycloak;
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
14
14
  #timerId;
15
15
  #watcher;
16
16
  #state = reactive({
@@ -1 +1 @@
1
- {"version":3,"file":"KeycloakAuthPluginImpl.js","sources":["KeycloakAuthPluginImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { AuthState, LoginBehavior } from \"@open-pioneer/authentication\";\nimport { createLogger, destroyResource, Resource } from \"@open-pioneer/core\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport {\n PackageIntl,\n Service,\n ServiceOptions,\n type DECLARE_SERVICE_INTERFACE\n} from \"@open-pioneer/runtime\";\nimport Keycloak, { KeycloakLogoutOptions } from \"keycloak-js\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { KeycloakAuthPlugin } from \"./api\";\nimport { getKeycloakConfig, ResolvedKeycloakOptions } from \"./getKeycloakConfig\";\n\nconst LOG = createLogger(sourceId);\n\ninterface References {\n notifier: NotificationService;\n}\n\nexport class KeycloakAuthPluginImpl implements Service, KeycloakAuthPlugin {\n declare [DECLARE_SERVICE_INTERFACE]: \"authentication-keycloak.KeycloakAuthPlugin\";\n\n #notifier: NotificationService;\n #intl: PackageIntl;\n #keycloakOptions: ResolvedKeycloakOptions;\n #keycloak: Keycloak;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n #timerId: any;\n #watcher: Resource | undefined;\n\n #state = reactive<AuthState>({\n kind: \"pending\"\n });\n\n constructor(options: ServiceOptions<References>) {\n this.#notifier = options.references.notifier;\n this.#intl = options.intl;\n\n try {\n this.#keycloakOptions = getKeycloakConfig(options.properties);\n } catch (e) {\n throw new Error(\"Invalid keycloak configuration\", { cause: e });\n }\n\n try {\n this.#keycloak = new Keycloak(this.#keycloakOptions.config);\n } catch (e) {\n throw new Error(\"Failed to construct keycloak instance\", { cause: e });\n }\n this.#init().catch((e) => {\n this.#updateState({\n kind: \"error\",\n error: e\n });\n this.#notifier.notify({\n level: \"error\",\n title: this.#intl.formatMessage({\n id: \"loginFailed.title\"\n }),\n message: this.#intl.formatMessage({\n id: \"loginFailed.message\"\n })\n });\n\n LOG.error(\"Failed to check if user is authenticated\", e);\n });\n }\n\n destroy() {\n clearInterval(this.#timerId);\n this.#watcher = destroyResource(this.#watcher);\n this.#timerId = undefined;\n }\n\n getAuthState(): AuthState {\n return this.#state.value;\n }\n\n getLoginBehavior(): LoginBehavior {\n const doLogin = () => {\n const options = this.#keycloakOptions.loginOptions;\n LOG.debug(\"Login with options\", options);\n this.#keycloak.login(options);\n };\n return {\n kind: \"effect\",\n login: doLogin\n };\n }\n\n logout(options?: Partial<KeycloakLogoutOptions>) {\n const logoutOptions = {\n ...this.#keycloakOptions.logoutOptions,\n ...options\n };\n LOG.debug(\"Logout with options\", logoutOptions);\n this.#keycloak.logout(logoutOptions);\n }\n\n async #init() {\n const { initOptions, refreshOptions } = this.#keycloakOptions;\n\n let isAuthenticated: boolean;\n try {\n LOG.debug(\"Init with options\", initOptions);\n isAuthenticated = await this.#keycloak.init(initOptions);\n } catch (e) {\n // Note: keycloak.init() can also throw an exception, in addition to a rejected promise.\n // It may also just throw a string..\n const error = typeof e === \"string\" ? new Error(e) : e;\n throw new Error(\"Failed to initialize keycloak session\", { cause: error });\n }\n\n if (isAuthenticated) {\n this.#updateState({\n kind: \"authenticated\",\n sessionInfo: {\n userId: this.#keycloak.subject ? this.#keycloak.subject : \"undefined\",\n userName: this.#keycloak.idTokenParsed?.preferred_username,\n attributes: {\n keycloak: this.#keycloak,\n familyName: this.#keycloak.idTokenParsed?.family_name,\n givenName: this.#keycloak.idTokenParsed?.given_name,\n userName: this.#keycloak.idTokenParsed?.preferred_username\n }\n }\n });\n\n LOG.debug(`User ${this.#keycloak.subject} is authenticated`);\n\n if (refreshOptions.autoRefresh) {\n LOG.debug(\"Starting auto-refresh\", refreshOptions);\n this.__refresh(refreshOptions.interval, refreshOptions.timeLeft);\n }\n } else {\n this.#updateState({\n kind: \"not-authenticated\"\n });\n LOG.debug(\"User is not authenticated\");\n }\n }\n\n // Mocked in test (must stay on the prototype so `vi.spyOn` can replace it;\n // a private `#` method would not be spyable).\n __refresh(interval: number, timeLeft: number) {\n clearInterval(this.#timerId);\n this.#timerId = setInterval(() => {\n LOG.debug(\"Checking token validity\");\n this.#keycloak\n .updateToken(timeLeft)\n .then((refreshed) => {\n if (refreshed) {\n LOG.debug(\"Token refreshed successfully\");\n } else {\n LOG.debug(\"Token is still valid\");\n }\n })\n .catch((e) => {\n LOG.error(\"Failed to refresh token\", e);\n this.#updateState({\n kind: \"not-authenticated\"\n });\n this.destroy();\n });\n }, interval);\n }\n\n #updateState(newState: AuthState) {\n this.#state.value = newState;\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAM1B,MAAM,sBAAA,CAA8D;AAAA,EAGvE,SAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA;AAAA,EAGA,QAAA;AAAA,EACA,QAAA;AAAA,EAEA,SAAS,QAAA,CAAoB;AAAA,IACzB,IAAA,EAAM;AAAA,GACT,CAAA;AAAA,EAED,YAAY,OAAA,EAAqC;AAC7C,IAAA,IAAA,CAAK,SAAA,GAAY,QAAQ,UAAA,CAAW,QAAA;AACpC,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,IAAA;AAErB,IAAA,IAAI;AACA,MAAA,IAAA,CAAK,gBAAA,GAAmB,iBAAA,CAAkB,OAAA,CAAQ,UAAU,CAAA;AAAA,IAChE,SAAS,CAAA,EAAG;AACR,MAAA,MAAM,IAAI,KAAA,CAAM,gCAAA,EAAkC,EAAE,K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AC,CAAA,KAAM;AACV,QAAA,GAAA,CAAI,KAAA,CAAM,2BAA2B,CAAC,CAAA;AACtC,QAAA,IAAA,CAAK,YAAA,CAAa;AAAA,UACd,IAAA,EAAM;AAAA,SACT,CAAA;AACD,QAAA,IAAA,CAAK,OAAA,EAAQ;AAAA,MACjB,CAAC,CAAA;AAAA,IACT,GAAG,QAAQ,CAAA;AAAA,EACf;AAAA,EAEA,aAAa,QAAA,EAAqB;AAC9B,IAAA,IAAA,CAAK,OAAO,KAAA,GAAQ,QAAA;AAAA,EACxB;AACJ;;;;"}
1
+ {"version":3,"file":"KeycloakAuthPluginImpl.js","sources":["KeycloakAuthPluginImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { AuthState, LoginBehavior } from \"@open-pioneer/authentication\";\nimport { createLogger, destroyResource, Resource } from \"@open-pioneer/core\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport {\n PackageIntl,\n Service,\n ServiceOptions,\n DECLARE_SERVICE_INTERFACE\n} from \"@open-pioneer/runtime\";\nimport Keycloak, { KeycloakLogoutOptions } from \"keycloak-js\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { KeycloakAuthPlugin } from \"./api\";\nimport { getKeycloakConfig, ResolvedKeycloakOptions } from \"./getKeycloakConfig\";\n\nconst LOG = createLogger(sourceId);\n\ninterface References {\n notifier: NotificationService;\n}\n\nexport class KeycloakAuthPluginImpl implements Service, KeycloakAuthPlugin {\n declare [DECLARE_SERVICE_INTERFACE]: \"authentication-keycloak.KeycloakAuthPlugin\";\n\n #notifier: NotificationService;\n #intl: PackageIntl;\n #keycloakOptions: ResolvedKeycloakOptions;\n #keycloak: Keycloak;\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n #timerId: any;\n #watcher: Resource | undefined;\n\n #state = reactive<AuthState>({\n kind: \"pending\"\n });\n\n constructor(options: ServiceOptions<References>) {\n this.#notifier = options.references.notifier;\n this.#intl = options.intl;\n\n try {\n this.#keycloakOptions = getKeycloakConfig(options.properties);\n } catch (e) {\n throw new Error(\"Invalid keycloak configuration\", { cause: e });\n }\n\n try {\n this.#keycloak = new Keycloak(this.#keycloakOptions.config);\n } catch (e) {\n throw new Error(\"Failed to construct keycloak instance\", { cause: e });\n }\n this.#init().catch((e) => {\n this.#updateState({\n kind: \"error\",\n error: e\n });\n this.#notifier.notify({\n level: \"error\",\n title: this.#intl.formatMessage({\n id: \"loginFailed.title\"\n }),\n message: this.#intl.formatMessage({\n id: \"loginFailed.message\"\n })\n });\n\n LOG.error(\"Failed to check if user is authenticated\", e);\n });\n }\n\n destroy() {\n clearInterval(this.#timerId);\n this.#watcher = destroyResource(this.#watcher);\n this.#timerId = undefined;\n }\n\n getAuthState(): AuthState {\n return this.#state.value;\n }\n\n getLoginBehavior(): LoginBehavior {\n const doLogin = () => {\n const options = this.#keycloakOptions.loginOptions;\n LOG.debug(\"Login with options\", options);\n this.#keycloak.login(options);\n };\n return {\n kind: \"effect\",\n login: doLogin\n };\n }\n\n logout(options?: Partial<KeycloakLogoutOptions>) {\n const logoutOptions = {\n ...this.#keycloakOptions.logoutOptions,\n ...options\n };\n LOG.debug(\"Logout with options\", logoutOptions);\n this.#keycloak.logout(logoutOptions);\n }\n\n async #init() {\n const { initOptions, refreshOptions } = this.#keycloakOptions;\n\n let isAuthenticated: boolean;\n try {\n LOG.debug(\"Init with options\", initOptions);\n isAuthenticated = await this.#keycloak.init(initOptions);\n } catch (e) {\n // Note: keycloak.init() can also throw an exception, in addition to a rejected promise.\n // It may also just throw a string..\n const error = typeof e === \"string\" ? new Error(e) : e;\n\n // oxlint-disable-next-line preserve-caught-error\n throw new Error(\"Failed to initialize keycloak session\", { cause: error });\n }\n\n if (isAuthenticated) {\n this.#updateState({\n kind: \"authenticated\",\n sessionInfo: {\n userId: this.#keycloak.subject ? this.#keycloak.subject : \"undefined\",\n userName: this.#keycloak.idTokenParsed?.preferred_username,\n attributes: {\n keycloak: this.#keycloak,\n familyName: this.#keycloak.idTokenParsed?.family_name,\n givenName: this.#keycloak.idTokenParsed?.given_name,\n userName: this.#keycloak.idTokenParsed?.preferred_username\n }\n }\n });\n\n LOG.debug(`User ${this.#keycloak.subject} is authenticated`);\n\n if (refreshOptions.autoRefresh) {\n LOG.debug(\"Starting auto-refresh\", refreshOptions);\n this.__refresh(refreshOptions.interval, refreshOptions.timeLeft);\n }\n } else {\n this.#updateState({\n kind: \"not-authenticated\"\n });\n LOG.debug(\"User is not authenticated\");\n }\n }\n\n // Mocked in test (must stay on the prototype so `vi.spyOn` can replace it;\n // a private `#` method would not be spyable).\n __refresh(interval: number, timeLeft: number) {\n clearInterval(this.#timerId);\n this.#timerId = setInterval(() => {\n LOG.debug(\"Checking token validity\");\n this.#keycloak\n .updateToken(timeLeft)\n .then((refreshed) => {\n if (refreshed) {\n LOG.debug(\"Token refreshed successfully\");\n } else {\n LOG.debug(\"Token is still valid\");\n }\n })\n .catch((e) => {\n LOG.error(\"Failed to refresh token\", e);\n this.#updateState({\n kind: \"not-authenticated\"\n });\n this.destroy();\n });\n }, interval);\n }\n\n #updateState(newState: AuthState) {\n this.#state.value = newState;\n }\n}\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAM1B,MAAM,sBAAA,CAA8D;AAAA,EAGvE,SAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA;AAAA,EAGA,QAAA;AAAA,EACA,QAAA;AAAA,EAEA,SAAS,QAAA,CAAoB;AAAA,IACzB,IAAA,EAAM;AAAA,GACT,CAAA;AAAA,EAED,YAAY,OAAA,EAAqC;AAC7C,IAAA,IAAA,CAAK,SAAA,GAAY,QAAQ,UAAA,CAAW,QAAA;AACpC,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,IAAA;AAErB,IAAA,IA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;AACX,UAAA,GAAA,CAAI,MAAM,8BAA8B,CAAA;AAAA,QAC5C,CAAA,MAAO;AACH,UAAA,GAAA,CAAI,MAAM,sBAAsB,CAAA;AAAA,QACpC;AAAA,MACJ,CAAC,CAAA,CACA,KAAA,CAAM,CAAC,CAAA,KAAM;AACV,QAAA,GAAA,CAAI,KAAA,CAAM,2BAA2B,CAAC,CAAA;AACtC,QAAA,IAAA,CAAK,YAAA,CAAa;AAAA,UACd,IAAA,EAAM;AAAA,SACT,CAAA;AACD,QAAA,IAAA,CAAK,OAAA,EAAQ;AAAA,MACjB,CAAC,CAAA;AAAA,IACT,GAAG,QAAQ,CAAA;AAAA,EACf;AAAA,EAEA,aAAa,QAAA,EAAqB;AAC9B,IAAA,IAAA,CAAK,OAAO,KAAA,GAAQ,QAAA;AAAA,EACxB;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getKeycloakConfig.js","sources":["getKeycloakConfig.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger } from \"@open-pioneer/core\";\nimport type {\n KeycloakConfig,\n KeycloakInitOptions,\n KeycloakLoginOptions,\n KeycloakLogoutOptions\n} from \"keycloak-js\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport type { KeycloakProperties, RefreshOptions } from \"./api\";\nconst LOG = createLogger(sourceId);\n\nconst DEFAULT_REFRESH_OPTS = {\n autoRefresh: true,\n interval: 10000,\n timeLeft: 60\n} as const;\n\nconst DEFAULT_INIT_OPTS = {\n onLoad: \"check-sso\",\n pkceMethod: \"S256\"\n} as const;\n\nexport type ResolvedRefreshOptions = Required<RefreshOptions>;\n\nexport interface ResolvedKeycloakOptions {\n config: KeycloakConfig;\n initOptions: KeycloakInitOptions;\n refreshOptions: ResolvedRefreshOptions;\n loginOptions: Partial<KeycloakLoginOptions>;\n logoutOptions: Partial<KeycloakLogoutOptions>;\n}\n\n/**\n * Parses the user supplied package properties.\n */\nexport function getKeycloakConfig(\n properties: Partial<KeycloakProperties>\n): ResolvedKeycloakOptions {\n const { keycloakOptions } = properties;\n if (!keycloakOptions) {\n throw new Error(\n `KeycloakOptions not found: The Keycloak configuration options are required by the plugin to perform login and logout operations`\n );\n }\n const {\n refreshOptions,\n keycloakInitOptions,\n keycloakConfig,\n keycloakLoginOptions,\n keycloakLogoutOptions\n } = keycloakOptions;\n return {\n config: getConfig(keycloakConfig),\n refreshOptions: getRefreshOptions(refreshOptions),\n initOptions: getInitOptions(keycloakInitOptions),\n loginOptions: getLoginOptions(keycloakLoginOptions),\n logoutOptions: getLogoutOptions(keycloakLogoutOptions)\n };\n}\n\nfunction getConfig(keycloakConfig: KeycloakConfig | undefined): KeycloakConfig {\n if (!keycloakConfig || isObjectEmpty(keycloakConfig)) {\n throw new Error(\n `KeycloakConfig not found: The Keycloak configuration options are required by the plugin to perform login and logout operations`\n );\n }\n return { ...keycloakConfig };\n}\n\nfunction getRefreshOptions(refreshOptions: RefreshOptions | undefined): ResolvedRefreshOptions {\n if (!refreshOptions || isObjectEmpty(refreshOptions)) {\n LOG.info(`Using default options for keycloak token refresh`, DEFAULT_REFRESH_OPTS);\n }\n return {\n ...DEFAULT_REFRESH_OPTS,\n ...refreshOptions\n };\n}\n\nfunction getInitOptions(keycloakInitOptions: KeycloakInitOptions | undefined): KeycloakInitOptions {\n if (!keycloakInitOptions || isObjectEmpty(keycloakInitOptions)) {\n LOG.info(`Using default options for keycloak init`, DEFAULT_INIT_OPTS);\n }\n return {\n ...DEFAULT_INIT_OPTS,\n ...keycloakInitOptions\n };\n}\n\nfunction getLoginOptions(\n keycloakLoginOptions: Partial<KeycloakLoginOptions> | undefined\n): Partial<KeycloakLoginOptions> {\n return {\n redirectUri: undefined, // backwards-compat; unsure if needed\n ...keycloakLoginOptions\n };\n}\n\nfunction getLogoutOptions(\n keycloakLogoutOptions: Partial<KeycloakLogoutOptions> | undefined\n): Partial<KeycloakLogoutOptions> {\n return {\n redirectUri: undefined, // backwards-compat; unsure if needed\n ...keycloakLogoutOptions\n };\n}\n\nconst isObjectEmpty = (objectName: unknown) => {\n return objectName && Object.keys(objectName).length === 0 && objectName.constructor === Object;\n};\n"],"names":[],"mappings":";;;AAWA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAEjC,MAAM,oBAAA,GAAuB;AAAA,EACzB,WAAA,EAAa,IAAA;AAAA,EACb,QAAA,EAAU,GAAA;AAAA,EACV,QAAA,EAAU;AACd,CAAA;AAEA,MAAM,iBAAA,GAAoB;AAAA,EACtB,MAAA,EAAQ,WAAA;AAAA,EACR,UAAA,EAAY;AAChB,CAAA;AAeO,SAAS,kBACZ,UAAA,EACuB;AACvB,EAAA,MAAM,EAAE,iBAAgB,GAAI,UAAA;AAC5B,EAAA,IAAI,CAAC,eAAA,EAAiB;AAClB,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,+HAAA;AAAA,KACJ;AAAA,EACJ;AACA,EAAA,MAAM;AAAA,IACF,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACJ,GAAI,eAAA;AACJ,EAAA,OAAO;AAAA,IACH,MAAA,EAAQ,UAAU,cAAc,CAAA;AAAA,IAChC,cAAA,EAAgB,kBAAkB,cAAc,CAAA;AAAA,IAChD,WAAA,EAAa,eAAe,mBAAmB,CAAA;AAAA,IAC/C,YAAA,EAAc,gBAAgB,oBAAoB,CAAA;AAAA,IAClD,aAAA,EAAe,iBAAiB,qBAAqB;AAAA,GACzD;AACJ;AAEA,SAAS,UAAU,cAAA,EAA4D;AAC3E,EAAA,IAAI,CAAC,cAAA,IAAkB,aAAA,CAAc,cAAc,CAAA,EAAG;AAClD,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,8HAAA;AAAA,KACJ;AAAA,EACJ;AACA,EAAA,OAAO,EAAE,GAAG,cAAA,EAAe;AAC/B;AAEA,SAAS,kBAAkB,cAAA,EAAoE;AAC3F,EAAA,IAAI,CAAC,cAAA,IAAkB,aAAA,CAAc,cAAc,CAAA,EAAG;AAClD,IAAA,GAAA,CAAI,IAAA,CAAK,oDAAoD,oBAAoB,CAAA;AAAA,EACrF;AACA,EAAA,OAAO;AAAA,IACH,GAAG,oBAAA;AAAA,IACH,GAAG;AAAA,GACP;AACJ;AAEA,SAAS,eAAe,mBAAA,EAA2E;AAC/F,EAAA,IAAI,CAAC,mBAAA,IAAuB,aAAA,CAAc,mBAAmB,CAAA,EAAG;AAC5D,IAAA,GAAA,CAAI,IAAA,CAAK,2CAA2C,iBAAiB,CAAA;AAAA,EACzE;AACA,EAAA,OAAO;AAAA,IACH,GAAG,iBAAA;AAAA,IACH,GAAG;AAAA,GACP;AACJ;AAEA,SAAS,gBACL,oBAAA,EAC6B;AAC7B,EAAA,OAAO;AAAA,IACH,WAAA,EAAa,MAAA;AAAA;AAAA,IACb,GAAG;AAAA,GACP;AACJ;AAEA,SAAS,iBACL,qBAAA,EAC8B;AAC9B,EAAA,OAAO;AAAA,IACH,WAAA,EAAa,MAAA;AAAA;AAAA,IACb,GAAG;AAAA,GACP;AACJ;AAEA,MAAM,aAAA,GAAgB,CAAC,UAAA,KAAwB;AAC3C,EAAA,OAAO,UAAA,IAAc,OAAO,IAAA,CAAK,UAAU,EAAE,MAAA,KAAW,CAAA,IAAK,WAAW,WAAA,KAAgB,MAAA;AAC5F,CAAA;;;;"}
1
+ {"version":3,"file":"getKeycloakConfig.js","sources":["getKeycloakConfig.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLogger } from \"@open-pioneer/core\";\nimport type {\n KeycloakConfig,\n KeycloakInitOptions,\n KeycloakLoginOptions,\n KeycloakLogoutOptions\n} from \"keycloak-js\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport type { KeycloakProperties, RefreshOptions } from \"./api\";\nconst LOG = createLogger(sourceId);\n\nconst DEFAULT_REFRESH_OPTS = {\n autoRefresh: true,\n interval: 10000,\n timeLeft: 60\n} as const;\n\nconst DEFAULT_INIT_OPTS = {\n onLoad: \"check-sso\",\n pkceMethod: \"S256\"\n} as const;\n\nexport type ResolvedRefreshOptions = Required<RefreshOptions>;\n\nexport interface ResolvedKeycloakOptions {\n config: KeycloakConfig;\n initOptions: KeycloakInitOptions;\n refreshOptions: ResolvedRefreshOptions;\n loginOptions: Partial<KeycloakLoginOptions>;\n logoutOptions: Partial<KeycloakLogoutOptions>;\n}\n\n/**\n * Parses the user supplied package properties.\n */\nexport function getKeycloakConfig(\n properties: Partial<KeycloakProperties>\n): ResolvedKeycloakOptions {\n const { keycloakOptions } = properties;\n if (!keycloakOptions) {\n throw new Error(\n `KeycloakOptions not found: The Keycloak configuration options are required by the plugin to perform login and logout operations`\n );\n }\n const {\n refreshOptions,\n keycloakInitOptions,\n keycloakConfig,\n keycloakLoginOptions,\n keycloakLogoutOptions\n } = keycloakOptions;\n return {\n config: getConfig(keycloakConfig),\n refreshOptions: getRefreshOptions(refreshOptions),\n initOptions: getInitOptions(keycloakInitOptions),\n loginOptions: getLoginOptions(keycloakLoginOptions),\n logoutOptions: getLogoutOptions(keycloakLogoutOptions)\n };\n}\n\nfunction getConfig(keycloakConfig: KeycloakConfig | undefined): KeycloakConfig {\n if (!keycloakConfig || isObjectEmpty(keycloakConfig)) {\n throw new Error(\n `KeycloakConfig not found: The Keycloak configuration options are required by the plugin to perform login and logout operations`\n );\n }\n return { ...keycloakConfig };\n}\n\nfunction getRefreshOptions(refreshOptions: RefreshOptions | undefined): ResolvedRefreshOptions {\n if (!refreshOptions || isObjectEmpty(refreshOptions)) {\n LOG.info(`Using default options for keycloak token refresh`, DEFAULT_REFRESH_OPTS);\n }\n return {\n ...DEFAULT_REFRESH_OPTS,\n ...refreshOptions\n };\n}\n\nfunction getInitOptions(keycloakInitOptions: KeycloakInitOptions | undefined): KeycloakInitOptions {\n if (!keycloakInitOptions || isObjectEmpty(keycloakInitOptions)) {\n LOG.info(`Using default options for keycloak init`, DEFAULT_INIT_OPTS);\n }\n return {\n ...DEFAULT_INIT_OPTS,\n ...keycloakInitOptions\n };\n}\n\nfunction getLoginOptions(\n keycloakLoginOptions: Partial<KeycloakLoginOptions> | undefined\n): Partial<KeycloakLoginOptions> {\n return {\n redirectUri: undefined, // backwards-compat; unsure if needed\n ...keycloakLoginOptions\n };\n}\n\nfunction getLogoutOptions(\n keycloakLogoutOptions: Partial<KeycloakLogoutOptions> | undefined\n): Partial<KeycloakLogoutOptions> {\n return {\n redirectUri: undefined, // backwards-compat; unsure if needed\n ...keycloakLogoutOptions\n };\n}\n\nconst isObjectEmpty = (objectName: unknown) => {\n return objectName && Object.keys(objectName).length === 0 && objectName.constructor === Object;\n};\n"],"names":[],"mappings":";;;AAYA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAEjC,MAAM,oBAAA,GAAuB;AAAA,EACzB,WAAA,EAAa,IAAA;AAAA,EACb,QAAA,EAAU,GAAA;AAAA,EACV,QAAA,EAAU;AACd,CAAA;AAEA,MAAM,iBAAA,GAAoB;AAAA,EACtB,MAAA,EAAQ,WAAA;AAAA,EACR,UAAA,EAAY;AAChB,CAAA;AAeO,SAAS,kBACZ,UAAA,EACuB;AACvB,EAAA,MAAM,EAAE,iBAAgB,GAAI,UAAA;AAC5B,EAAA,IAAI,CAAC,eAAA,EAAiB;AAClB,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,+HAAA;AAAA,KACJ;AAAA,EACJ;AACA,EAAA,MAAM;AAAA,IACF,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACJ,GAAI,eAAA;AACJ,EAAA,OAAO;AAAA,IACH,MAAA,EAAQ,UAAU,cAAc,CAAA;AAAA,IAChC,cAAA,EAAgB,kBAAkB,cAAc,CAAA;AAAA,IAChD,WAAA,EAAa,eAAe,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AgB,MAAA;AAC5F,CAAA;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/authentication-keycloak",
4
- "version": "4.7.0-dev.20260713101438",
4
+ "version": "4.7.0-dev.20260727091735",
5
5
  "description": "Implements authentication against Keycloak servers.",
6
6
  "keywords": [
7
7
  "open-pioneer-trails"
@@ -16,10 +16,10 @@
16
16
  "dependencies": {
17
17
  "@conterra/reactivity-core": "^0.8.6",
18
18
  "keycloak-js": "^26.2.4",
19
- "@open-pioneer/runtime": "4.7.0-dev.20260713101438",
20
- "@open-pioneer/authentication": "4.7.0-dev.20260713101438",
21
- "@open-pioneer/core": "4.7.0-dev.20260713101438",
22
- "@open-pioneer/notifier": "4.7.0-dev.20260713101438"
19
+ "@open-pioneer/authentication": "4.7.0-dev.20260727091735",
20
+ "@open-pioneer/core": "4.7.0-dev.20260727091735",
21
+ "@open-pioneer/notifier": "4.7.0-dev.20260727091735",
22
+ "@open-pioneer/runtime": "4.7.0-dev.20260727091735"
23
23
  },
24
24
  "exports": {
25
25
  "./package.json": "./package.json",