This commit is contained in:
@@ -87,7 +87,7 @@ jobs:
|
|||||||
sso_authorization_endpoint="${SSO_AUTHORIZATION_ENDPOINT:-https://sso.hmac.kr/oidc/oauth2/auth}"
|
sso_authorization_endpoint="${SSO_AUTHORIZATION_ENDPOINT:-https://sso.hmac.kr/oidc/oauth2/auth}"
|
||||||
sso_token_endpoint="${SSO_TOKEN_ENDPOINT:-https://sso.hmac.kr/oidc/oauth2/token}"
|
sso_token_endpoint="${SSO_TOKEN_ENDPOINT:-https://sso.hmac.kr/oidc/oauth2/token}"
|
||||||
sso_userinfo_endpoint="${SSO_USERINFO_ENDPOINT:-https://sso.hmac.kr/oidc/userinfo}"
|
sso_userinfo_endpoint="${SSO_USERINFO_ENDPOINT:-https://sso.hmac.kr/oidc/userinfo}"
|
||||||
sso_scope="${SSO_SCOPE:-openid profile email}"
|
sso_scope="${SSO_SCOPE:-openid profile email tenants}"
|
||||||
sso_client_id="${SSO_CLIENT_ID_SECRET:-${SSO_CLIENT_ID_VAR:-}}"
|
sso_client_id="${SSO_CLIENT_ID_SECRET:-${SSO_CLIENT_ID_VAR:-}}"
|
||||||
sso_client_secret="$SSO_CLIENT_SECRET"
|
sso_client_secret="$SSO_CLIENT_SECRET"
|
||||||
jwt_secret="$JWT_SECRET"
|
jwt_secret="$JWT_SECRET"
|
||||||
|
|||||||
@@ -76,12 +76,7 @@ function App({ Component, pageProps }: AppPropsWithLayout) {
|
|||||||
).join('')
|
).join('')
|
||||||
: readCookie('baron_sso_debug_tenants');
|
: readCookie('baron_sso_debug_tenants');
|
||||||
|
|
||||||
if (!cookie) {
|
if (!cookie) return;
|
||||||
window.console.warn(
|
|
||||||
'[SSO OAuth debug] callback 디버그 쿠키가 없습니다. 로그아웃 후 다시 로그인하세요.',
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(
|
const data = JSON.parse(
|
||||||
|
|||||||
@@ -17,22 +17,34 @@ import { createNextApiHandler } from '@/server/api-handler';
|
|||||||
import { getSupportAuthHeaders } from '@/server/support-auth';
|
import { getSupportAuthHeaders } from '@/server/support-auth';
|
||||||
import { supportExternalUrl } from '@/server/support-external';
|
import { supportExternalUrl } from '@/server/support-external';
|
||||||
|
|
||||||
|
const getErrorMessage = (error: unknown) =>
|
||||||
|
error instanceof Error ? error.message : String(error);
|
||||||
|
|
||||||
const handler = createNextApiHandler({
|
const handler = createNextApiHandler({
|
||||||
GET: async (req, res) => {
|
GET: async (req, res) => {
|
||||||
try {
|
|
||||||
const query =
|
const query =
|
||||||
req.query.candidates ?
|
req.query.candidates ?
|
||||||
'?candidates=1'
|
'?candidates=1'
|
||||||
: req.query.management ?
|
: req.query.management ?
|
||||||
'?management=1'
|
'?management=1'
|
||||||
: '';
|
: '';
|
||||||
const response = await fetch(
|
const target = supportExternalUrl('/access') + query;
|
||||||
supportExternalUrl('/access') + query,
|
|
||||||
{ headers: getSupportAuthHeaders(req) },
|
try {
|
||||||
);
|
const response = await fetch(target, { headers: getSupportAuthHeaders(req) });
|
||||||
const data = (await response.json()) as unknown;
|
const raw = await response.text();
|
||||||
return res.status(response.status).json(data);
|
let data: unknown = {};
|
||||||
|
try {
|
||||||
|
data = raw.trim() ? JSON.parse(raw) : {};
|
||||||
} catch {
|
} catch {
|
||||||
|
data = { message: raw.trim().slice(0, 1000) };
|
||||||
|
}
|
||||||
|
return res.status(response.status).json(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[support access] upstream request failed', {
|
||||||
|
target,
|
||||||
|
error: getErrorMessage(error),
|
||||||
|
});
|
||||||
return res.status(503).json({
|
return res.status(503).json({
|
||||||
message: '권한 정보를 확인할 수 없습니다.',
|
message: '권한 정보를 확인할 수 없습니다.',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -288,6 +288,10 @@ const handler = createNextApiHandler({
|
|||||||
|
|
||||||
return res.status(response.status).json(await readJsonOrMessage(response));
|
return res.status(response.status).json(await readJsonOrMessage(response));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[support submit] upstream request failed', {
|
||||||
|
workspaceCode,
|
||||||
|
error: error instanceof Error ? error.message : String(error),
|
||||||
|
});
|
||||||
return res.status(isUploadSizeError(error) ? 413 : 502).json({
|
return res.status(isUploadSizeError(error) ? 413 : 502).json({
|
||||||
message:
|
message:
|
||||||
isUploadSizeError(error) ?
|
isUploadSizeError(error) ?
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
* URL such as `http://127.0.0.1:8010`; both forms are supported here.
|
* URL such as `http://127.0.0.1:8010`; both forms are supported here.
|
||||||
*/
|
*/
|
||||||
const configuredBaseUrl =
|
const configuredBaseUrl =
|
||||||
|
(
|
||||||
process.env.SUPPORT_CONSOLE_API_BASE_URL ??
|
process.env.SUPPORT_CONSOLE_API_BASE_URL ??
|
||||||
process.env.SUPPORT_API_BASE_URL ??
|
process.env.SUPPORT_API_BASE_URL ??
|
||||||
'https://feedback.hmac.kr/api/support';
|
'https://feedback.hmac.kr/api/support'
|
||||||
|
).trim() || 'https://feedback.hmac.kr/api/support';
|
||||||
|
|
||||||
export const supportExternalUrl = (path: string) => {
|
export const supportExternalUrl = (path: string) => {
|
||||||
const baseUrl = configuredBaseUrl.replace(/\/$/, '');
|
const baseUrl = configuredBaseUrl.replace(/\/$/, '');
|
||||||
|
|||||||
Reference in New Issue
Block a user