Skip to content

Instantly share code, notes, and snippets.

@postb99
Last active April 6, 2018 12:02
Show Gist options
  • Save postb99/d5a107d67dd2b126741e09accbf5f7c9 to your computer and use it in GitHub Desktop.
Save postb99/d5a107d67dd2b126741e09accbf5f7c9 to your computer and use it in GitHub Desktop.
vue-adal (working)
<template>
<div v-if="isAuthenticated" id="app" class="container-fluid">
<div id="mainTitle">
Hello World
</div>
<router-view/>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'
import router from './router'
import Adal from 'vue-adal'
Vue.use(Adal, {
// This config gets passed along to Adal, so all settings available to adal can be used here.
config: {
...
},
// Set this to true for authentication on startup
requireAuthOnInitialize: true,
// Pass a vue-router object in to add route hooks with authentication and role checking
router: router
})
export default Vue.extend({
name: 'app',
computed: {
isAuthenticated() {
return this.$adal.isAuthenticated()
}
},
methods: {
logOut() {
this.$adal.logout()
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment