update auth
This commit is contained in:
parent
abeb6ca085
commit
3c36acbba1
10 changed files with 223 additions and 161 deletions
48
src/main.ts
48
src/main.ts
|
|
@ -3,7 +3,6 @@ import App from "./App.vue";
|
|||
import router from "./router";
|
||||
import { Dialog, Notify, Quasar, Loading } from "quasar";
|
||||
import "./quasar-user-options";
|
||||
import keycloak, { getToken } from "@/plugins/keycloak";
|
||||
|
||||
import qDraggableTable from "quasar-ui-q-draggable-table";
|
||||
import "quasar-ui-q-draggable-table/dist/index.css";
|
||||
|
|
@ -89,36 +88,25 @@ app.component(
|
|||
app.config.globalProperties.$http = http;
|
||||
|
||||
// authen with keycloak client
|
||||
function getCookie(name: string) {
|
||||
const nameEQ = name + "=";
|
||||
const ca = document.cookie.split(";");
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// function getCookie(name: string) {
|
||||
// const nameEQ = name + "=";
|
||||
// const ca = document.cookie.split(";");
|
||||
// for (let i = 0; i < ca.length; i++) {
|
||||
// let c = ca[i];
|
||||
// while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
||||
// if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
const auth = await getToken();
|
||||
// const auth = await getToken();
|
||||
|
||||
if (auth.token && auth.refresh_token) {
|
||||
keycloak.init({
|
||||
checkLoginIframe: false,
|
||||
token: auth.token,
|
||||
refreshToken: auth.refresh_token,
|
||||
});
|
||||
// .then((authenticated) => {
|
||||
// console.log("authenticated", authenticated);
|
||||
// if (!authenticated) {
|
||||
// window.location.reload();
|
||||
// } else {
|
||||
// console.log("Authenticated");
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.error("Keycloak initialization failed:", err);
|
||||
// });
|
||||
}
|
||||
// if (auth.token && auth.refresh_token) {
|
||||
// keycloak.init({
|
||||
// checkLoginIframe: false,
|
||||
// token: auth.token,
|
||||
// refreshToken: auth.refresh_token,
|
||||
// });
|
||||
// }
|
||||
|
||||
app.mount("#app");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue