diff --git a/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialMan.jsp b/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialMan.jsp new file mode 100644 index 0000000..30c5adf --- /dev/null +++ b/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialMan.jsp @@ -0,0 +1,130 @@ +<%@ page language="java" contentType="text/html; charset=utf-8"%> +<%@ page import="java.io.*"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> +<%@ include file="/jsp/common/include/localemessage.jsp" %> +<% + response.setHeader("Pragma", "No-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Expires", "0"); +%> + + + + + + + + + +
+
+ +
+
+
+ + +
+
${rmsMenuName}
+ + + + + + + + +
<%= localeMessage.getString("adapter.adptrBzwkGroupName") %>
+
+
+
+
+ + + diff --git a/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialManDetail.jsp b/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialManDetail.jsp new file mode 100644 index 0000000..4d8689d --- /dev/null +++ b/WebContent/jsp/onl/admin/authoutbound/outboundFixedCredentialManDetail.jsp @@ -0,0 +1,252 @@ +<%@ page language="java" contentType="text/html; charset=utf-8" %> +<%@ page import="java.io.*" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@ include file="/jsp/common/include/localemessage.jsp" %> +<% + response.setHeader("Pragma", "No-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Expires", "0"); +%> + + + + + + + + + " rel="stylesheet" /> + + " rel="stylesheet"/> + " rel="stylesheet"/> + + " rel="stylesheet" /> + + " rel="stylesheet" /> + + + + " rel="stylesheet"/> + + + + +
+
+ +
+
+
+ + + +
+
${rmsMenuName}
+ +
+
+
+ BASIC OPTIONS +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+ +
+
+ --> +
+
+ +
+ + + visibility + +
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/java/com/eactive/eai/rms/onl/manage/authoutbound/OutboundFixedCredentialController.java b/src/main/java/com/eactive/eai/rms/onl/manage/authoutbound/OutboundFixedCredentialController.java new file mode 100644 index 0000000..3a9e986 --- /dev/null +++ b/src/main/java/com/eactive/eai/rms/onl/manage/authoutbound/OutboundFixedCredentialController.java @@ -0,0 +1,106 @@ +package com.eactive.eai.rms.onl.manage.authoutbound; + +import com.eactive.eai.agent.command.CommonCommand; +import com.eactive.eai.rms.common.base.OnlBaseAnnotationController; +import com.eactive.eai.rms.common.login.SessionManager; +import com.eactive.eai.rms.common.vo.GridResponse; +import com.eactive.eai.rms.onl.manage.comm.property.PropertyGroupUI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; +import java.util.stream.Collectors; + +@Controller +public class OutboundFixedCredentialController extends OnlBaseAnnotationController { + enum CommandType { RELOAD, DELETE }; + + public static final Log logger = LogFactory.getLog(OutboundFixedCredentialController.class); + + @Autowired + OutboundOAuthCredentialManService service ; + + @GetMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.view") + public void view() { + } + + @GetMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.view", params = "cmd=DETAIL") + public String viewDetail() { + return "/onl/admin/authoutbound/outboundFixedCredentialManDetail"; + } + + @PostMapping(value= "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=LIST") + public ResponseEntity>selectList(String searchAdapterGroupName, Pageable pageable) { + Page page = service.selectList(pageable, searchAdapterGroupName); + Page filteredPage = + new PageImpl<>( + page.filter(i -> "fixed_token".equals(i.getGrantType())) + .stream() + .collect(Collectors.toList()), + pageable, + page.getTotalElements() // 또는 filtered.size() + ); + return ResponseEntity.ok(new GridResponse<>(filteredPage)); + } + + @PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=DETAIL") + public ResponseEntity selectDetail(String adapterGroupName) throws Exception { + OutboundOAuthCredentialUI outboundOAuthCredentialUI = service.selectDetail(adapterGroupName); + return ResponseEntity.ok(outboundOAuthCredentialUI); + } + + @PostMapping(value= "/onl/admin/authoutbound/outboundFixedCredentialMan.json",params = "cmd=LIST_DETAIL_COMBO") + public ResponseEntity> selectDetailCombo() throws Exception { + Map map = service.selectDetailCombo(); + return ResponseEntity.ok(map); + } + + @PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=INSERT") + public ResponseEntity insert(OutboundOAuthCredentialUI outboundOAuthCredentialUI) throws Exception { + service.insert(outboundOAuthCredentialUI); + commandOAuthInfo(CommandType.RELOAD, outboundOAuthCredentialUI.getAdapterGroupName()); + return ResponseEntity.ok().build(); + } + + @PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=UPDATE") + public ResponseEntity update(OutboundOAuthCredentialUI outboundOAuthCredentialUI) throws Exception { + service.update(outboundOAuthCredentialUI); + commandOAuthInfo(CommandType.RELOAD, outboundOAuthCredentialUI.getAdapterGroupName()); + return ResponseEntity.ok().build(); + } + + @PostMapping(value = "/onl/admin/authoutbound/outboundFixedCredentialMan.json", params = "cmd=DELETE") + public ResponseEntity delete(String adapterGroupName) throws Exception { + service.delete(adapterGroupName); + commandOAuthInfo(CommandType.DELETE, adapterGroupName); + return ResponseEntity.ok().build(); + } + + private boolean commandOAuthInfo(CommandType commandType, String adapterGroupName) { + String commandClass ; + + if(CommandType.DELETE == commandType){ + commandClass = "com.eactive.eai.agent.authoutbound.RemoveOutboundOAuthCredentialCommand"; + }else{ + commandClass = "com.eactive.eai.agent.authoutbound.ReloadOutboundOAuthCredentialCommand"; + } + logger.warn("Command:" + commandType + ", Target: " + adapterGroupName); + CommonCommand command = new CommonCommand(commandClass, adapterGroupName); + try { + agentUtilService.broadcast(command); + } catch (Exception e) { + logger.warn("Command error", e); + return false; + } + return true; + } +}