Skip to content

Commit

Permalink
Don't immediately signin on userUnload for #62.
Browse files Browse the repository at this point in the history
  • Loading branch information
soukoku committed Feb 23, 2022
1 parent 9a59b83 commit d26136f
Show file tree
Hide file tree
Showing 22 changed files with 212 additions and 37 deletions.
163 changes: 163 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-oidc-client",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"description": "Wrapper around oidc-client-js to to better work in a Vue application with Vue Router integration.",
"author": "Eugene Wang",
"license": "MIT",
Expand Down
3 changes: 1 addition & 2 deletions vue2/dist/vue-oidc-client.common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue2/dist/vue-oidc-client.common.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions vue2/dist/vue-oidc-client.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue2/dist/vue-oidc-client.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue2/dist/vue-oidc-client.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue2/dist/vue-oidc-client.umd.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue2/src/sample-app/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="nav">
<router-link to="/">Vue 2 Home</router-link> |
<router-link to="/about">About (Protected) </router-link> |
<a href="#" @click="$oidc.signOut()" v-if="$oidc.isAuthenticated"
<a href="#" @click.prevent="$oidc.signOut()" v-if="$oidc.isAuthenticated"
>Signout</a
>
</div>
Expand Down
2 changes: 1 addition & 1 deletion vue2/src/vue-oidc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export function createOidcAuth(

// redirect if on protected route (best method here?)
Log.debug(`${auth.authName} auth user unloaded`)
signInIfNecessary()
// signInIfNecessary()
})

mgr.events.addAccessTokenExpired(() => {
Expand Down
4 changes: 2 additions & 2 deletions vue3/dist/vue-oidc-client.common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue3/dist/vue-oidc-client.common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions vue3/dist/vue-oidc-client.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue3/dist/vue-oidc-client.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue3/dist/vue-oidc-client.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue3/dist/vue-oidc-client.umd.min.js.map

Large diffs are not rendered by default.

33 changes: 25 additions & 8 deletions vue3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"eslint-plugin-vue": "^7.9.0",
"typescript": "~4.2.4",
"vue": "^3.0.11",
"vue-router": "^4.0.6"
"vue-router": "^4.0.12"
}
}
9 changes: 3 additions & 6 deletions vue3/src/sample-app/App.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<template>
<div id="nav">
<router-link to="/">Vue 3 Home</router-link> |
<router-link to="/about">About (Protected) </router-link> |
<a href="#" @click="$oidc.signOut()" v-if="$oidc.isAuthenticated"
>Signout</a
>
<router-link to="/">Vue 3 Home</router-link>|
<router-link to="/about">About (Protected)</router-link>|
<a href="#" @click.prevent="$oidc.signOut" v-if="$oidc.isAuthenticated">Signout</a>
</div>
<router-view />
</template>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion vue3/src/sample-app/idsrvAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const appRootUrl = `${loco.protocol}//${loco.host}${process.env.BASE_URL}`

const idsrvAuth = createOidcAuth(
'main',
SignInType.Popup,
SignInType.Window,
appRootUrl,
{
authority: 'https://demo.identityserver.io/',
Expand Down
1 change: 0 additions & 1 deletion vue3/src/sample-app/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default {
return { ...this.$oidc.userProfile, accessToken: this.$oidc.accessToken }
},
claims() {
debugger
if (this.user) {
return Object.keys(this.user).map(key => ({
key,
Expand Down
3 changes: 2 additions & 1 deletion vue3/src/vue-oidc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export function createOidcAuth(
redirectAfterSignout(myRouter)
})
}
mgr.stopSilentRenew()
return mgr.signoutRedirect(args)
},
startSilentRenew() {
Expand Down Expand Up @@ -377,7 +378,7 @@ export function createOidcAuth(

// redirect if on protected route (best method here?)
Log.debug(`${authName} auth user unloaded`)
signInIfNecessary()
// signInIfNecessary()

This comment has been minimized.

Copy link
@MisterFab1an

MisterFab1an Feb 23, 2022

I don't quite seems to understand if this actually makes a difference.
No matter what I try, the if-stub in the signInIfNecessary() method never gets called anyways (prior to alpha.4).

This comment has been minimized.

Copy link
@soukoku

soukoku Feb 24, 2022

Author Owner

Having it can cause the first endsession call to be canceled in the browser.

})

mgr.events.addAccessTokenExpired(() => {
Expand Down

0 comments on commit d26136f

Please sign in to comment.