6 Commits
10 changed files with 8442 additions and 9385 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
node_modules
.git
.gitignore
*.md
dist
+20
View File
@@ -0,0 +1,20 @@
# Base
NUXT_API_ORIGIN=http://localhost:8000
# Variants, in the future
NUXT_MAIN_API_ORIGIN=http://localhost:8000
NUXT_BPJS_API_ORIGIN=http://localhost:8001
NUXT_SYNC_API_ORIGIN=http://localhost:8009
NUXT_API_VCLAIM_SWAGGER=https://vclaim-api.multy.chat
# SSO
SSO_CONFIRM_URL=https://auth.dev.rssa.id/realms/sandbox/protocol/openid-connect/userinfo
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
# test local
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
+19
View File
@@ -0,0 +1,19 @@
# Base
NUXT_API_ORIGIN=http://simrs-x-main-api:8000
# Variants, in the future
NUXT_MAIN_API_ORIGIN=http://simrs-x-main-api:8000
NUXT_BPJS_API_ORIGIN=http://simrs-x-bpjs-api:8001
NUXT_SYNC_API_ORIGIN=http://simrs-x-sync-api:8009
NUXT_API_VCLAIM_SWAGGER=https://vclaim-api.multy.chat
# SSO
SSO_CONFIRM_URL =https://auth.dev.rssa.id/realms/sandbox/protocol/openid-connect/userinfo
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
-16
View File
@@ -1,16 +0,0 @@
NUXT_MAIN_API_ORIGIN=
NUXT_BPJS_API_ORIGIN=
NUXT_API_VCLAIM_SWAGGER= # https://vclaim-api.multy.chat
NUXT_SYNC_API_ORIGIN=
NUXT_API_ORIGIN=
SSO_CONFIRM_URL =
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
# test local
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
+24 -13
View File
@@ -1,17 +1,28 @@
# Build stage
FROM node:20-alpine AS build-stage
# syntax = docker/dockerfile:1
# --- Build Stage ---
FROM node:20-alpine AS build
WORKDIR /app
RUN corepack enable
# Copy package.json and lock file, then install dependencies
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# Copy the rest of the application code and build
COPY . .
RUN pnpm build
# --- Production Stage ---
FROM node:20-alpine AS prod
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Only copy the built output from the build stage
COPY --from=build /app/.output ./
COPY . .
RUN pnpm generate
# Set environment variables for the server
ENV PORT=3000
ENV HOST=0.0.0.0
EXPOSE $PORT
# Production stage
FROM nginx:stable-alpine
COPY --from=build-stage /app/.output/public /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Start the application
CMD ["node", "server/index.mjs"]
+5 -5
View File
@@ -3,7 +3,7 @@ import type { z } from 'zod'
import { toTypedSchema } from '@vee-validate/zod'
import { Loader2 } from 'lucide-vue-next'
import { useForm } from 'vee-validate'
import { useKeycloak } from "~/composables/useKeycloack"
// import { useKeycloak } from "~/composables/useKeycloack"
interface Props {
schema: z.ZodSchema<any>
@@ -36,19 +36,19 @@ const onSubmit = handleSubmit(async (values) => {
}
})
const { initKeycloak, getProfile, loginSSO } = useKeycloak()
// const { initKeycloak, getProfile, loginSSO } = useKeycloak()
const profile = ref<any>(null)
onMounted(async () => {
await initKeycloak('check-sso')
profile.value = getProfile()
// await initKeycloak('check-sso')
// profile.value = getProfile()
console.log(profile)
})
const onSSO = (async () => {
try {
const redirect = window.location.origin + '/auth/sso'
await loginSSO({ redirectUri: redirect })
// await loginSSO({ redirectUri: redirect })
} catch (error) {
console.error('Call SSO failed:', error)
}
+4 -4
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useSidebar } from '~/components/pub/ui/sidebar'
import { useKeycloak } from "~/composables/useKeycloack"
// import { useKeycloak } from "~/composables/useKeycloack"
// defineProps<{
// user: {
@@ -12,15 +12,15 @@ import { useKeycloak } from "~/composables/useKeycloack"
const { isMobile } = useSidebar()
const { user, logout, setActiveRole, getActiveRole } = useUserStore()
const { initKeycloak, logoutSSO } = useKeycloak()
// const { initKeycloak, logoutSSO } = useKeycloak()
// const userStore = useUserStore().user
function handleLogout() {
initKeycloak('check-sso')
// initKeycloak('check-sso')
navigateTo('/auth/login')
logout()
logoutSSO(window.location.origin + '/auth/login')
// logoutSSO(window.location.origin + '/auth/login')
}
const showModalTheme = ref(false)
+1
View File
@@ -21,6 +21,7 @@ export function useKeycloak() {
try {
const initOptions = {
onLoad,
checkLoginIframe: false as const,
promiseType: "native" as const,
pkceMethod: "S256" as const,
};
+6 -6
View File
@@ -1,4 +1,4 @@
import { useKeycloak } from "~/composables/useKeycloack"
// import { useKeycloak } from "~/composables/useKeycloack"
export default defineNuxtRouteMiddleware(async (to) => {
if (to.meta.public) return
@@ -6,17 +6,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
const { $pinia } = useNuxtApp()
const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
await initKeycloak("check-sso");
// const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
// await initKeycloak("check-sso");
if (import.meta.client) {
const userStore = useUserStore($pinia)
if (!userStore.isAuthenticated && !isAuthenticated.value) {
return navigateTo('/auth/login')
} else {
if (isAuthenticated.value) {
await getResponse()
}
// if (isAuthenticated.value) {
// await getResponse()
// }
}
}
})
+8357 -9341
View File
File diff suppressed because it is too large Load diff