una-nuxt-module 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +6 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +105 -0
- package/dist/runtime/assets/scss/styles.css +1249 -0
- package/dist/runtime/classes/FetchClient.d.ts +61 -0
- package/dist/runtime/classes/FetchClient.js +71 -0
- package/dist/runtime/components/layout/footer/Footer.vue +16 -0
- package/dist/runtime/components/layout/header/BtnExtendMenu.vue +29 -0
- package/dist/runtime/components/layout/header/Header.vue +7 -0
- package/dist/runtime/components/layout/header/HeaderMenu.vue +41 -0
- package/dist/runtime/components/layout/header/HeaderMenuTabs.vue +102 -0
- package/dist/runtime/components/layout/sidebar/NavCollapse.vue +38 -0
- package/dist/runtime/components/layout/sidebar/NavGroup.vue +9 -0
- package/dist/runtime/components/layout/sidebar/NavItem.vue +25 -0
- package/dist/runtime/components/layout/sidebar/SideBar.vue +74 -0
- package/dist/runtime/components/layout/sidebar/SideBarFooter.vue +69 -0
- package/dist/runtime/components/layout/sidebar/TopSideBarLogo.vue +25 -0
- package/dist/runtime/components/shared/authorization/AuthorizedRenderer.vue +41 -0
- package/dist/runtime/components/shared/buttons/BtnBack.vue +19 -0
- package/dist/runtime/components/shared/buttons/BtnCancel.vue +13 -0
- package/dist/runtime/components/shared/buttons/BtnConfirm.vue +14 -0
- package/dist/runtime/components/shared/containers/JsonViewer.vue +13 -0
- package/dist/runtime/components/shared/dates/DatePicker.vue +91 -0
- package/dist/runtime/components/shared/dialogs/DialogConfirmDelete.vue +32 -0
- package/dist/runtime/components/shared/dialogs/DialogExportTable.vue +42 -0
- package/dist/runtime/components/shared/feedback/LoadingSession.vue +17 -0
- package/dist/runtime/components/shared/feedback/SnackBar.vue +36 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FieldBuilder.vue +251 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FieldSlotMissed.vue +20 -0
- package/dist/runtime/components/shared/forms/FormBuilder/FormBuilder.vue +213 -0
- package/dist/runtime/components/shared/forms/FormBuilder/SteppersBuilder.vue +32 -0
- package/dist/runtime/components/shared/forms/FormBuilder/TabsBuilder.vue +30 -0
- package/dist/runtime/components/shared/forms/FormDialogWrapper.vue +48 -0
- package/dist/runtime/components/shared/forms/FormPageWrapper.vue +19 -0
- package/dist/runtime/components/shared/forms/FormSubmitSection.vue +48 -0
- package/dist/runtime/components/shared/navigation/BreadCrumbs.vue +21 -0
- package/dist/runtime/components/shared/tables/CustomTable.vue +261 -0
- package/dist/runtime/components/shared/tables/CustomTableHeader.vue +25 -0
- package/dist/runtime/components/shared/tables/NoDataMessage.vue +12 -0
- package/dist/runtime/components/shared/tables/TableSearchBar.vue +22 -0
- package/dist/runtime/components/shared/tables/buttons/BtnAdd.vue +25 -0
- package/dist/runtime/components/shared/tables/buttons/BtnDelete.vue +32 -0
- package/dist/runtime/components/shared/tables/buttons/BtnEdit.vue +30 -0
- package/dist/runtime/components/shared/tables/buttons/BtnExport.vue +17 -0
- package/dist/runtime/components/shared/tables/buttons/BtnFilter.vue +21 -0
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageCombo.vue +24 -0
- package/dist/runtime/components/shared/tables/pagination/ItemsPerPageLabel.vue +5 -0
- package/dist/runtime/components/shared/tables/pagination/PageSelector.vue +16 -0
- package/dist/runtime/components/shared/tables/pagination/PaginationInfo.vue +31 -0
- package/dist/runtime/composables/useAuthorization.d.ts +32 -0
- package/dist/runtime/composables/useAuthorization.js +95 -0
- package/dist/runtime/constants/form.d.ts +44 -0
- package/dist/runtime/constants/form.js +58 -0
- package/dist/runtime/constants/index.d.ts +4 -0
- package/dist/runtime/constants/index.js +4 -0
- package/dist/runtime/constants/pagination.d.ts +13 -0
- package/dist/runtime/constants/pagination.js +8 -0
- package/dist/runtime/constants/request.d.ts +5 -0
- package/dist/runtime/constants/request.js +6 -0
- package/dist/runtime/constants/tables.d.ts +4 -0
- package/dist/runtime/constants/tables.js +15 -0
- package/dist/runtime/enums/EAsyncDataRequestStatus.d.ts +9 -0
- package/dist/runtime/enums/EAsyncDataRequestStatus.js +7 -0
- package/dist/runtime/enums/EAuthorization.d.ts +8 -0
- package/dist/runtime/enums/EAuthorization.js +6 -0
- package/dist/runtime/enums/EFormField.d.ts +14 -0
- package/dist/runtime/enums/EFormField.js +12 -0
- package/dist/runtime/enums/EFormMode.d.ts +7 -0
- package/dist/runtime/enums/EFormMode.js +5 -0
- package/dist/runtime/enums/ERequestMethod.d.ts +9 -0
- package/dist/runtime/enums/ERequestMethod.js +7 -0
- package/dist/runtime/enums/ETheme.d.ts +7 -0
- package/dist/runtime/enums/ETheme.js +5 -0
- package/dist/runtime/enums/EVuetifyDateFormats.d.ts +32 -0
- package/dist/runtime/enums/EVuetifyDateFormats.js +30 -0
- package/dist/runtime/enums/index.d.ts +6 -0
- package/dist/runtime/enums/index.js +6 -0
- package/dist/runtime/i18n/config.d.ts +61 -0
- package/dist/runtime/i18n/config.js +10 -0
- package/dist/runtime/i18n/locales/es.json +55 -0
- package/dist/runtime/i18n/service.d.ts +72 -0
- package/dist/runtime/i18n/service.js +3 -0
- package/dist/runtime/i18n/vueI18n.d.ts +5 -0
- package/dist/runtime/i18n/vueI18n.js +3 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/layouts/default.vue +31 -0
- package/dist/runtime/layouts/empty.vue +12 -0
- package/dist/runtime/middleware/authentication.d.ts +10 -0
- package/dist/runtime/middleware/authentication.js +30 -0
- package/dist/runtime/middleware/authorization.d.ts +7 -0
- package/dist/runtime/middleware/authorization.js +39 -0
- package/dist/runtime/pages/401.vue +34 -0
- package/dist/runtime/pages/403.vue +35 -0
- package/dist/runtime/pages/ssoCallback.vue +14 -0
- package/dist/runtime/plugins/auth.d.ts +12 -0
- package/dist/runtime/plugins/auth.js +83 -0
- package/dist/runtime/plugins/vue-json.d.ts +12 -0
- package/dist/runtime/plugins/vue-json.js +5 -0
- package/dist/runtime/public/images/logos/UNA_LogoMark_Black.png +0 -0
- package/dist/runtime/public/images/logos/UNA_LogoType_LogoMark_Red.png +0 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/stores/UiCustomizer.d.ts +22 -0
- package/dist/runtime/stores/UiCustomizer.js +34 -0
- package/dist/runtime/stores/appStatus.d.ts +63 -0
- package/dist/runtime/stores/appStatus.js +101 -0
- package/dist/runtime/stores/auth.d.ts +76 -0
- package/dist/runtime/stores/auth.js +66 -0
- package/dist/runtime/stores/formModeTracker.d.ts +14 -0
- package/dist/runtime/stores/formModeTracker.js +10 -0
- package/dist/runtime/types/index.d.ts +584 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/utils/buildSortQueryParams.d.ts +10 -0
- package/dist/runtime/utils/buildSortQueryParams.js +3 -0
- package/dist/runtime/utils/getCurrentPath.d.ts +7 -0
- package/dist/runtime/utils/getCurrentPath.js +4 -0
- package/dist/runtime/utils/getDateTimeInISO8601.d.ts +11 -0
- package/dist/runtime/utils/getDateTimeInISO8601.js +3 -0
- package/dist/runtime/utils/getFromLocalStorage.d.ts +9 -0
- package/dist/runtime/utils/getFromLocalStorage.js +6 -0
- package/dist/runtime/utils/isNumberInRange.d.ts +11 -0
- package/dist/runtime/utils/isNumberInRange.js +5 -0
- package/dist/runtime/utils/onlyNumbers.d.ts +9 -0
- package/dist/runtime/utils/onlyNumbers.js +3 -0
- package/dist/runtime/utils/stringToBoolean.d.ts +9 -0
- package/dist/runtime/utils/stringToBoolean.js +3 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/package.json +69 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum que contiene los tipos de formato de fechas para componentes Vuetify.
|
|
3
|
+
*/
|
|
4
|
+
export declare const enum EVuetifyDateFormats {
|
|
5
|
+
fullDate = "fullDate",// “Jan 1, 2024”
|
|
6
|
+
fullDateWithWeekday = "fullDateWithWeekday",// “Tuesday, January 1, 2024”
|
|
7
|
+
normalDate = "normalDate",// “1 January”
|
|
8
|
+
normalDateWithWeekday = "normalDateWithWeekday",// “Wed, Jan 1”
|
|
9
|
+
shortDate = "shortDate",// “Jan 1”
|
|
10
|
+
year = "year",// “2024”
|
|
11
|
+
month = "month",// “January”
|
|
12
|
+
monthShort = "monthShort",// “Jan”
|
|
13
|
+
monthAndYear = "monthAndYear",// “January 2024”
|
|
14
|
+
monthAndDate = "monthAndDate",// “January 1”
|
|
15
|
+
weekday = "weekday",// “Wednesday”
|
|
16
|
+
weekdayShort = "weekdayShort",// “Wed”
|
|
17
|
+
dayOfMonth = "dayOfMonth",// “1”
|
|
18
|
+
hours12h = "hours12h",// “11”
|
|
19
|
+
hours24h = "hours24h",// “23”
|
|
20
|
+
minutes = "minutes",// “44”
|
|
21
|
+
seconds = "seconds",// “00”
|
|
22
|
+
fullTime = "fullTime",// “11:44 PM” for US, “23:44” for Europe
|
|
23
|
+
fullTime12h = "fullTime12h",// “11:44 PM”
|
|
24
|
+
fullTime24h = "fullTime24h",// “23:44”
|
|
25
|
+
fullDateTime = "fullDateTime",// “Jan 1, 2024 11:44 PM”
|
|
26
|
+
fullDateTime12h = "fullDateTime12h",// “Jan 1, 2024 11:44 PM”
|
|
27
|
+
fullDateTime24h = "fullDateTime24h",// “Jan 1, 2024 23:44”
|
|
28
|
+
keyboardDate = "keyboardDate",// “02/13/2024”
|
|
29
|
+
keyboardDateTime = "keyboardDateTime",// “02/13/2024 23:44”
|
|
30
|
+
keyboardDateTime12h = "keyboardDateTime12h",// “02/13/2024 11:44 PM”
|
|
31
|
+
keyboardDateTime24h = "keyboardDateTime24h"
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export var EVuetifyDateFormats = /* @__PURE__ */ ((EVuetifyDateFormats2) => {
|
|
2
|
+
EVuetifyDateFormats2["fullDate"] = "fullDate";
|
|
3
|
+
EVuetifyDateFormats2["fullDateWithWeekday"] = "fullDateWithWeekday";
|
|
4
|
+
EVuetifyDateFormats2["normalDate"] = "normalDate";
|
|
5
|
+
EVuetifyDateFormats2["normalDateWithWeekday"] = "normalDateWithWeekday";
|
|
6
|
+
EVuetifyDateFormats2["shortDate"] = "shortDate";
|
|
7
|
+
EVuetifyDateFormats2["year"] = "year";
|
|
8
|
+
EVuetifyDateFormats2["month"] = "month";
|
|
9
|
+
EVuetifyDateFormats2["monthShort"] = "monthShort";
|
|
10
|
+
EVuetifyDateFormats2["monthAndYear"] = "monthAndYear";
|
|
11
|
+
EVuetifyDateFormats2["monthAndDate"] = "monthAndDate";
|
|
12
|
+
EVuetifyDateFormats2["weekday"] = "weekday";
|
|
13
|
+
EVuetifyDateFormats2["weekdayShort"] = "weekdayShort";
|
|
14
|
+
EVuetifyDateFormats2["dayOfMonth"] = "dayOfMonth";
|
|
15
|
+
EVuetifyDateFormats2["hours12h"] = "hours12h";
|
|
16
|
+
EVuetifyDateFormats2["hours24h"] = "hours24h";
|
|
17
|
+
EVuetifyDateFormats2["minutes"] = "minutes";
|
|
18
|
+
EVuetifyDateFormats2["seconds"] = "seconds";
|
|
19
|
+
EVuetifyDateFormats2["fullTime"] = "fullTime";
|
|
20
|
+
EVuetifyDateFormats2["fullTime12h"] = "fullTime12h";
|
|
21
|
+
EVuetifyDateFormats2["fullTime24h"] = "fullTime24h";
|
|
22
|
+
EVuetifyDateFormats2["fullDateTime"] = "fullDateTime";
|
|
23
|
+
EVuetifyDateFormats2["fullDateTime12h"] = "fullDateTime12h";
|
|
24
|
+
EVuetifyDateFormats2["fullDateTime24h"] = "fullDateTime24h";
|
|
25
|
+
EVuetifyDateFormats2["keyboardDate"] = "keyboardDate";
|
|
26
|
+
EVuetifyDateFormats2["keyboardDateTime"] = "keyboardDateTime";
|
|
27
|
+
EVuetifyDateFormats2["keyboardDateTime12h"] = "keyboardDateTime12h";
|
|
28
|
+
EVuetifyDateFormats2["keyboardDateTime24h"] = "keyboardDateTime24h";
|
|
29
|
+
return EVuetifyDateFormats2;
|
|
30
|
+
})(EVuetifyDateFormats || {});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuración de la internalización.
|
|
3
|
+
*/
|
|
4
|
+
export declare const i18nConfig: {
|
|
5
|
+
legacy: boolean;
|
|
6
|
+
locale: string;
|
|
7
|
+
messages: {
|
|
8
|
+
es: {
|
|
9
|
+
Actions: {
|
|
10
|
+
New: string;
|
|
11
|
+
Back: string;
|
|
12
|
+
Edit: string;
|
|
13
|
+
Cancel: string;
|
|
14
|
+
Delete: string;
|
|
15
|
+
Export: string;
|
|
16
|
+
Confirm: string;
|
|
17
|
+
MoreFilters: string;
|
|
18
|
+
CloseSession: string;
|
|
19
|
+
};
|
|
20
|
+
Rules: {
|
|
21
|
+
RequiredField: string;
|
|
22
|
+
IsEmail: string;
|
|
23
|
+
numberInRange: string;
|
|
24
|
+
};
|
|
25
|
+
Components: {
|
|
26
|
+
SideBar: {
|
|
27
|
+
SideBarFooter: {
|
|
28
|
+
DarkTheme: string;
|
|
29
|
+
LightTheme: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
Footer: {
|
|
33
|
+
Info: string[];
|
|
34
|
+
};
|
|
35
|
+
Dialogs: {
|
|
36
|
+
Delete: {
|
|
37
|
+
Title: string;
|
|
38
|
+
};
|
|
39
|
+
Export: {
|
|
40
|
+
Title: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
Table: {
|
|
44
|
+
NoDataMessage: {
|
|
45
|
+
WhenNoMatches: string;
|
|
46
|
+
WhenNoData: string;
|
|
47
|
+
};
|
|
48
|
+
SearchBar: {
|
|
49
|
+
Label: string;
|
|
50
|
+
Title: string;
|
|
51
|
+
Placeholder: string;
|
|
52
|
+
};
|
|
53
|
+
Pagination: {
|
|
54
|
+
ItemsPerPageLabel: string;
|
|
55
|
+
PaginationInfo: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Actions": {
|
|
3
|
+
"New": "Nuevo",
|
|
4
|
+
"Back": "Volver",
|
|
5
|
+
"Edit": "Editar",
|
|
6
|
+
"Cancel": "Cancelar",
|
|
7
|
+
"Delete": "Eliminar",
|
|
8
|
+
"Export": "Exportar",
|
|
9
|
+
"Confirm": "Confirmar",
|
|
10
|
+
"MoreFilters": "Más filtros",
|
|
11
|
+
"CloseSession": "Cerrar sesión"
|
|
12
|
+
},
|
|
13
|
+
"Rules": {
|
|
14
|
+
"RequiredField": "Campo requerido",
|
|
15
|
+
"IsEmail": "El correo debe ser válido",
|
|
16
|
+
"numberInRange": "El numero {number} no esta en el rango valido [{min}, {max}]"
|
|
17
|
+
},
|
|
18
|
+
"Components": {
|
|
19
|
+
"SideBar": {
|
|
20
|
+
"SideBarFooter": {
|
|
21
|
+
"DarkTheme": "Modo oscuro",
|
|
22
|
+
"LightTheme": "Modo claro"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"Footer": {
|
|
26
|
+
"Info": [
|
|
27
|
+
"Front Framework - Beta",
|
|
28
|
+
"© 2024 Universidad Nacional - Dirección de Tecnologías de Información y Comunicación"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"Dialogs": {
|
|
32
|
+
"Delete": {
|
|
33
|
+
"Title": "¿Seguro que desea eliminar el registro?"
|
|
34
|
+
},
|
|
35
|
+
"Export": {
|
|
36
|
+
"Title": "Exportar datos de la tabla"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"Table": {
|
|
40
|
+
"NoDataMessage": {
|
|
41
|
+
"WhenNoMatches": "No hay datos que coincidan con el criterio de búsqueda...",
|
|
42
|
+
"WhenNoData": "No hay datos..."
|
|
43
|
+
},
|
|
44
|
+
"SearchBar": {
|
|
45
|
+
"Label": "Buscar",
|
|
46
|
+
"Title": "Buscar en la tabla",
|
|
47
|
+
"Placeholder": "Ingrese su búsqueda..."
|
|
48
|
+
},
|
|
49
|
+
"Pagination": {
|
|
50
|
+
"ItemsPerPageLabel": "Elementos por página:",
|
|
51
|
+
"PaginationInfo": "Página {page} de {totalPages} ({totalElements})"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Este servicio permite usar internalización en archivos javascript y typescript.
|
|
3
|
+
*
|
|
4
|
+
* @method i18nService.global.t(key, params)
|
|
5
|
+
*
|
|
6
|
+
* @param [string] key - Mensaje a resolver
|
|
7
|
+
* @param [Object] params - Parámetros del mensaje - *null*
|
|
8
|
+
*
|
|
9
|
+
* @return *string* Mensaje internalizado en base al idioma actual
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
import { i18nService } from "~/i18n/service";
|
|
14
|
+
|
|
15
|
+
const key = "actions.helloWorld"
|
|
16
|
+
const message = i18nService.global.t(key, params)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const i18nService: import("vue-i18n").I18n<{
|
|
20
|
+
es: {
|
|
21
|
+
Actions: {
|
|
22
|
+
New: string;
|
|
23
|
+
Back: string;
|
|
24
|
+
Edit: string;
|
|
25
|
+
Cancel: string;
|
|
26
|
+
Delete: string;
|
|
27
|
+
Export: string;
|
|
28
|
+
Confirm: string;
|
|
29
|
+
MoreFilters: string;
|
|
30
|
+
CloseSession: string;
|
|
31
|
+
};
|
|
32
|
+
Rules: {
|
|
33
|
+
RequiredField: string;
|
|
34
|
+
IsEmail: string;
|
|
35
|
+
numberInRange: string;
|
|
36
|
+
};
|
|
37
|
+
Components: {
|
|
38
|
+
SideBar: {
|
|
39
|
+
SideBarFooter: {
|
|
40
|
+
DarkTheme: string;
|
|
41
|
+
LightTheme: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
Footer: {
|
|
45
|
+
Info: string[];
|
|
46
|
+
};
|
|
47
|
+
Dialogs: {
|
|
48
|
+
Delete: {
|
|
49
|
+
Title: string;
|
|
50
|
+
};
|
|
51
|
+
Export: {
|
|
52
|
+
Title: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
Table: {
|
|
56
|
+
NoDataMessage: {
|
|
57
|
+
WhenNoMatches: string;
|
|
58
|
+
WhenNoData: string;
|
|
59
|
+
};
|
|
60
|
+
SearchBar: {
|
|
61
|
+
Label: string;
|
|
62
|
+
Title: string;
|
|
63
|
+
Placeholder: string;
|
|
64
|
+
};
|
|
65
|
+
Pagination: {
|
|
66
|
+
ItemsPerPageLabel: string;
|
|
67
|
+
PaginationInfo: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {}, {}, string, true>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-app>
|
|
3
|
+
<v-layout>
|
|
4
|
+
<template v-if="authStore.isAuthenticated">
|
|
5
|
+
<SideBar />
|
|
6
|
+
<Header />
|
|
7
|
+
<SnackBar />
|
|
8
|
+
<v-main class="page-wrapper">
|
|
9
|
+
<v-container>
|
|
10
|
+
<!-- Pagina a renderizar -->
|
|
11
|
+
<NuxtPage />
|
|
12
|
+
</v-container>
|
|
13
|
+
<Footer />
|
|
14
|
+
</v-main>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else>
|
|
17
|
+
<v-main class="page-wrapper">
|
|
18
|
+
<v-container>
|
|
19
|
+
<LoadingSession />
|
|
20
|
+
</v-container>
|
|
21
|
+
</v-main>
|
|
22
|
+
</template>
|
|
23
|
+
</v-layout>
|
|
24
|
+
</v-app>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { useAuthStore } from "#imports";
|
|
29
|
+
|
|
30
|
+
const authStore = useAuthStore();
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware encargado de sincronizar los datos de la sesión del usuario.
|
|
3
|
+
*
|
|
4
|
+
* En el flujo de inicio de sesión mediante SSO, en el cuál el usuario ingresa y hay una sesión activa en las cookies,
|
|
5
|
+
* este middleware sincroniza esos datos en el store de pinia.
|
|
6
|
+
*
|
|
7
|
+
* Nota: solo se ejecuta una vez, debido a que posteriormente los datos de la sesión estaran sincronizados en Pinia.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: any;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineNuxtRouteMiddleware, useNuxtApp } from "#app";
|
|
2
|
+
import { useAuthStore, useAuthorization } from "#imports";
|
|
3
|
+
export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
4
|
+
const authorization = useAuthorization();
|
|
5
|
+
const authStore = useAuthStore();
|
|
6
|
+
if (import.meta.client && !authStore.isAuthenticated) {
|
|
7
|
+
const { $authData, $isAuthenticated, $accessToken } = useNuxtApp();
|
|
8
|
+
const isAuthenticated = await $isAuthenticated();
|
|
9
|
+
if (!isAuthenticated) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const authResponse = await $authData();
|
|
13
|
+
const token = await $accessToken();
|
|
14
|
+
const resources = await authorization.getResources(token);
|
|
15
|
+
const userInfo = {
|
|
16
|
+
email: authResponse?.email,
|
|
17
|
+
fullName: authResponse?.displayName,
|
|
18
|
+
name: authResponse?.givenName,
|
|
19
|
+
lastName: authResponse?.familyName,
|
|
20
|
+
photoUrl: authResponse?.profile,
|
|
21
|
+
mainRole: "Admin"
|
|
22
|
+
};
|
|
23
|
+
const authData = {
|
|
24
|
+
isAuthenticated,
|
|
25
|
+
accessToken: token,
|
|
26
|
+
resources
|
|
27
|
+
};
|
|
28
|
+
authStore.update(userInfo, authData);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
|
2
|
+
import {
|
|
3
|
+
useAuthStore,
|
|
4
|
+
useAuthorization,
|
|
5
|
+
useFormModeTrackerStore
|
|
6
|
+
} from "#imports";
|
|
7
|
+
const isUserGoingToForm = (path) => {
|
|
8
|
+
const parts = path.split("/");
|
|
9
|
+
return parts.length === 4 ? parts[parts.length - 1] === "form" : false;
|
|
10
|
+
};
|
|
11
|
+
const getPathWhitoutFormPart = (path) => {
|
|
12
|
+
let parts = path.split("/");
|
|
13
|
+
parts.pop();
|
|
14
|
+
return parts?.join("/");
|
|
15
|
+
};
|
|
16
|
+
export default defineNuxtRouteMiddleware((to, from) => {
|
|
17
|
+
const authStore = useAuthStore();
|
|
18
|
+
const authorization = useAuthorization();
|
|
19
|
+
const resource = to.matched[0]?.path ?? to.path;
|
|
20
|
+
if (authorization.isPageUnprotected(resource)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!import.meta.client || !authStore.isAuthenticated) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (isUserGoingToForm(resource)) {
|
|
27
|
+
const params = {
|
|
28
|
+
resource: getPathWhitoutFormPart(resource),
|
|
29
|
+
authorization: useFormModeTrackerStore().formMode
|
|
30
|
+
};
|
|
31
|
+
if (!authorization.hasAuthorizationIn(params)) {
|
|
32
|
+
return navigateTo("/403");
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!authorization.hasAccessTo(resource)) {
|
|
37
|
+
return navigateTo("/403");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-sheet
|
|
3
|
+
class="d-flex align-center justify-center flex-wrap text-center mx-auto px-4"
|
|
4
|
+
elevation="4"
|
|
5
|
+
height="250"
|
|
6
|
+
max-width="800"
|
|
7
|
+
width="100%"
|
|
8
|
+
rounded
|
|
9
|
+
>
|
|
10
|
+
<div>
|
|
11
|
+
<h2 class="text-h4 font-weight-black text-primary">401 Unauthorized</h2>
|
|
12
|
+
|
|
13
|
+
<div class="text-h6 font-weight-medium mt-2 mb-6">
|
|
14
|
+
Debe inicar sesión para acceder
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<v-btn
|
|
18
|
+
color="primary"
|
|
19
|
+
elevation="0"
|
|
20
|
+
@click="navigateTo('/')"
|
|
21
|
+
variant="text"
|
|
22
|
+
text="Volver a la página de inicio"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</v-sheet>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { definePageMeta, navigateTo } from "#imports";
|
|
30
|
+
|
|
31
|
+
definePageMeta({
|
|
32
|
+
layout: "empty",
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-sheet
|
|
3
|
+
class="d-flex align-center justify-center flex-wrap text-center mx-auto px-4"
|
|
4
|
+
elevation="4"
|
|
5
|
+
height="250"
|
|
6
|
+
max-width="800"
|
|
7
|
+
width="100%"
|
|
8
|
+
rounded
|
|
9
|
+
>
|
|
10
|
+
<div>
|
|
11
|
+
<h2 class="text-h4 font-weight-black text-primary">403 Forbidden</h2>
|
|
12
|
+
|
|
13
|
+
<div class="text-h6 font-weight-medium mt-2 mb-6">
|
|
14
|
+
Acceso Denegado<br />
|
|
15
|
+
No tiene accesso al recurso solicitado
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<v-btn
|
|
19
|
+
color="primary"
|
|
20
|
+
elevation="0"
|
|
21
|
+
@click="navigateTo('/')"
|
|
22
|
+
variant="text"
|
|
23
|
+
text="Volver a la página de inicio"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
</v-sheet>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import { definePageMeta, navigateTo } from "#imports";
|
|
31
|
+
|
|
32
|
+
definePageMeta({
|
|
33
|
+
layout: "empty",
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin encargado de implementar autenticación SSO mediante WSO2.
|
|
3
|
+
*
|
|
4
|
+
* Se expone la información de la sesión proporcionando helpers en la instancia NuxtApp.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
const { $isAuthenticated, $authData } = useNuxtApp();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: any;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import {
|
|
3
|
+
AsgardeoSPAClient,
|
|
4
|
+
Hooks
|
|
5
|
+
} from "@asgardeo/auth-spa";
|
|
6
|
+
import { useAuthorization, useAuthStore } from "#imports";
|
|
7
|
+
import stringToBoolean from "../utils/stringToBoolean.js";
|
|
8
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
9
|
+
const auth = AsgardeoSPAClient.getInstance();
|
|
10
|
+
const runtimeConfig = useRuntimeConfig();
|
|
11
|
+
const config = runtimeConfig.public.unaNuxtModule.sso;
|
|
12
|
+
if (typeof config.validateIDToken === "string") {
|
|
13
|
+
config.validateIDToken = stringToBoolean(config.validateIDToken);
|
|
14
|
+
}
|
|
15
|
+
auth?.initialize(config);
|
|
16
|
+
auth?.signIn();
|
|
17
|
+
auth?.on(Hooks.SignIn, async (response) => {
|
|
18
|
+
const authorization = useAuthorization();
|
|
19
|
+
const authStore = useAuthStore();
|
|
20
|
+
const userInfo = {
|
|
21
|
+
email: response.email,
|
|
22
|
+
fullName: response.displayName,
|
|
23
|
+
name: response.givenName,
|
|
24
|
+
lastName: response.familyName,
|
|
25
|
+
photoUrl: response.profile,
|
|
26
|
+
mainRole: "Admin"
|
|
27
|
+
};
|
|
28
|
+
const token = await auth?.getAccessToken();
|
|
29
|
+
const resources = await authorization.getResources(token);
|
|
30
|
+
const authData = {
|
|
31
|
+
isAuthenticated: true,
|
|
32
|
+
accessToken: token,
|
|
33
|
+
resources
|
|
34
|
+
};
|
|
35
|
+
authStore.update(userInfo, authData);
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
provide: {
|
|
39
|
+
/**
|
|
40
|
+
* Método para cerrar la sesión del usuario en WSO2.
|
|
41
|
+
*/
|
|
42
|
+
signOut: async () => {
|
|
43
|
+
auth?.signOut();
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Método si el usuario esta autenticado en WSO2.
|
|
47
|
+
*/
|
|
48
|
+
isAuthenticated: async () => {
|
|
49
|
+
return await auth?.isAuthenticated();
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Método que retorna la informacion de la sesión del usuario.
|
|
53
|
+
*/
|
|
54
|
+
authData: async () => {
|
|
55
|
+
return await auth?.getBasicUserInfo();
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Método que retorna el ID Token decodificado.
|
|
59
|
+
*/
|
|
60
|
+
decodedIDToken: async () => {
|
|
61
|
+
return await auth?.getDecodedIDToken();
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Método que retorna el Access Token del usuario.
|
|
65
|
+
*/
|
|
66
|
+
accessToken: async () => {
|
|
67
|
+
return await auth?.getAccessToken();
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Método que retorna el ID Token.
|
|
71
|
+
*/
|
|
72
|
+
getIDToken: async () => {
|
|
73
|
+
return await auth?.getIDToken();
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Método que retorna los endpoints de OpenId Connect.
|
|
77
|
+
*/
|
|
78
|
+
OIDCServiceEndpoints: async () => {
|
|
79
|
+
return await auth?.getOIDCServiceEndpoints();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
Binary file
|
|
Binary file
|