Compare commits
8
Commits
bd48cc5907
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d625120a7 | ||
|
|
0591c05dff | ||
|
|
33b6a8660c | ||
|
|
ee56ad39a6 | ||
|
|
00f271524f | ||
|
|
8f8fc83b22 | ||
|
|
8ddda5281d | ||
|
|
09ae596bc8 |
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
*.md
|
||||
dist
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
+17
-22
@@ -1,33 +1,28 @@
|
||||
# Build Stage
|
||||
FROM node:24-alpine AS build-stage
|
||||
|
||||
# Set the working directory inside the container
|
||||
# syntax = docker/dockerfile:1
|
||||
# --- Build Stage ---
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Enable pnpm using corepack
|
||||
RUN corepack enable
|
||||
|
||||
# Copy pnpm related files and package.json to leverage Docker layer caching
|
||||
# Copy package.json and lock file, then install dependencies
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install
|
||||
|
||||
# Install dependencies using pnpm
|
||||
# Using --frozen-lockfile ensures consistent installations based on pnpm-lock.yaml
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install --frozen-lockfile
|
||||
|
||||
# Copy the rest of the application files
|
||||
# Copy the rest of the application code and build
|
||||
COPY . .
|
||||
|
||||
# Build the Vue.js application for production
|
||||
RUN pnpm build
|
||||
|
||||
# Production Stage
|
||||
FROM nginx:stable-alpine AS production-stage
|
||||
# --- Production Stage ---
|
||||
FROM node:20-alpine AS prod
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the built Vue.js application from the build stage to Nginx's web root
|
||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
# Only copy the built output from the build stage
|
||||
COPY --from=build /app/.output ./
|
||||
|
||||
# Expose port 80 for Nginx
|
||||
EXPOSE 80
|
||||
# Set environment variables for the server
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
EXPOSE $PORT
|
||||
|
||||
# Command to run Nginx in the foreground
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Start the application
|
||||
CMD ["node", "server/index.mjs"]
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -21,6 +21,7 @@ export function useKeycloak() {
|
||||
try {
|
||||
const initOptions = {
|
||||
onLoad,
|
||||
checkLoginIframe: false as const,
|
||||
promiseType: "native" as const,
|
||||
pkceMethod: "S256" as const,
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
// }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Generated
+8357
-9341
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user