This commit is contained in:
andrea.terzani
2025-04-17 16:10:18 +02:00
7 changed files with 432 additions and 46 deletions

200
package-lock.json generated
View File

@@ -8,6 +8,7 @@
"name": "Hermione",
"version": "4.0.0",
"dependencies": {
"@azure/msal-browser": "^4.9.1",
"@dagrejs/dagre": "^1.1.4",
"@heroicons/vue": "^2.1.5",
"@primevue/themes": "^4.0.0",
@@ -22,8 +23,11 @@
"Hermione": "file:",
"highlight.js": "^11.10.0",
"json-editor-vue": "^0.15.1",
"jszip": "^3.10.1",
"marked": "^15.0.6",
"md-editor-v3": "^4.18.0",
"moment": "^2.30.1",
"oidc-client": "^1.11.5",
"pinia": "^2.2.4",
"primeicons": "^6.0.1",
"primevue": "^4.0.0",
@@ -88,6 +92,27 @@
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@azure/msal-browser": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.9.1.tgz",
"integrity": "sha512-GTKj/2xvgD918xULWRwoJ3kiCCZNzeopxa/nDfMC4o6KzrnuWbT3K1AtIFUxok9yC6VrUOgIZXMygky06xDA1g==",
"license": "MIT",
"dependencies": {
"@azure/msal-common": "15.4.0"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/@azure/msal-common": {
"version": "15.4.0",
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.4.0.tgz",
"integrity": "sha512-reeIUDXt6Xc+FpCBDEbUFQWvJ6SjE0JwsGYIfa3ZCR6Tpzjc9J1v+/InQgfCeJzfTRd7PDJVxI6TSzOmOd7+Ag==",
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/@babel/parser": {
"version": "7.24.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.8.tgz",
@@ -2130,6 +2155,26 @@
"node": ">= 0.6.0"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/binary-extensions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
@@ -2471,12 +2516,17 @@
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.0.tgz",
"integrity": "sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug==",
"hasInstallScript": true,
"optional": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"license": "MIT"
},
"node_modules/crelt": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
@@ -2496,6 +2546,12 @@
"node": ">= 8"
}
},
"node_modules/crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
"license": "MIT"
},
"node_modules/css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
@@ -3537,6 +3593,12 @@
"node": ">= 4"
}
},
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
"license": "MIT"
},
"node_modules/immutable": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz",
@@ -3586,8 +3648,7 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/is-arguments": {
"version": "1.1.1",
@@ -3712,6 +3773,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"license": "MIT"
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -3854,6 +3921,18 @@
"html2canvas": "^1.0.0-rc.5"
}
},
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"license": "(MIT OR GPL-3.0-or-later)",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"node_modules/katex": {
"version": "0.16.11",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.16.11.tgz",
@@ -3907,6 +3986,15 @@
"node": ">= 0.8.0"
}
},
"node_modules/lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"license": "MIT",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/lilconfig": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz",
@@ -4033,6 +4121,18 @@
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/marked": {
"version": "15.0.7",
"resolved": "https://registry.npmjs.org/marked/-/marked-15.0.7.tgz",
"integrity": "sha512-dgLIeKGLx5FwziAnsk4ONoGwHwGPJzselimvlVskE9XLN4Orv9u2VA3GWw/lYUqjfA0rUT/6fqKwfZJapP9BEg==",
"license": "MIT",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/md-editor-v3": {
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/md-editor-v3/-/md-editor-v3-4.18.0.tgz",
@@ -4851,6 +4951,31 @@
"node": ">= 0.4"
}
},
"node_modules/oidc-client": {
"version": "1.11.5",
"resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.11.5.tgz",
"integrity": "sha512-LcKrKC8Av0m/KD/4EFmo9Sg8fSQ+WFJWBrmtWd+tZkNn3WT/sQG3REmPANE9tzzhbjW6VkTNy4xhAXCfPApAOg==",
"license": "Apache-2.0",
"dependencies": {
"acorn": "^7.4.1",
"base64-js": "^1.5.1",
"core-js": "^3.8.3",
"crypto-js": "^4.0.0",
"serialize-javascript": "^4.0.0"
}
},
"node_modules/oidc-client/node_modules/acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -4913,6 +5038,12 @@
"integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==",
"dev": true
},
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
"license": "(MIT AND Zlib)"
},
"node_modules/parchment": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/parchment/-/parchment-1.1.4.tgz",
@@ -5313,6 +5444,12 @@
"node": ">=12.11.0"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"license": "MIT"
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@@ -5394,6 +5531,15 @@
"performance-now": "^2.1.0"
}
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "^5.1.0"
}
},
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -5403,6 +5549,21 @@
"pify": "^2.3.0"
}
},
"node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"license": "MIT",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@@ -5574,6 +5735,12 @@
"node": ">=6"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/sass": {
"version": "1.77.8",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.8.tgz",
@@ -5602,6 +5769,15 @@
"node": ">=10"
}
},
"node_modules/serialize-javascript": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
"license": "BSD-3-Clause",
"dependencies": {
"randombytes": "^2.1.0"
}
},
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@@ -5632,6 +5808,12 @@
"node": ">= 0.4"
}
},
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"license": "MIT"
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -5705,6 +5887,15 @@
"node": ">=0.1.14"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
@@ -6221,8 +6412,7 @@
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/utrie": {
"version": "1.0.2",

View File

@@ -8,6 +8,7 @@
"lint": "eslint --fix . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"@azure/msal-browser": "^4.9.1",
"@dagrejs/dagre": "^1.1.4",
"@heroicons/vue": "^2.1.5",
"@primevue/themes": "^4.0.0",
@@ -26,6 +27,7 @@
"marked": "^15.0.6",
"md-editor-v3": "^4.18.0",
"moment": "^2.30.1",
"oidc-client": "^1.11.5",
"pinia": "^2.2.4",
"primeicons": "^6.0.1",
"primevue": "^4.0.0",

View File

@@ -12,9 +12,6 @@ const router = createRouter({
auth: true
},
children: [
{
path: 'scenario',
children: [
{
path: '/projects',
name: 'projects-list',
@@ -63,13 +60,22 @@ const router = createRouter({
component: () => import('@/views/pages/chat/ChatPage.vue')
}
]
}
]
},
{
path: '/auth/login',
name: 'login',
meta: {
auth: false
},
component: () => import('@/views/pages/auth/Login.vue')
},
{
path: '/auth/callback',
name: 'test',
meta: {
auth: false
},
component: () => import('@/views/pages/auth/Callback.vue')
}
]
});

View File

@@ -0,0 +1,65 @@
<script setup>
import { useAuth } from '@websanova/vue-auth/src/v3.js';
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { msalInstance } from './MsalConfig'; // wherever you created your MSAL instance
const router = useRouter()
const auth = useAuth();
const message = ref('')
onMounted(async () => {
console.log("Mounted on callback")
await msalInstance.initialize()
console.log("After initialize on callback")
const response = await msalInstance.handleRedirectPromise()
console.log("Response:",response)
if (response) {
message.value ="Logging in to the application..."
localStorage.setItem('msalUser', JSON.stringify(response.account))
axios.post("/msauth/exchange",{}, {
headers: { Authorization: `Bearer ${response.accessToken}` }
}).then(res=>{
if(res.data.token){
auth.token(null,res.data.token,false);
auth.fetch().then(response=>{
console.log("1 user :" , response.data.data);
if (!response.data.data.selectedProject) {
router.push({ name: 'projects-list' });
} else {
router.push({ name: 'scenario-list' });
}
}).catch(res=>{
console.log("Error on token exchange:",res)
message.value = "Error authenticating on the application. Did you ask for authorization?"
visible.value = true;
});
}else{
message.value = "Error authenticating on the application. Did you ask for authorization?"
console.error("No token exchange with backend")
}
}).catch(res=>{
message.value = "Error authenticating on the application. Did you ask for authorization?"
});
}
})
</script>
<template>
<div>{{message}}</div>
</template>

View File

@@ -1,25 +1,95 @@
<script setup>
import { useLayout } from '@/layout/composables/layout';
import { useAuth } from '@websanova/vue-auth/src/v3.js';
import axios from 'axios';
import Message from 'primevue/message';
import { computed, ref } from 'vue';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { msalInstance, msalrequest } from './MsalConfig';
const auth = useAuth();
const { isDarkTheme } = useLayout();
const username = ref('');
const password = ref('');
const error = ref('');
const visible = ref(false);
const router = useRouter();
const msaccount = ref(null);
onMounted(async () => {
await msalInstance.initialize()
const accounts = msalInstance.getAllAccounts()
const logoUrl = computed(() => {
return `/layout/images/${isDarkTheme ? 'logo-white' : 'logo-dark'}.svg`;
});
console.log("Accounts:",accounts)
if (accounts.length > 0) {
console.log(accounts)
msaccount.value= accounts[0]
const login = async () => {
}
})
const loginAD = async () => {
var token = await msalInstance.acquireTokenSilent({
scopes: msalrequest.scopes,
account: msaccount.value
})
console.log("Token " ,token)
axios.post("/msauth/exchange",{}, {
headers: { Authorization: `Bearer ${token.accessToken}` }
}).then(res=>{
console.log("Token exhange done :",res.data.token)
if(res.data.token){
auth.token(null, res.data.token,false)
auth.fetch().then(response=>{
console.log("1 user :" , response.data.data);
if (!response.data.data.selectedProject) {
router.push({ name: 'projects-list' });
} else {
router.push({ name: 'scenario-list' });
}
}).catch(res=>{
console.log("Error on token exchange:",res)
error.value = "Error authenticating on the application. Did you ask for authorization?"
visible.value = true;
});
}else{
error.value = "Error authenticating on the application. Did you ask for authorization?"
visible.value = true;
console.error("No token exchange with backend")
}
}).catch(res=>{
console.log("Error on token exchange:",res)
error.value = "Error authenticating on the application. Did you ask for authorization?"
visible.value = true;
});
}
const loginMsal = async () => {
await msalInstance.initialize()
msalInstance.loginRedirect(msalrequest)
}
const logoutAD = async () => {
const logoutRequest = {
account: msaccount.value,
mainWindowRedirectUri:window.location.href,
};
await msalInstance.logoutPopup(logoutRequest);
}
const login_old = async () => {
try {
await auth.login({
data:{
@@ -51,14 +121,15 @@ const login = async () => {
}
}
</script>
</script>
<template>
<div class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-[100vw] overflow-hidden">
<div class="flex flex-col items-center justify-center">
<div style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)">
<div
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)">
<div class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20" style="border-radius: 53px">
<div class="logo-container">
<div class="logo-container mb-8">
<svg width="85" height="63" viewBox="0 0 85 63" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
@@ -76,36 +147,56 @@ const login = async () => {
/>
</svg>
</div>
<div class="text-center mb-8">
<h1>Welcome to</h1>
<h1>WizardAI - WORKFLOW</h1>
<div class="text-center mb-12">
<h1 class="text-3xl font-semibold">Welcome to</h1>
<h1 class="text-4xl font-bold text-primary">WizardAI - WORKFLOW</h1>
</div>
<div>
<label for="email1" class="block text-surface-900 dark:text-surface-0 text-xl font-medium mb-2">Username</label>
<InputText id="email1" type="text" placeholder="Username" class="w-full md:w-[30rem] mb-8" style="padding: 1rem" v-model="username" />
<!-- Username & Password Section -->
<div class="mb-10 w-full max-w-xl">
<label for="email1" class="block text-surface-900 dark:text-surface-0 text-l font-medium mb-2">Username</label>
<InputText id="email1" type="text" placeholder="Username" class="w-full mb-6" style="padding: 1rem"
v-model="username" />
<label for="password1" class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2">Password</label>
<Password id="password1" v-model="password" placeholder="Password" :toggleMask="true" class="w-full mb-4" inputClass="w-full" :inputStyle="{ padding: '1rem' }"></Password>
<!--
<div class="flex items-center justify-between mb-8 gap-8">
<div class="flex items-center">
<Checkbox v-model="checked" id="rememberme1" binary class="mr-2"></Checkbox>
<label for="rememberme1">Remember me</label>
</div>
<a class="font-medium no-underline ml-2 text-right cursor-pointer" style="color: var(--primary-color)">Forgot password?</a>
</div>
-->
<Button @click="login" label="Sign In" class="w-full p-4 text-xl"></Button>
<label for="password1"
class="block text-surface-900 dark:text-surface-0 font-medium text-l mb-2">Password</label>
<Password id="password1" v-model="password" placeholder="Password" :toggleMask="true"
class="w-full mb-6" inputClass="w-full" :inputStyle="{ padding: '1rem' }" />
<Message v-if="visible" severity="error" :life="3000" class="mt-2 error-message">{{ error }}</Message>
<Button @click="login_old" label="Sign In with Username and Password"
class="w-full text-xl mb-4" />
</div>
<!-- Divider -->
<div class="my-6 w-full max-w-xl flex items-center justify-center">
<hr class="flex-grow border-t border-gray-300 dark:border-gray-700" />
<span class="mx-4 text-gray-500 dark:text-gray-400">Sign in with Microsoft Azure AD</span>
<hr class="flex-grow border-t border-gray-300 dark:border-gray-700" />
</div>
<!-- Azure AD Section -->
<div class="w-full max-w-xl">
<Button @click="loginMsal" v-if="msaccount == null" label="Sign In with Microsoft AD"
class="w-full text-l mb-4" />
<Button @click="loginAD" v-if="msaccount" :label="'Login ' + msaccount.username"
class="w-full text-l mb-4" />
<Button @click="logoutAD" v-if="msaccount" label="Logout AD" severity="warn"
class="w-full text-l mb-4" />
</div>
<!-- Error Message -->
<Message v-if="visible" severity="error" :life="5000" class="mt-4 error-message">{{ error }}</Message>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.pi-eye {
transform: scale(1.6);

View File

@@ -0,0 +1,32 @@
import { PublicClientApplication } from '@azure/msal-browser';
export const msalInstance = new PublicClientApplication({
auth: {
clientId: '1ddbd871-9544-4a31-97a4-2968ce08e49a', //'d3fee0e3-49e0-4910-b0b4-805bfbd5488a',
authority: 'https://login.microsoftonline.com/e0793d39-0939-496d-b129-198edd916feb/', //'https://login.microsoftonline.com/9dc4721e-4d54-4c40-a681-1dd740292901/', //
redirectUri: 'http://localhost:5173/auth/callback', // or your deployed URL
navigateToLoginRequestUrl: false
},
cache: {
cacheLocation: 'localStorage',
storeAuthStateInCookie: false
}
});
/*
export const msalInstance = new PublicClientApplication({
auth: {
clientId: 'd3fee0e3-49e0-4910-b0b4-805bfbd5488a',
authority: "https://login.microsoftonline.com/9dc4721e-4d54-4c40-a681-1dd740292901",
redirectUri: "http://localhost:5173/auth/callback", // or your deployed URL
navigateToLoginRequestUrl: false,
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: false,
}
})
*/
export const msalrequest = {
scopes: ['1ddbd871-9544-4a31-97a4-2968ce08e49a/.default'] //['api://d3fee0e3-49e0-4910-b0b4-805bfbd5488a/access_as_user']
};