Legal info

This commit is contained in:
Nadegamra
2021-09-09 22:08:17 +03:00
parent b447434a47
commit 99a978dede
10 changed files with 234 additions and 1209 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,7 @@
},
"dependencies": {
"axios": "^0.20.0-0",
"balm-ui": "^8.44.0",
"bootstrap": "^4.5.3",
"bootstrap": "^5.1.1",
"cookies-js": "^1.2.3",
"core-js": "^3.7.0",
"jwt-decode": "^3.1.2",
@@ -26,7 +25,9 @@
"@vue/compiler-sfc": "^3.0.2",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.1.0"
"eslint-plugin-vue": "^7.1.0",
"sass": "^1.33.0",
"sass-loader": "^10.2.0"
},
"eslintConfig": {
"root": true,

View File

@@ -18,12 +18,4 @@ export default {
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1,2 @@
@import "custom";
@import "~bootstrap/scss/bootstrap";

View File

@@ -1,8 +1,8 @@
import "bootstrap/dist/css/bootstrap.css";
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/main.scss";
const app = createApp(App);

View File

@@ -1,12 +1,97 @@
<template>
<h1>Hello there</h1>
<!-- {{ $store.state.auth.tokenData }} -->
{{ $store.getters["auth/isValid"] }}
<br />
Your name is: {{ $store.getters["auth/name"] }}<br />
Your email is: {{ $store.getters["auth/email"] }}<br />
<div class="container">
<h1>KTU SA Problemų sprendimo sistema</h1>
<template v-if="$store.getters['auth/isValid']">
<div class="alert alert-success">
<h4 class="alert-heading">Tu esi prisijungęs</h4>
<p>Kliento aplikacija turi tavo saugos raktą. aplikacija žino, kad tavo el. paštas yra: <b>{{ $store.getters["auth/email"] }}</b></p>
</div>
<h2>Visi laukai gaunami 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>{{ value }}</td>
</tr>
</tbody>
</table>
<h3>Techninė duomenų reprezentacija</h3>
<a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens">Dokumentacija apie laukų reikšmes</a>
<pre>{{ $store.state.auth.tokenData }}</pre>
<h3>Saugos raktas.</h3>
<pre>{{ $store.state.auth.token }}</pre>
<h3>Serverio tokeno patikrinimas</h3>
<button type="button" class="btn btn-primary" @click="serverVerify">Patikrinti</button>
<h5>Verifikacijos atsakas:</h5>
<pre>
{{ verificationResult }}
</pre>
</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>
export default {};
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("/test/authed", {
headers: { Authorization: `Bearer ${this.$store.state.auth.token}` },
})
.then((response) => {
this.verificationResult = response.data;
})
.catch(function (error) {
alert(error);
});
}
}
};
</script>

View File

@@ -25,14 +25,14 @@ const getters = {
if (now > exp) return false;
return true;
},
name(state, getters) {
if (!getters.isValid) return null;
return state.tokenData.name;
},
email(state, getters) {
if (!getters.isValid) return null;
return state.tokenData.email;
},
userId(state, getters) {
if (!getters.isValid) return null;
return state.tokenData.email;
},
};
// actions

View File

@@ -19,5 +19,8 @@ namespace KTUSA_PS.Controllers
{
return this.HttpContext.User.Claims.Select(x => new { Name = x.Type, Value= x.Value }).ToArray();
}
[HttpGet("authed")]
public bool IsAuthed() => true;
}
}

View File

@@ -22,6 +22,10 @@
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<ItemGroup>
<None Remove="ClientApp\src\assets\NewFile.txt" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">