-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use reacticity api for auth state --------- Co-authored-by: Arne Vogt <[email protected]>
- Loading branch information
Showing
10 changed files
with
114 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
"@open-pioneer/authentication-keycloak": minor | ||
"@open-pioneer/authentication": minor | ||
--- | ||
|
||
Replace change events for auth state wiht signals from Reactivity API | ||
|
||
watch for updates of the auth state | ||
```typescript | ||
const myAuthService = ... | ||
watch( | ||
() => [myAuthService.getAuthState()], | ||
([state]) => { | ||
console.log(state); | ||
}, | ||
{ | ||
immediate: true | ||
} | ||
); | ||
``` | ||
|
||
The Auth Service forwards the auth state from the underlying AuthPlugin. | ||
Therefore, the plugin implementation must use reactive signals when its auth state changes in order to signal changes to the service. | ||
```typescript | ||
class DummyPlugin implements AuthPlugin { | ||
#state = reactive<AuthState>( { | ||
kind: "not-authenticated" | ||
}); | ||
|
||
getAuthState(): AuthState { | ||
return this.#state.value; | ||
} | ||
|
||
$setAuthState(newState: AuthState) { | ||
this.#state.value = newState; | ||
} | ||
} | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.