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