Key 관리 기능 작업중

main
icksishu@gmail.com 1 month ago
parent 6225cd8e6d
commit f558c2bb62

@ -25,7 +25,10 @@ catch (Exception ignored) {
// gradle project properties -> application.yml // gradle project properties -> application.yml
processResources { processResources {
filesMatching('**/application.yml') { filesMatching('**/application.yml') {
expand(project.properties + [commitId: gitCommitId, version: version]) expand(project.properties + [
commitId: gitCommitId, version: version,
user: [home: System.getProperty('user.home')]
])
} }
} }
@ -59,6 +62,7 @@ dependencies {
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.4' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.4'
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16' implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation 'org.bouncycastle:bcprov-jdk18on:1.83'
runtimeOnly 'com.ibm.db2:jcc' runtimeOnly 'com.ibm.db2:jcc'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc' runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
runtimeOnly 'com.mysql:mysql-connector-j' runtimeOnly 'com.mysql:mysql-connector-j'

@ -1,7 +1,47 @@
import axios from 'axios' import axios from 'axios'
import router from '@/router'
const apiClient = axios.create({ headers: { 'Content-Type': 'application/json' } }) const apiClient = axios.create({ headers: { 'Content-Type': 'application/json' } })
let isHandlingAuthError = false
async function handleAuthError(status) {
if (isHandlingAuthError) {
return
}
isHandlingAuthError = true
try {
try {
await apiClient.post('/public-api/logoutProcess')
} catch (e) {
// 로그아웃 안되도 무시
}
if (router.currentRoute.value.path != '/login') {
router.replace({
path: '/login',
query: {
reason: String(status),
},
})
}
} finally {
setTimeout(() => {
isHandlingAuthError = false
}, 20)
}
}
apiClient.interceptors.response.use(
(response) => response,
async (error) => {
const status = error?.response?.status
// 기타 오류 처리시 로직 추가
if (status === 401 || status === 403) {
await handleAuthError(status)
}
return Promise.reject(error)
},
)
export function useApiClient() { export function useApiClient() {
return apiClient return apiClient
} }

@ -13,6 +13,10 @@ async function getCryptoKeyDtoList() {
let dfxCryptoKeyDtoList = ref([]) let dfxCryptoKeyDtoList = ref([])
const cryptoKeyDto = reactive({}) const cryptoKeyDto = reactive({})
async function generateNewKey() {}
async function saveList() {}
onMounted(async () => { onMounted(async () => {
dfxCryptoKeyDtoList.value = await getCryptoKeyDtoList() dfxCryptoKeyDtoList.value = await getCryptoKeyDtoList()
}) })
@ -27,10 +31,14 @@ onMounted(async () => {
</div> </div>
<div class="row"> <div class="row">
<article class="col-12 pt-3"> <article class="col-12 pt-3">
<div class="d-flex flex-row-reverse">
<button type="button" class="btn btn-primary btn-sm m-1" @click="saveList">Save</button>
<button type="button" class="btn btn-success btn-sm m-1" @click="generateNewKey">Generate new Key</button>
</div>
<table class="table table-striped table-bordered align-middle"> <table class="table table-striped table-bordered align-middle">
<thead> <thead>
<tr> <tr>
<th scope="col" class="text-center"></th> <th scope="col" class="text-center">선택</th>
<th scope="col" class="text-center">Key</th> <th scope="col" class="text-center">Key</th>
<th scope="col" class="text-center">Hash</th> <th scope="col" class="text-center">Hash</th>
<th scope="col" class="text-center">Algorithm</th> <th scope="col" class="text-center">Algorithm</th>
@ -52,7 +60,7 @@ onMounted(async () => {
<td class="text-center">{{ cryptoKeyDto.dataEncryptionYn }}</td> <td class="text-center">{{ cryptoKeyDto.dataEncryptionYn }}</td>
</tr> </tr>
<tr v-else> <tr v-else>
<td scope="row" class="text-center" colspan="7">no datas.</td> <td scope="row" class="text-center" colspan="8">no datas.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

@ -69,7 +69,7 @@ const currentContent = computed(() => {
<RouterLink to="/agent-manage.html" class="nav-link" :class="{ active: props.contentId == 'agent-manage-view', 'link-body-emphasis': props.contentId != 'agent-manage-view' }" aria-current="page"> <i class="bi bi-cpu" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Agents </RouterLink> <RouterLink to="/agent-manage.html" class="nav-link" :class="{ active: props.contentId == 'agent-manage-view', 'link-body-emphasis': props.contentId != 'agent-manage-view' }" aria-current="page"> <i class="bi bi-cpu" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Agents </RouterLink>
</li> </li>
<li> <li>
<RouterLink to="/key-manage.html" class="nav-link" :class="{ active: props.contentId == 'key-manage-view', 'link-body-emphasis': props.contentId != 'key-manage-view' }" aria-current="page"> <i class="bi bi-cpu" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Crypto Keys </RouterLink> <RouterLink to="/key-manage.html" class="nav-link" :class="{ active: props.contentId == 'key-manage-view', 'link-body-emphasis': props.contentId != 'key-manage-view' }" aria-current="page"> <i class="bi bi-key" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Crypto Keys </RouterLink>
</li> </li>
<li> <li>
<RouterLink to="/message-history.html" class="nav-link" :class="{ active: props.contentId == 'message-history-view', 'link-body-emphasis': props.contentId != 'message-history-view' }" aria-current="page"> <i class="bi bi-card-checklist" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Messages </RouterLink> <RouterLink to="/message-history.html" class="nav-link" :class="{ active: props.contentId == 'message-history-view', 'link-body-emphasis': props.contentId != 'message-history-view' }" aria-current="page"> <i class="bi bi-card-checklist" style="font-size: 1.1rem; padding-right: 0.5rem"></i> Messages </RouterLink>

@ -21,6 +21,7 @@ import java.util.Map;
public class DfxAgentInfoController { public class DfxAgentInfoController {
private final DfxAgentInfoService dfxAgentInfoService; private final DfxAgentInfoService dfxAgentInfoService;
private final DfxAgentMessageHistoryService dfxAgentMessageHistoryService; private final DfxAgentMessageHistoryService dfxAgentMessageHistoryService;
private final DfxCryptoKeyService dfxCryptoKeyService;
@PostMapping("/app-api/agent/getAgentInfoDtoList") @PostMapping("/app-api/agent/getAgentInfoDtoList")
public ResponseEntity<List<DfxAgentInfoDto>> agentConfigDtoList() { public ResponseEntity<List<DfxAgentInfoDto>> agentConfigDtoList() {
@ -85,4 +86,10 @@ public class DfxAgentInfoController {
List<DfxAgentMessageHistoryDto> dfxAgentMessageHistoryDtoList = dfxAgentMessageHistoryService.selectDfxAgentMessageHistoryDtoList(); List<DfxAgentMessageHistoryDto> dfxAgentMessageHistoryDtoList = dfxAgentMessageHistoryService.selectDfxAgentMessageHistoryDtoList();
return ResponseEntity.ok().body(dfxAgentMessageHistoryDtoList); return ResponseEntity.ok().body(dfxAgentMessageHistoryDtoList);
} }
@PostMapping("/app-api/agent/getCryptoKeyDtoList")
public ResponseEntity<List<DfxCryptoKeyDto>> getCryptoKeyDtoList() {
List<DfxCryptoKeyDto> dfxCryptoKeyDtoList = dfxCryptoKeyService.selectDfxCryptoKeyList();
return ResponseEntity.ok().body(dfxCryptoKeyDtoList);
}
} }

@ -0,0 +1,39 @@
package com.bsmlab.dfx.dfxconsole.app.agent.service;
import com.bsmlab.dfx.dfxconsole.framework.dto.SearchParameterDto;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.stereotype.Service;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.security.Security;
import java.util.List;
@Service
@Slf4j
@RequiredArgsConstructor
public class DfxCryptoKeyService {
private final DfxCryptoKeyMapper cryptoKeyMapper;
public List<DfxCryptoKeyDto> selectDfxCryptoKeyList() {
List<DfxCryptoKeyDto> dfxCryptoKeyDtoList = cryptoKeyMapper.selectDfxCryptoKeyList(SearchParameterDto.builder().build());
return dfxCryptoKeyDtoList;
}
public DfxCryptoKeyDto generateNewKey() throws NoSuchAlgorithmException, NoSuchProviderException {
DfxCryptoKeyDto dfxCryptoKeyDto = DfxCryptoKeyDto.builder().build();
Security.addProvider(new BouncyCastleProvider());
KeyGenerator keyGenerator = KeyGenerator.getInstance("ARIA", "BC");
keyGenerator.init(256, new SecureRandom());
SecretKey key = keyGenerator.generateKey();
return dfxCryptoKeyDto;
}
}
Loading…
Cancel
Save