-
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.
* WIP debug BCSC openID connect flow * BCSC authentication * Await all oidcStore calls
- Loading branch information
Showing
14 changed files
with
170 additions
and
81 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
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
13 changes: 8 additions & 5 deletions
13
...RegistryPortal/ecer.clients.registryportal.client/src/components/pages/LogoutCallback.vue
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
11 changes: 7 additions & 4 deletions
11
...RegistryPortal/ecer.clients.registryportal.client/src/components/pages/SigninCallback.vue
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
10 changes: 7 additions & 3 deletions
10
...RegistryPortal/ecer.clients.registryportal.client/src/components/pages/SilentCallback.vue
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
49 changes: 49 additions & 0 deletions
49
src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/oidc.ts
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,49 @@ | ||
import type { SignoutResponse, User } from "oidc-client-ts"; | ||
import { UserManager } from "oidc-client-ts"; | ||
import { defineStore } from "pinia"; | ||
|
||
import type { Authority } from "@/types/authority"; | ||
|
||
import { useConfigStore } from "./config"; | ||
|
||
export interface UserState { | ||
bceidUserManager: UserManager; | ||
bcscUserManager: UserManager; | ||
} | ||
|
||
export const useOidcStore = defineStore("oidc", { | ||
state: (): UserState => ({ | ||
bceidUserManager: new UserManager(useConfigStore().bceidOidcConfiguration), | ||
bcscUserManager: new UserManager(useConfigStore().bcscOidcConfiguration), | ||
}), | ||
|
||
actions: { | ||
async login(authority: Authority): Promise<void> { | ||
return authority === "bceid" ? await this.bceidUserManager.signinRedirect() : await this.bcscUserManager.signinRedirect(); | ||
}, | ||
|
||
async removeUser(authority: Authority): Promise<void> { | ||
return authority === "bceid" ? await this.bceidUserManager.removeUser() : await this.bcscUserManager.removeUser(); | ||
}, | ||
|
||
async signinCallback(authority: Authority): Promise<User> { | ||
return authority === "bceid" ? await this.bceidUserManager.signinRedirectCallback() : await this.bcscUserManager.signinRedirectCallback(); | ||
}, | ||
|
||
async silentCallback(authority: Authority): Promise<void> { | ||
return authority === "bceid" ? await this.bceidUserManager.signinSilentCallback() : await this.bcscUserManager.signinSilentCallback(); | ||
}, | ||
|
||
async signinSilent(authority: Authority): Promise<User | null> { | ||
return authority === "bceid" ? await this.bceidUserManager.signinSilent() : await this.bcscUserManager.signinSilent(); | ||
}, | ||
|
||
async logout(authority: Authority): Promise<void> { | ||
return authority === "bceid" ? await this.bceidUserManager.signoutRedirect() : await this.bcscUserManager.signoutRedirect(); | ||
}, | ||
|
||
async completeLogout(authority: Authority): Promise<SignoutResponse> { | ||
return authority === "bceid" ? await this.bceidUserManager.signoutRedirectCallback() : await this.bcscUserManager.signoutRedirectCallback(); | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.