forked from baron/baron-sso
feat: integrate orgfront and expose internal ids
This commit is contained in:
@@ -3,7 +3,7 @@ import { defineConfig } from "vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
envPrefix: ["VITE_", "USERFRONT_"],
|
||||
envPrefix: ["VITE_", "USERFRONT_", "ORGFRONT_"],
|
||||
server: {
|
||||
host: "127.0.0.1",
|
||||
// 인스턴스별 도메인을 자동으로 허용
|
||||
|
||||
@@ -125,6 +125,20 @@ services:
|
||||
command: npm run dev -- --host 0.0.0.0
|
||||
networks: [app_net]
|
||||
|
||||
orgfront:
|
||||
image: node:20-alpine
|
||||
container_name: ${COMPOSE_PROJECT_NAME}_orgfront
|
||||
working_dir: /app
|
||||
env_file: .env
|
||||
ports:
|
||||
- "${ORGFRONT_PORT}:5175"
|
||||
volumes:
|
||||
- ../../orgfront:/app
|
||||
- ./orgfront/vite.config.ts:/app/vite.config.ts:ro
|
||||
- ./orgfront/auth.ts:/app/src/lib/auth.ts:ro
|
||||
command: npm run dev -- --host 0.0.0.0 --port 5175
|
||||
networks: [app_net]
|
||||
|
||||
networks:
|
||||
app_net:
|
||||
name: ${COMPOSE_PROJECT_NAME}_net
|
||||
|
||||
23
deploy/templates/orgfront/auth.ts
Normal file
23
deploy/templates/orgfront/auth.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { UserManager, WebStorageStateStore } from "oidc-client-ts";
|
||||
import type { AuthProviderProps } from "react-oidc-context";
|
||||
|
||||
export const oidcConfig: AuthProviderProps = {
|
||||
authority:
|
||||
import.meta.env.VITE_OIDC_AUTHORITY ||
|
||||
`${window.location.protocol}//${window.location.hostname}:{{USERFRONT_PORT}}/oidc`,
|
||||
client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "orgfront",
|
||||
redirect_uri: `${window.location.origin}/auth/callback`,
|
||||
response_type: "code",
|
||||
scope: "openid offline_access profile email",
|
||||
post_logout_redirect_uri: window.location.origin,
|
||||
popup_redirect_uri: `${window.location.origin}/auth/callback`,
|
||||
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
||||
automaticSilentRenew: false,
|
||||
};
|
||||
|
||||
export const userManager = new UserManager({
|
||||
...oidcConfig,
|
||||
authority: oidcConfig.authority || "",
|
||||
client_id: oidcConfig.client_id || "",
|
||||
redirect_uri: oidcConfig.redirect_uri || "",
|
||||
});
|
||||
36
deploy/templates/orgfront/vite.config.ts
Normal file
36
deploy/templates/orgfront/vite.config.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
const allowedHosts = [
|
||||
"{{ORGFRONT_DOMAIN}}",
|
||||
"baron-orgchart.hmac.kr",
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
].filter(Boolean);
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
envPrefix: ["VITE_", "USERFRONT_"],
|
||||
server: {
|
||||
host: "127.0.0.1",
|
||||
// 인스턴스별 도메인을 자동으로 허용합니다.
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://backend:{{BACKEND_PORT}}",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
preview: {
|
||||
host: "127.0.0.1",
|
||||
port: 5175,
|
||||
allowedHosts,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: process.env.API_PROXY_TARGET || "http://backend:{{BACKEND_PORT}}",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user