Controllers
This commit is contained in:
@@ -2,39 +2,34 @@
|
||||
<div class="container">
|
||||
<h1>KTU SA Problemų sprendimo sistema</h1>
|
||||
|
||||
<template v-if="$store.getters['auth/isValid']">
|
||||
<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.getters['auth/email'] }}</b>
|
||||
el. paštas yra: <b>{{ $store.state.msalAuth.email }}</b>
|
||||
</span>
|
||||
</div>
|
||||
<h2>Visi laukai gaunami iš Azure Active Directory</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Pavadinimas</th>
|
||||
<th scope="col">Reikšmė</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(value, key) in authDataTable" :key="key">
|
||||
<td>{{ key }}</td>
|
||||
<td>
|
||||
<pre>{{ value }}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>Techninė duomenų reprezentacija</h3>
|
||||
<h3>Priegos 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 apie laukų reikšmes</a
|
||||
>Dokumentacija</a
|
||||
>
|
||||
<pre>{{ $store.state.auth.tokenData }}</pre>
|
||||
<h3>Saugos raktas.</h3>
|
||||
<pre>{{ $store.state.auth.token }}</pre>
|
||||
<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
|
||||
@@ -54,46 +49,20 @@
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
const names = {
|
||||
aud: 'AppId (Audience)',
|
||||
iss: 'Išdavėjas',
|
||||
iat: 'Išdavimo momentas',
|
||||
nbf: 'Negalioja anksčiau nei',
|
||||
exp: 'Galiojimo pabaiga',
|
||||
email: 'El. paštas',
|
||||
nonce: 'Aplikacijos sugeneruota nepasikartojanti reikšmė',
|
||||
sub: 'Subjektas (Vartotojo Id)',
|
||||
tid: 'Tenanto Identifikatorius',
|
||||
ver: 'OAuth versija',
|
||||
}
|
||||
|
||||
function lookupName(key) {
|
||||
if (names[key]) return names[key]
|
||||
return key
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
verificationResult: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
authDataTable() {
|
||||
return Object.fromEntries(
|
||||
Object.entries(this.$store.state.auth.tokenData).map(([key, value]) => [
|
||||
lookupName(key),
|
||||
value,
|
||||
])
|
||||
)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
serverVerify() {
|
||||
this.verificationResult = null
|
||||
axios
|
||||
.get('/api/AuthMetadata/authed', {
|
||||
headers: { Authorization: `Bearer ${this.$store.state.auth.token}` },
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$store.state.msalAuth.idToken}`,
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
this.verificationResult = response.data
|
||||
|
Reference in New Issue
Block a user