From 05c2827c9d8acdf3f675f60b9b322dab959d9926 Mon Sep 17 00:00:00 2001 From: Gerhard Schaden Date: Tue, 20 Dec 2022 08:49:19 +0100 Subject: [PATCH 1/2] expose usermanager as mgr --- vue2/src/vue-oidc-client.ts | 1 + vue3/src/vue-oidc-client.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/vue2/src/vue-oidc-client.ts b/vue2/src/vue-oidc-client.ts index 9439370..e60042a 100644 --- a/vue2/src/vue-oidc-client.ts +++ b/vue2/src/vue-oidc-client.ts @@ -177,6 +177,7 @@ export function createOidcAuth( const auth = new Vue({ data() { return { + mgr, user: null as User | null, myRouter: null as Router | null } diff --git a/vue3/src/vue-oidc-client.ts b/vue3/src/vue-oidc-client.ts index 116491b..23b0189 100644 --- a/vue3/src/vue-oidc-client.ts +++ b/vue3/src/vue-oidc-client.ts @@ -180,6 +180,7 @@ export function createOidcAuth( const authObj = reactive({ appUrl, authName, + mgr, user, isAuthenticated: computed(() => !!user.value && !user.value.expired), accessToken: computed(() => From 78988815dbe9560efbe098f1344801d8055a1e35 Mon Sep 17 00:00:00 2001 From: Gerhard Schaden Date: Tue, 20 Dec 2022 09:54:23 +0100 Subject: [PATCH 2/2] fix sample-app --- vue3/src/sample-app/main-async.ts | 3 +-- vue3/src/vue-oidc-client.d.ts | 6 +++++- vue3/src/vue-oidc-client.ts | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vue3/src/sample-app/main-async.ts b/vue3/src/sample-app/main-async.ts index 2e668dd..95b998e 100644 --- a/vue3/src/sample-app/main-async.ts +++ b/vue3/src/sample-app/main-async.ts @@ -1,11 +1,10 @@ import { createApp } from 'vue' import App from './App.vue' -import { configureRouter } from './router-async' +import router from './router' import { configureOidc } from './idsrvAuth-async' void (async function() { const idsrvAuth = await configureOidc() - const router = await configureRouter() idsrvAuth.startup().then(ok => { if (ok) { diff --git a/vue3/src/vue-oidc-client.d.ts b/vue3/src/vue-oidc-client.d.ts index c16efa3..d2e0dde 100644 --- a/vue3/src/vue-oidc-client.d.ts +++ b/vue3/src/vue-oidc-client.d.ts @@ -1,5 +1,5 @@ import { Router } from 'vue-router'; -import { UserManagerSettings, Logger, User, Profile, UserManagerEvents } from 'oidc-client'; +import { UserManagerSettings, Logger, User, UserManager, Profile, UserManagerEvents } from 'oidc-client'; /** * Indicates the sign in behavior. */ @@ -71,6 +71,10 @@ export interface OidcAuth { * Required call before all the properties are reliably initialized. * Should be called and waited on before starting the root Vue instance. */ + /** + * User manager from oidc-client-ts + */ + readonly mgr: UserManager; startup(): Promise; /** * Hookup this auth instance with a vue-router instance. diff --git a/vue3/src/vue-oidc-client.ts b/vue3/src/vue-oidc-client.ts index 23b0189..958c396 100644 --- a/vue3/src/vue-oidc-client.ts +++ b/vue3/src/vue-oidc-client.ts @@ -85,6 +85,12 @@ export interface OidcAuth { * Required call before all the properties are reliably initialized. * Should be called and waited on before starting the root Vue instance. */ + + /** + * User manager from oidc-client-ts + */ + readonly mgr: UserManager; + startup(): Promise /** * Hookup this auth instance with a vue-router instance.