94 lines
2.7 KiB
Vue
94 lines
2.7 KiB
Vue
<template>
|
|
<div class="container">
|
|
<h1>KTU SA Problemų sprendimo sistema</h1>
|
|
|
|
<template v-if="$store.state.msalAuth.isLoggedIn">
|
|
<div class="alert alert-success">
|
|
<h4 class="alert-heading">Tu esi prisijungęs</h4>
|
|
<span>
|
|
Kliento aplikacija turi tavo saugos raktą. Aplikacija žino, kad tavo
|
|
el. paštas yra: <b>{{ $store.state.msalAuth.email }}</b>
|
|
</span>
|
|
</div>
|
|
<template v-if="$store.state.msalAuth.isAdmin">
|
|
<div class="alert alert-warning">
|
|
<span> Tu esi administratorius. </span>
|
|
</div>
|
|
<h3>Prieigos raktas (Access token)</h3>
|
|
<a
|
|
href="https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens"
|
|
>Dokumentacija</a
|
|
>
|
|
<pre>{{ $store.state.msalAuth.accessToken }}</pre>
|
|
|
|
<h3>Indentifikacijos raktas (ID Token)</h3>
|
|
<a
|
|
href="https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens"
|
|
>Dokumentacija</a
|
|
>
|
|
<pre>{{ $store.state.msalAuth.idToken }}</pre>
|
|
|
|
<h4>Duomenys gaunami iš Indentifikacijos rakto (ID Token)</h4>
|
|
<pre>{{
|
|
$store.state.msalAuth.debugFullTokenResponse.idTokenClaims
|
|
}}</pre>
|
|
<h3>Autorizuotos sritys</h3>
|
|
<pre>{{ $store.state.msalAuth.debugFullTokenResponse.scopes }}</pre>
|
|
<h3>Serverio tokeno patikrinimas</h3>
|
|
<button type="button" class="btn btn-primary" @click="serverVerify">
|
|
Patikrinti
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="btn btn-primary"
|
|
@click="serverAdminVerify"
|
|
>
|
|
Patikrinti ar admin
|
|
</button>
|
|
<h5>Verifikacijos atsakas:</h5>
|
|
<pre>{{ verificationResult }}</pre>
|
|
</template>
|
|
</template>
|
|
<div v-else class="alert alert-danger" role="alert">
|
|
<h4 class="alert-heading">Tu neprisijungęs</h4>
|
|
<p>Prašom paspausti prisijungimo mygtuką navigacijos juostoje.</p>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { authAxios } from '@/axios'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
verificationResult: null,
|
|
}
|
|
},
|
|
methods: {
|
|
serverVerify() {
|
|
this.verificationResult = null
|
|
authAxios
|
|
.get('/api/AuthMetadata/authed')
|
|
.then((response) => {
|
|
this.verificationResult = response.data
|
|
})
|
|
.catch(function (error) {
|
|
alert(error)
|
|
})
|
|
},
|
|
serverAdminVerify() {
|
|
this.verificationResult = null
|
|
authAxios
|
|
.get('/api/AuthMetadata/Admin')
|
|
.then((response) => {
|
|
this.verificationResult = response.data
|
|
})
|
|
.catch(function (error) {
|
|
alert(error)
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|