diff --git a/WebContent/js/djb/apispec/app.js b/WebContent/js/djb/apispec/app.js index 4d2ba55..9bb7dca 100644 --- a/WebContent/js/djb/apispec/app.js +++ b/WebContent/js/djb/apispec/app.js @@ -25,6 +25,10 @@ components: [], // 재사용 스키마(POC: 빈 상태) }; + // GW authtype(oauth/api_key 등, 서버 DETAIL_SPEC 응답). 인증 badge 라벨 판별용. + // (enricher 는 oauth·api_key 를 모두 apiKey-in-header 로 모델링하므로 scheme.type 만으로 구분 불가) + var djbAuthType = ''; + // ============================================================ // 2. 유틸 // ============================================================ @@ -755,22 +759,44 @@ // ============================================================ // 9. 인증 / 보안 (기본정보 Step 에 병합된 섹션) // ============================================================ + // 테스트베드 프록시 사용 여부(포탈 djb.gateway.use-proxy / token-use-proxy). DJB_CTX 미지정 시 기본 true. + function useProxyOn() { return !(window.DJB_CTX && window.DJB_CTX.useProxy === false); } + function tokenProxyOn() { return !(window.DJB_CTX && window.DJB_CTX.tokenUseProxy === false); } + + // 인증 스킴 → 실제 인증방식 라벨/색상. GW enricher 는 oauth·api_key 를 모두 apiKey-in-header 로 모델링하므로 + // scheme.type("apiKey")만으로는 구분 불가 → authtype(djbAuthType) 및 scheme key(djbOAuth/djbApiKey)로 판별. + function schemeAuthLabel(s) { + var at = (djbAuthType || '').trim().toLowerCase(); + if (at === 'oauth' || at === 'oauth2' || at === 'ca' || s.key === 'djbOAuth') { + return { label: 'OAUTH', cls: 'bg-purple-100 text-purple-700' }; + } + if (at === 'api_key' || at === 'apikey' || s.key === 'djbApiKey') { + return { label: 'API KEY', cls: 'bg-emerald-100 text-emerald-700' }; + } + return { label: (s.type || '').toUpperCase(), cls: 'bg-slate-100 text-slate-700' }; + } + function renderAuthSection() { var schemes = state.data.securitySchemes || []; + var proxyOn = useProxyOn(); + var notice = + '
/api/call-api 가 인증 토큰·헤더를 대신 주입합니다.'
+ : ' — 브라우저가 대상 주소로 직접 호출(대상 CORS 허용 필요).') + 'djb.gateway.use-proxy / djb.gateway.token-use-proxy 로 제어됩니다.${escapeHtml(s.key)}
- ${escapeHtml(s.type)}
+ ${escapeHtml(auth.label)}
🔒 GW
${escapeHtml(resolvedCallUrl())}${escapeHtml(resolvedCallUrl())}/api/call-api 경유, 인증 헤더 자동 주입)' : ' (브라우저 → 대상 직접 호출, 대상 CORS 허용 필요)') + `djb.gateway.base-url 값을 사용합니다.