앱 관리
This commit is contained in:
@@ -0,0 +1,320 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
|
||||
layout:decorate="~{layout/kjbank_base_layout}">
|
||||
<head>
|
||||
<title>API 키 상세</title>
|
||||
</head>
|
||||
<body>
|
||||
<th:block layout:fragment="contentFragment">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="register-header">
|
||||
<h1>API Key 상세</h1>
|
||||
<p class="header-description">
|
||||
발급된 API Key의 상세 정보를 확인할 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<section class="apikey-detail-container">
|
||||
|
||||
<!-- Section 1: 앱 기본 정보 -->
|
||||
<div class="detail-section">
|
||||
<h2 class="section-title">앱 정보</h2>
|
||||
<div class="detail-grid">
|
||||
|
||||
<!-- App Icon -->
|
||||
<div class="detail-item full-width">
|
||||
<label class="detail-label">앱 아이콘</label>
|
||||
<div class="detail-value">
|
||||
<div class="app-icon-display" th:if="${apiKey.appIconFileId != null}">
|
||||
<img th:src="@{/file/download(fileSn=1,fileId=${apiKey.appIconFileId})}"
|
||||
alt="앱 아이콘"
|
||||
class="app-icon-image">
|
||||
</div>
|
||||
<div class="app-icon-display" th:unless="${apiKey.appIconFileId != null}">
|
||||
<div class="app-icon-placeholder">
|
||||
<span>📱</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- App Name -->
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">앱 이름</label>
|
||||
<div class="detail-value" th:text="${apiKey.clientname}">
|
||||
My Application
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- App Status -->
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">앱 상태</label>
|
||||
<div class="detail-value">
|
||||
<span class="status-indicator"
|
||||
th:classappend="${apiKey.appstatus == '1' ? 'status-active' : 'status-inactive'}">
|
||||
<span class="status-dot"></span>
|
||||
<span th:text="${apiKey.appstatus == '1' ? '활성화' : '비활성화'}">활성화</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- App Description -->
|
||||
<div class="detail-item full-width">
|
||||
<label class="detail-label">앱 설명</label>
|
||||
<div class="detail-value" th:text="${apiKey.appDescription != null ? apiKey.appDescription : '설명이 없습니다.'}">
|
||||
This is a sample app description.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Section 2: 인증 상세 정보 -->
|
||||
<div class="detail-section">
|
||||
<h2 class="section-title">인증 정보</h2>
|
||||
<div class="detail-grid">
|
||||
|
||||
<!-- Client ID -->
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">Client ID</label>
|
||||
<div class="detail-value">
|
||||
<div class="secret-box">
|
||||
<code class="credential-code" th:text="${apiKey.clientid}">client-id-12345</code>
|
||||
<button type="button" class="btn-copy" th:data-secret="${apiKey.clientid}" onclick="copyToClipboardFromButton(this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
복사
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Client Secret -->
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">Client Secret</label>
|
||||
<div class="detail-value">
|
||||
<!-- Hidden Secret (shown initially) -->
|
||||
<div class="secret-box" id="hiddenSecretBox">
|
||||
<code class="credential-code">••••••••••••••••••••</code>
|
||||
<button type="button" class="btn-copy" onclick="showPasswordPrompt()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
|
||||
<circle cx="12" cy="12" r="3"></circle>
|
||||
</svg>
|
||||
보기
|
||||
</button>
|
||||
</div>
|
||||
<!-- Actual Secret (hidden initially) -->
|
||||
<div class="secret-box" id="revealedSecretBox" style="display: none;">
|
||||
<code class="credential-code" th:text="${apiKey.clientsecret}">secret-key-67890</code>
|
||||
<button type="button" class="btn-copy" th:data-secret="${apiKey.clientsecret}" onclick="copyToClipboardFromButton(this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
복사
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Callback URL -->
|
||||
<div class="detail-item full-width">
|
||||
<label class="detail-label">Callback URL</label>
|
||||
<div class="detail-value" th:text="${apiKey.redirecturi != null ? apiKey.redirecturi : '설정되지 않음'}">
|
||||
https://example.com/callback
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IP Whitelist -->
|
||||
<div class="detail-item full-width" th:if="${apiKey.allowedips != null}">
|
||||
<label class="detail-label">IP 화이트리스트</label>
|
||||
<div class="detail-value">
|
||||
<div class="ip-list">
|
||||
<span class="ip-tag" th:each="ip : ${#strings.arraySplit(apiKey.allowedips, ',')}">
|
||||
[[${ip.trim()}]]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 등록된 API -->
|
||||
<div class="detail-item full-width">
|
||||
<label class="detail-label">등록된 API</label>
|
||||
<div class="detail-value">
|
||||
<!-- API List -->
|
||||
<div class="api-detail-list">
|
||||
<div class="api-list-item" th:each="api : ${apiKey.apiList}">
|
||||
<span class="api-method method-other">
|
||||
API
|
||||
</span>
|
||||
<span class="api-name" th:text="${api.apiDesc}">API Name</span>
|
||||
<span class="api-status status-active">활성</span>
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div class="empty-state" th:if="${apiKey.apiList == null or apiKey.apiList.isEmpty()}">
|
||||
<div class="empty-icon">📦</div>
|
||||
<p>등록된 API가 없습니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modified Date -->
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">최종 수정일자</label>
|
||||
<div class="detail-value" th:text="${#temporals.format(apiKey.modifiedon, 'yyyy.MM.dd HH:mm')}">
|
||||
2024.01.01 12:00
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="detail-actions">
|
||||
<a sec:authorize="hasRole('ROLE_API_KEY_REQUEST')"
|
||||
class="btn-action btn-primary"
|
||||
th:href="@{/myapikey/modify/step1(clientId=${apiKey.clientid})}">
|
||||
수정
|
||||
</a>
|
||||
<button type="button"
|
||||
sec:authorize="hasRole('ROLE_API_KEY_REQUEST')"
|
||||
class="btn-action btn-danger"
|
||||
th:data-client-id="${apiKey.clientid}"
|
||||
onclick="deleteApiKeyFromButton(this)">
|
||||
인증키 삭제
|
||||
</button>
|
||||
<a th:href="@{/myapikey}" class="btn-secondary">
|
||||
목록으로
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="contentScript">
|
||||
<script th:inline="javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
$(document).ready(function () {
|
||||
activateSelect();
|
||||
});
|
||||
|
||||
// Show password prompt for viewing client secret
|
||||
function showPasswordPrompt() {
|
||||
customPopups.showPasswordInput({
|
||||
title: 'Client Secret 조회',
|
||||
message: '보안을 위해 비밀번호를 입력해주세요.',
|
||||
onConfirm: function(password) {
|
||||
// Verify password via AJAX
|
||||
$.ajax({
|
||||
url: /*[[@{/myapikey/verify-password}]]*/ '/myapikey/verify-password',
|
||||
type: 'POST',
|
||||
data: { password: password },
|
||||
headers: {
|
||||
'X-XSRF-TOKEN': /*[[${_csrf.token}]]*/ 'token'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Hide password popup
|
||||
customPopups.hidePasswordInput();
|
||||
|
||||
// Reveal the client secret
|
||||
$('#hiddenSecretBox').hide();
|
||||
$('#revealedSecretBox').fadeIn(300);
|
||||
} else {
|
||||
// Show error message
|
||||
customPopups.showPasswordError(response.message || '비밀번호가 일치하지 않습니다.');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
customPopups.showPasswordError('오류가 발생했습니다. 다시 시도해주세요.');
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: function() {
|
||||
// User cancelled - do nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Copy to clipboard function - called from button with data-secret attribute
|
||||
function copyToClipboardFromButton(button) {
|
||||
var text = $(button).data('secret');
|
||||
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
alert('클립보드에 복사되었습니다.');
|
||||
}).catch(function(err) {
|
||||
console.error('Failed to copy:', err);
|
||||
fallbackCopy(text);
|
||||
});
|
||||
} else {
|
||||
fallbackCopy(text);
|
||||
}
|
||||
}
|
||||
|
||||
function fallbackCopy(text) {
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-999999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
alert('클립보드에 복사되었습니다.');
|
||||
} catch (err) {
|
||||
alert('복사에 실패했습니다.');
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
|
||||
// Delete API Key function - called from button with data-client-id attribute
|
||||
function deleteApiKeyFromButton(button) {
|
||||
var clientId = $(button).data('client-id');
|
||||
|
||||
if (!confirm('정말로 이 인증키를 삭제하시겠습니까?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loading-overlay').show();
|
||||
|
||||
const requestData = {
|
||||
clientId: clientId
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '/myapikey/api_key_delete',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(requestData),
|
||||
headers: {
|
||||
'X-XSRF-TOKEN': /*[[${_csrf.token}]]*/ 'token'
|
||||
}
|
||||
}).done(function (response) {
|
||||
alert(response.msg || 'API Key가 삭제되었습니다.');
|
||||
window.location.href = /*[[@{/myapikey}]]*/ '/myapikey';
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
alert('API 삭제 요청 중 오류가 발생했습니다: ' + errorThrown);
|
||||
}).always(function () {
|
||||
$('.loading-overlay').hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
</th:block>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user