login through OIDC now working with local JWT aund (test) user listing

This commit is contained in:
2019-04-04 16:06:05 +02:00
parent c0b53decc2
commit 5332940a5b
6 changed files with 117 additions and 7 deletions

View File

@@ -13,6 +13,15 @@
<a :href="provider.url">{{ index }} ({{provider.type}})</a>
</li>
</ul>
<h3>Users</h3>
<ul>
<li v-for="(user) in users" >
<a href="#">({{user.id}}) {{user.first_name}}</a>
</li>
</ul>
<button v-on:click="oidc_login">Login via OIDC</button>
<a href="/api/auth/oidc?redirect_url=/login">OIDC with redirect</a>
</section>
<section class="section">
<div class="container">
@@ -61,6 +70,9 @@
this.$store.dispatch('register', { email: this.email, password: this.password })
.then(() => this.$router.push('/'));
},
oidc_login () {
this.$store.dispatch('oidc_login', "\\oidc_login_redirection");
},
},
mounted () {
EventBus.$on('failedRegistering', (msg) => {
@@ -72,12 +84,28 @@
EventBus.$on('loginProvidersLoaded', (providers) => {
this.loginProviders = providers;
});
EventBus.$on('storedTokens', () => {
this.$store.dispatch('loadUsers');
});
this.$store.dispatch('loadLoginProviders');
// get tokens
if(this.$cookies.isKey("tokens")){
this.$store.dispatch('storeTokens', JSON.parse(atob(this.$cookies.get("tokens"))));
this.$cookies.remove("tokens");
}
console.log(this.$cookies.keys());
},
beforeDestroy () {
EventBus.$off('failedRegistering');
EventBus.$off('failedAuthentication');
},
computed: {
users () {
return this.$store.state.users;
},
},
}
</script>