m-11/6
This commit is contained in:
@@ -4,7 +4,7 @@ package org.maxkey.web.apps.contorller;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -36,10 +36,10 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
|
||||
@RequestMapping(value = { "/grid" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<Applications> queryDataGrid(@ModelAttribute("applications") Applications applications) {
|
||||
JpaPageResults<Applications> jqGridApp=applicationsService.queryPageResults(applications);
|
||||
public JpaPageResults<Apps> queryDataGrid(@ModelAttribute("applications") Apps applications) {
|
||||
JpaPageResults<Apps> jqGridApp=appsService.queryPageResults(applications);
|
||||
if(jqGridApp!=null&&jqGridApp.getRows()!=null){
|
||||
for (Applications app : jqGridApp.getRows()){
|
||||
for (Apps app : jqGridApp.getRows()){
|
||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
||||
}
|
||||
}
|
||||
@@ -54,12 +54,12 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/add"})
|
||||
public Message insert(@ModelAttribute("application") Applications application) {
|
||||
public Message insert(@ModelAttribute("application") Apps application) {
|
||||
_logger.debug("-Add :" + application);
|
||||
|
||||
transform(application);
|
||||
|
||||
if (applicationsService.insert(application)) {
|
||||
if (appsService.insert(application)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -75,9 +75,9 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/query"})
|
||||
public Message query(@ModelAttribute("application") Applications application) {
|
||||
public Message query(@ModelAttribute("application") Apps application) {
|
||||
_logger.debug("-query :" + application);
|
||||
if (applicationsService.load(application)!=null) {
|
||||
if (appsService.load(application)!=null) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -93,9 +93,9 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/update"})
|
||||
public Message update(@ModelAttribute("application") Applications application) {
|
||||
public Message update(@ModelAttribute("application") Apps application) {
|
||||
_logger.debug("-update application :" + application);
|
||||
if (applicationsService.update(application)) {
|
||||
if (appsService.update(application)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -107,9 +107,9 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/delete"})
|
||||
public Message delete(@ModelAttribute("application") Applications application) {
|
||||
public Message delete(@ModelAttribute("application") Apps application) {
|
||||
_logger.debug("-delete application :" + application);
|
||||
if (applicationsService.delete(application)) {
|
||||
if (appsService.delete(application)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -8,9 +8,9 @@ import java.io.IOException;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
import org.maxkey.dao.service.ApplicationsService;
|
||||
import org.maxkey.dao.service.AppsService;
|
||||
import org.maxkey.domain.ExtraAttrs;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -26,21 +26,20 @@ public class BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(BaseAppContorller.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("applicationsService")
|
||||
protected ApplicationsService applicationsService;
|
||||
@Qualifier("appsService")
|
||||
protected AppsService appsService;
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("passwordReciprocal")
|
||||
protected PasswordReciprocal passwordReciprocal;
|
||||
|
||||
|
||||
|
||||
public void setApplicationsService(ApplicationsService applicationsService) {
|
||||
this.applicationsService = applicationsService;
|
||||
}
|
||||
|
||||
protected void transform(Applications application) {
|
||||
public void setAppsService(AppsService appsService) {
|
||||
this.appsService = appsService;
|
||||
}
|
||||
|
||||
protected void transform(Apps application) {
|
||||
|
||||
encodeSharedPassword(application);
|
||||
|
||||
@@ -70,8 +69,8 @@ public class BaseAppContorller {
|
||||
|
||||
}
|
||||
|
||||
protected void encodeSharedPassword(Applications application){
|
||||
if(application.getCredential()!=Applications.CREDENTIALS.SHARED){
|
||||
protected void encodeSharedPassword(Apps application){
|
||||
if(application.getCredential()!=Apps.CREDENTIALS.SHARED){
|
||||
if(application.getProtocol().equals(PROTOCOLS.DESKTOP)||application.getProtocol().equals(PROTOCOLS.FORMBASED)){
|
||||
if(StringUtils.isNotEmpty(application.getSharedPassword())){
|
||||
application.setSharedPassword(ReciprocalUtils.encode(application.getSharedPassword()));
|
||||
@@ -80,8 +79,8 @@ public class BaseAppContorller {
|
||||
}
|
||||
}
|
||||
|
||||
protected void decoderSharedPassword(Applications application){
|
||||
if(application.getCredential()!=Applications.CREDENTIALS.SHARED){
|
||||
protected void decoderSharedPassword(Apps application){
|
||||
if(application.getCredential()!=Apps.CREDENTIALS.SHARED){
|
||||
if(application.getProtocol().equals(PROTOCOLS.DESKTOP)||application.getProtocol().equals(PROTOCOLS.FORMBASED)){
|
||||
if(StringUtils.isNotEmpty(application.getSharedPassword())){
|
||||
application.setSharedPassword(ReciprocalUtils.decoder(application.getSharedPassword()));
|
||||
@@ -90,7 +89,7 @@ public class BaseAppContorller {
|
||||
}
|
||||
}
|
||||
|
||||
protected void encoding(Applications application){
|
||||
protected void encoding(Apps application){
|
||||
|
||||
//application.setName(WebContext.encoding(application.getName()));
|
||||
if(null!=application.getDescription()){
|
||||
@@ -100,7 +99,7 @@ public class BaseAppContorller {
|
||||
}
|
||||
|
||||
|
||||
protected void encodeSecret(Applications application){
|
||||
protected void encodeSecret(Apps application){
|
||||
if(application.getSecret()!=null&&!application.getSecret().equals("")){
|
||||
//
|
||||
String encodeSecret=passwordReciprocal.encode(application.getSecret());
|
||||
@@ -108,14 +107,14 @@ public class BaseAppContorller {
|
||||
}
|
||||
}
|
||||
|
||||
protected void decoderSecret(Applications application){
|
||||
protected void decoderSecret(Apps application){
|
||||
if(application.getSecret()!=null&&!application.getSecret().equals("")){
|
||||
String decodeSecret=passwordReciprocal.decoder(application.getSecret());
|
||||
application.setSecret(decodeSecret);
|
||||
}
|
||||
}
|
||||
|
||||
protected void convertExtendAttr(Applications application) {
|
||||
protected void convertExtendAttr(Apps application) {
|
||||
if(application.getAttribute()!=null){
|
||||
String []attributes=application.getAttribute().split(",");
|
||||
String []attributeValue=application.getAttributeValue().split(",");
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -28,7 +28,7 @@ public class BasicDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/basic/appAdd");
|
||||
Applications appDetails =new Applications();
|
||||
Apps appDetails =new Apps();
|
||||
appDetails.setId(appDetails.generateId());
|
||||
appDetails.setProtocol(PROTOCOLS.BASIC);
|
||||
appDetails.setSecret(ReciprocalUtils.generateKey(ReciprocalUtils.Algorithm.DES));
|
||||
@@ -38,12 +38,12 @@ public class BasicDetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("appDetails") Applications appDetails ) {
|
||||
public ModelAndView insert(@ModelAttribute("appDetails") Apps appDetails ) {
|
||||
_logger.debug("-Add :" + appDetails);
|
||||
|
||||
transform(appDetails);
|
||||
|
||||
if (applicationsService.insert(appDetails)) {
|
||||
if (appsService.insert(appDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -55,7 +55,7 @@ public class BasicDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/basic/appUpdate");
|
||||
Applications appDetails=applicationsService.get(id);
|
||||
Apps appDetails=appsService.get(id);
|
||||
super.decoderSecret(appDetails);
|
||||
WebContext.setAttribute(appDetails.getId(), appDetails.getIcon());
|
||||
modelAndView.addObject("model",appDetails);
|
||||
@@ -68,12 +68,12 @@ public class BasicDetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("appDetails") Applications appDetails) {
|
||||
public ModelAndView update(@ModelAttribute("appDetails") Apps appDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + appDetails);
|
||||
transform(appDetails);
|
||||
|
||||
if (applicationsService.update(appDetails)) {
|
||||
if (appsService.update(appDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -87,7 +87,7 @@ public class BasicDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (applicationsService.remove(id)) {
|
||||
if (appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package org.maxkey.web.apps.contorller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.CasDetailsService;
|
||||
import org.maxkey.domain.apps.CasDetails;
|
||||
import org.maxkey.dao.service.AppsCasDetailsService;
|
||||
import org.maxkey.domain.apps.AppsCasDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -27,12 +25,12 @@ public class CasDetailsController extends BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(CasDetailsController.class);
|
||||
|
||||
@Autowired
|
||||
CasDetailsService casDetailsService;
|
||||
AppsCasDetailsService casDetailsService;
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/cas/appAdd");
|
||||
CasDetails casDetails =new CasDetails();
|
||||
AppsCasDetails casDetails =new AppsCasDetails();
|
||||
casDetails.setId(casDetails.generateId());
|
||||
casDetails.setProtocol(PROTOCOLS.CAS);
|
||||
casDetails.setSecret(ReciprocalUtils.generateKey(ReciprocalUtils.Algorithm.DES));
|
||||
@@ -42,12 +40,12 @@ public class CasDetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("casDetails") CasDetails casDetails) {
|
||||
public ModelAndView insert(@ModelAttribute("casDetails") AppsCasDetails casDetails) {
|
||||
_logger.debug("-Add :" + casDetails);
|
||||
|
||||
transform(casDetails);
|
||||
|
||||
if (casDetailsService.insert(casDetails)&&applicationsService.insert(casDetails)) {
|
||||
if (casDetailsService.insert(casDetails)&&appsService.insertApp(casDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -59,7 +57,7 @@ public class CasDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/cas/appUpdate");
|
||||
CasDetails casDetails=casDetailsService.get(id);
|
||||
AppsCasDetails casDetails=casDetailsService.getAppDetails(id);
|
||||
super.decoderSecret(casDetails);
|
||||
WebContext.setAttribute(casDetails.getId(), casDetails.getIcon());
|
||||
|
||||
@@ -73,12 +71,12 @@ public class CasDetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("casDetails") CasDetails casDetails) {
|
||||
public ModelAndView update(@ModelAttribute("casDetails") AppsCasDetails casDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + casDetails);
|
||||
transform(casDetails);
|
||||
|
||||
if (casDetailsService.update(casDetails)&&applicationsService.update(casDetails)) {
|
||||
if (casDetailsService.update(casDetails)&&appsService.updateApp(casDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -92,7 +90,7 @@ public class CasDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (casDetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
if (casDetailsService.remove(id)&&appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.DesktopDetailsService;
|
||||
import org.maxkey.domain.apps.DesktopDetails;
|
||||
import org.maxkey.dao.service.AppsDesktopDetailsService;
|
||||
import org.maxkey.domain.apps.AppsDesktopDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -27,12 +27,12 @@ public class DesktopDetailsController extends BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(DesktopDetailsController.class);
|
||||
|
||||
@Autowired
|
||||
DesktopDetailsService desktopDetailsService;
|
||||
AppsDesktopDetailsService desktopDetailsService;
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/desktop/appAdd");
|
||||
DesktopDetails desktopDetails=new DesktopDetails();
|
||||
AppsDesktopDetails desktopDetails=new AppsDesktopDetails();
|
||||
desktopDetails.setId(desktopDetails.generateId());
|
||||
desktopDetails.setProtocol(PROTOCOLS.DESKTOP);
|
||||
desktopDetails.setSecret(ReciprocalUtils.generateKey(""));
|
||||
@@ -44,12 +44,12 @@ public class DesktopDetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("desktopDetails") DesktopDetails desktopDetails) {
|
||||
public ModelAndView insert(@ModelAttribute("desktopDetails") AppsDesktopDetails desktopDetails) {
|
||||
_logger.debug("-Add :" + desktopDetails);
|
||||
|
||||
transform(desktopDetails);
|
||||
desktopDetailsService.insert(desktopDetails);
|
||||
if (applicationsService.insert(desktopDetails)) {
|
||||
if (appsService.insert(desktopDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@ public class DesktopDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/desktop/appUpdate");
|
||||
DesktopDetails desktopDetails=desktopDetailsService.get(id);
|
||||
AppsDesktopDetails desktopDetails=desktopDetailsService.getAppDetails(id);
|
||||
decoderSecret(desktopDetails);
|
||||
decoderSharedPassword(desktopDetails);
|
||||
WebContext.setAttribute(desktopDetails.getId(), desktopDetails.getIcon());
|
||||
@@ -76,12 +76,12 @@ public class DesktopDetailsController extends BaseAppContorller {
|
||||
*/
|
||||
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("desktopDetails") DesktopDetails desktopDetails) {
|
||||
public ModelAndView update(@ModelAttribute("desktopDetails") AppsDesktopDetails desktopDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + desktopDetails);
|
||||
transform(desktopDetails);
|
||||
|
||||
if (desktopDetailsService.update(desktopDetails)&&applicationsService.update(desktopDetails)) {
|
||||
if (desktopDetailsService.update(desktopDetails)&&appsService.update(desktopDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -94,7 +94,7 @@ public class DesktopDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (desktopDetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
if (desktopDetailsService.remove(id)&&appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.ExtendApiDetails;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.domain.apps.AppsExtendApiDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -30,7 +30,7 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/extendapi/appAdd");
|
||||
ExtendApiDetails extendApiDetails=new ExtendApiDetails();
|
||||
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
||||
extendApiDetails.setId(extendApiDetails.generateId());
|
||||
extendApiDetails.setProtocol(PROTOCOLS.EXTEND_API);
|
||||
extendApiDetails.setSecret(ReciprocalUtils.generateKey(""));
|
||||
@@ -40,12 +40,12 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
||||
}
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("extendApiDetails") ExtendApiDetails extendApiDetails) {
|
||||
public ModelAndView insert(@ModelAttribute("extendApiDetails") AppsExtendApiDetails extendApiDetails) {
|
||||
_logger.debug("-Add :" + extendApiDetails);
|
||||
|
||||
transform(extendApiDetails);
|
||||
|
||||
if (applicationsService.insert(extendApiDetails)) {
|
||||
if (appsService.insert(extendApiDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -57,9 +57,9 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/extendapi/appUpdate");
|
||||
Applications application= applicationsService.get(id);
|
||||
Apps application= appsService.get(id);
|
||||
super.decoderSecret(application);
|
||||
ExtendApiDetails extendApiDetails=new ExtendApiDetails();
|
||||
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
||||
BeanUtils.copyProperties(application, extendApiDetails);
|
||||
|
||||
WebContext.setAttribute(extendApiDetails.getId(), extendApiDetails.getIcon());
|
||||
@@ -74,11 +74,11 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("extendApiDetails") ExtendApiDetails extendApiDetails) {
|
||||
public ModelAndView update(@ModelAttribute("extendApiDetails") AppsExtendApiDetails extendApiDetails) {
|
||||
_logger.debug("-update extendApiDetails :" + extendApiDetails);
|
||||
transform(extendApiDetails);
|
||||
|
||||
if (applicationsService.update(extendApiDetails)) {
|
||||
if (appsService.update(extendApiDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -92,7 +92,7 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (applicationsService.remove(id)) {
|
||||
if (appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.FormBasedDetailsService;
|
||||
import org.maxkey.domain.apps.FormBasedDetails;
|
||||
import org.maxkey.dao.service.AppsFormBasedDetailsService;
|
||||
import org.maxkey.domain.apps.AppsFormBasedDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -27,13 +27,13 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(FormBasedDetailsController.class);
|
||||
|
||||
@Autowired
|
||||
FormBasedDetailsService formBasedDetailsService;
|
||||
AppsFormBasedDetailsService formBasedDetailsService;
|
||||
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/formbased/appAdd");
|
||||
FormBasedDetails formBasedDetails=new FormBasedDetails();
|
||||
AppsFormBasedDetails formBasedDetails=new AppsFormBasedDetails();
|
||||
formBasedDetails.setId(formBasedDetails.generateId());
|
||||
formBasedDetails.setProtocol(PROTOCOLS.FORMBASED);
|
||||
formBasedDetails.setSecret(ReciprocalUtils.generateKey(""));
|
||||
@@ -45,12 +45,12 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("formBasedDetails") FormBasedDetails formBasedDetails) {
|
||||
public ModelAndView insert(@ModelAttribute("formBasedDetails") AppsFormBasedDetails formBasedDetails) {
|
||||
_logger.debug("-Add :" + formBasedDetails);
|
||||
|
||||
transform(formBasedDetails);
|
||||
|
||||
if (formBasedDetailsService.insert(formBasedDetails)&&applicationsService.insert(formBasedDetails)) {
|
||||
if (formBasedDetailsService.insert(formBasedDetails)&&appsService.insert(formBasedDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -62,7 +62,7 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/formbased/appUpdate");
|
||||
FormBasedDetails formBasedDetails=formBasedDetailsService.get(id);
|
||||
AppsFormBasedDetails formBasedDetails=formBasedDetailsService.getAppDetails(id);
|
||||
decoderSecret(formBasedDetails);
|
||||
decoderSharedPassword(formBasedDetails);
|
||||
WebContext.setAttribute(formBasedDetails.getId(), formBasedDetails.getIcon());
|
||||
@@ -76,11 +76,11 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("formBasedDetails") FormBasedDetails formBasedDetails) {
|
||||
public ModelAndView update(@ModelAttribute("formBasedDetails") AppsFormBasedDetails formBasedDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + formBasedDetails);
|
||||
transform(formBasedDetails);
|
||||
if (formBasedDetailsService.update(formBasedDetails)&&applicationsService.update(formBasedDetails)) {
|
||||
if (formBasedDetailsService.update(formBasedDetails)&&appsService.update(formBasedDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -94,7 +94,7 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (formBasedDetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
if (formBasedDetailsService.remove(id)&&appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
package org.maxkey.web.apps.contorller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.TokenBasedDetailsService;
|
||||
import org.maxkey.domain.apps.TokenBasedDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/apps/ltpa"})
|
||||
public class LtpaDetailsController extends BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(TokenBasedDetailsController.class);
|
||||
|
||||
@Autowired
|
||||
TokenBasedDetailsService tokenBasedDetailsService;
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/ltpa/appAdd");
|
||||
TokenBasedDetails ltpaDetails =new TokenBasedDetails();
|
||||
ltpaDetails.setProtocol(PROTOCOLS.LTPA);
|
||||
ltpaDetails.setSecret(ReciprocalUtils.generateKey(ReciprocalUtils.Algorithm.DES));
|
||||
ltpaDetails.setAlgorithmKey(ltpaDetails.getSecret());
|
||||
modelAndView.addObject("model",ltpaDetails);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("ltpaDetails") TokenBasedDetails ltpaDetails) {
|
||||
_logger.debug("-Add :" + ltpaDetails);
|
||||
transform(ltpaDetails);
|
||||
|
||||
if (tokenBasedDetailsService.insert(ltpaDetails)&&applicationsService.insert(ltpaDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.error);
|
||||
}
|
||||
return WebContext.forward("forwardUpdate/"+ltpaDetails.getId());
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/ltpa/appUpdate");
|
||||
TokenBasedDetails ltpaDetails=tokenBasedDetailsService.get(id);
|
||||
decoderSecret(ltpaDetails);
|
||||
String algorithmKey=passwordReciprocal.decoder(ltpaDetails.getAlgorithmKey());
|
||||
ltpaDetails.setAlgorithmKey(algorithmKey);
|
||||
WebContext.setAttribute(ltpaDetails.getId(), ltpaDetails.getIcon());
|
||||
|
||||
modelAndView.addObject("model",ltpaDetails);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* modify
|
||||
* @param application
|
||||
* @return
|
||||
*/
|
||||
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("ltpaDetails") TokenBasedDetails ltpaDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + ltpaDetails);
|
||||
System.out.println();
|
||||
transform(ltpaDetails);
|
||||
ltpaDetails.setAlgorithmKey(ltpaDetails.getSecret());
|
||||
if (tokenBasedDetailsService.update(ltpaDetails)&&applicationsService.update(ltpaDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_ERROR),MessageType.error);
|
||||
}
|
||||
return WebContext.forward("forwardUpdate/"+ltpaDetails.getId());
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (tokenBasedDetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_ERROR),MessageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import org.maxkey.authz.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.OAuth20Details;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.domain.apps.AppsOAuth20Details;
|
||||
import org.maxkey.domain.apps.oauth2.provider.client.BaseClientDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
@@ -35,7 +35,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/oauth20/appAdd");
|
||||
OAuth20Details oauth20Details=new OAuth20Details();
|
||||
AppsOAuth20Details oauth20Details=new AppsOAuth20Details();
|
||||
oauth20Details.setId(oauth20Details.generateId());
|
||||
oauth20Details.setSecret(ReciprocalUtils.generateKey(""));
|
||||
oauth20Details.setClientId(oauth20Details.getId());
|
||||
@@ -47,7 +47,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("oauth20Details") OAuth20Details oauth20Details) {
|
||||
public ModelAndView insert(@ModelAttribute("oauth20Details") AppsOAuth20Details oauth20Details ) {
|
||||
_logger.debug("-Add :" + oauth20Details);
|
||||
|
||||
transform(oauth20Details);
|
||||
@@ -55,7 +55,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
oauth20Details.setClientSecret(oauth20Details.getSecret());
|
||||
|
||||
oauth20JdbcClientDetailsService.addClientDetails(oauth20Details.clientDetailsRowMapper());
|
||||
if (applicationsService.insert(oauth20Details)) {
|
||||
if (appsService.insertApp(oauth20Details)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -68,9 +68,9 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/oauth20/appUpdate");
|
||||
BaseClientDetails baseClientDetails=(BaseClientDetails)oauth20JdbcClientDetailsService.loadClientByClientId(id);
|
||||
Applications application=applicationsService.get(id);//
|
||||
Apps application=appsService.get(id);//
|
||||
decoderSecret(application);
|
||||
OAuth20Details oauth20Details=new OAuth20Details(application,baseClientDetails);
|
||||
AppsOAuth20Details oauth20Details=new AppsOAuth20Details(application,baseClientDetails);
|
||||
oauth20Details.setSecret(application.getSecret());
|
||||
oauth20Details.setClientSecret(application.getSecret());
|
||||
_logger.debug("forwardUpdate "+oauth20Details);
|
||||
@@ -84,7 +84,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("oauth20Details") OAuth20Details oauth20Details) {
|
||||
public ModelAndView update( @ModelAttribute("oauth20Details") AppsOAuth20Details oauth20Details) {
|
||||
//
|
||||
_logger.debug("-update application :" + oauth20Details);
|
||||
_logger.debug("-update oauth20Details use oauth20JdbcClientDetails" );
|
||||
@@ -93,7 +93,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
oauth20Details.setClientSecret(oauth20Details.getSecret());
|
||||
oauth20JdbcClientDetailsService.updateClientDetails(oauth20Details.clientDetailsRowMapper());
|
||||
oauth20JdbcClientDetailsService.updateClientSecret(oauth20Details.getClientId(), oauth20Details.getClientSecret());
|
||||
if (applicationsService.update(oauth20Details)) {
|
||||
if (appsService.updateApp(oauth20Details)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
} else {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_ERROR),MessageType.error);
|
||||
@@ -107,7 +107,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
oauth20JdbcClientDetailsService.removeClientDetails(id);
|
||||
if (applicationsService.remove(id)) {
|
||||
if (appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -14,8 +14,8 @@ import org.maxkey.crypto.cert.NameUtil;
|
||||
import org.maxkey.crypto.cert.X509CertUtils;
|
||||
import org.maxkey.crypto.keystore.KeyStoreLoader;
|
||||
import org.maxkey.crypto.keystore.KeyStoreUtil;
|
||||
import org.maxkey.dao.service.Saml20DetailsService;
|
||||
import org.maxkey.domain.apps.SAML20Details;
|
||||
import org.maxkey.dao.service.AppsSaml20DetailsService;
|
||||
import org.maxkey.domain.apps.AppsSAML20Details;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -44,12 +44,12 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
private KeyStoreLoader idpKeyStoreLoader;
|
||||
|
||||
@Autowired
|
||||
Saml20DetailsService saml20DetailsService;
|
||||
AppsSaml20DetailsService saml20DetailsService;
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/saml20/appAdd");
|
||||
SAML20Details saml20Details=new SAML20Details();
|
||||
AppsSAML20Details saml20Details=new AppsSAML20Details();
|
||||
saml20Details.setSecret(ReciprocalUtils.generateKey(""));
|
||||
saml20Details.setProtocol(PROTOCOLS.SAML20);
|
||||
modelAndView.addObject("model",saml20Details);
|
||||
@@ -59,7 +59,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("saml20Details") SAML20Details saml20Details) {
|
||||
public ModelAndView insert(@ModelAttribute("saml20Details") AppsSAML20Details saml20Details) {
|
||||
_logger.debug("-Add :" + saml20Details);
|
||||
|
||||
try {
|
||||
@@ -68,7 +68,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
e.printStackTrace();
|
||||
}
|
||||
saml20DetailsService.insert(saml20Details);
|
||||
if (applicationsService.insert(saml20Details)) {
|
||||
if (appsService.insert(saml20Details)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/saml20/appUpdate");
|
||||
SAML20Details saml20Details=saml20DetailsService.get(id);
|
||||
AppsSAML20Details saml20Details=saml20DetailsService.getAppDetails(id);
|
||||
decoderSecret(saml20Details);
|
||||
WebContext.setAttribute(saml20Details.getId(), saml20Details.getIcon());
|
||||
modelAndView.addObject("model",saml20Details);
|
||||
@@ -92,7 +92,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("saml20Details") SAML20Details saml20Details) {
|
||||
public ModelAndView update(@ModelAttribute("saml20Details") AppsSAML20Details saml20Details) {
|
||||
//
|
||||
_logger.debug("-update application :" + saml20Details);
|
||||
_logger.debug("");
|
||||
@@ -102,7 +102,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
e.printStackTrace();
|
||||
}
|
||||
saml20DetailsService.update(saml20Details);
|
||||
if (applicationsService.update(saml20Details)) {
|
||||
if (appsService.update(saml20Details)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -116,7 +116,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (saml20DetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
if (saml20DetailsService.remove(id)&&appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
}
|
||||
}
|
||||
|
||||
protected SAML20Details transform(SAML20Details samlDetails) throws Exception{
|
||||
protected AppsSAML20Details transform(AppsSAML20Details samlDetails) throws Exception{
|
||||
|
||||
super.transform(samlDetails);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.TokenBasedDetailsService;
|
||||
import org.maxkey.domain.apps.TokenBasedDetails;
|
||||
import org.maxkey.dao.service.AppsTokenBasedDetailsService;
|
||||
import org.maxkey.domain.apps.AppsTokenBasedDetails;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -27,13 +27,13 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
||||
final static Logger _logger = LoggerFactory.getLogger(TokenBasedDetailsController.class);
|
||||
|
||||
@Autowired
|
||||
TokenBasedDetailsService tokenBasedDetailsService;
|
||||
AppsTokenBasedDetailsService tokenBasedDetailsService;
|
||||
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/tokenbased/appAdd");
|
||||
TokenBasedDetails tokenBasedDetails =new TokenBasedDetails();
|
||||
AppsTokenBasedDetails tokenBasedDetails =new AppsTokenBasedDetails();
|
||||
tokenBasedDetails.setProtocol(PROTOCOLS.TOKENBASED);
|
||||
tokenBasedDetails.setSecret(ReciprocalUtils.generateKey(ReciprocalUtils.Algorithm.AES));
|
||||
tokenBasedDetails.setAlgorithmKey(tokenBasedDetails.getSecret());
|
||||
@@ -43,14 +43,14 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
||||
|
||||
|
||||
@RequestMapping(value={"/add"})
|
||||
public ModelAndView insert(@ModelAttribute("tokenBasedDetails") TokenBasedDetails tokenBasedDetails) {
|
||||
public ModelAndView insert(@ModelAttribute("tokenBasedDetails") AppsTokenBasedDetails tokenBasedDetails) {
|
||||
_logger.debug("-Add :" + tokenBasedDetails);
|
||||
|
||||
transform(tokenBasedDetails);
|
||||
|
||||
tokenBasedDetails.setAlgorithmKey(tokenBasedDetails.getSecret());
|
||||
|
||||
if (tokenBasedDetailsService.insert(tokenBasedDetails)&&applicationsService.insert(tokenBasedDetails)) {
|
||||
if (tokenBasedDetailsService.insert(tokenBasedDetails)&&appsService.insert(tokenBasedDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -62,7 +62,7 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/tokenbased/appUpdate");
|
||||
TokenBasedDetails tokenBasedDetails=tokenBasedDetailsService.get(id);
|
||||
AppsTokenBasedDetails tokenBasedDetails=tokenBasedDetailsService.getAppDetails(id);
|
||||
decoderSecret(tokenBasedDetails);
|
||||
String algorithmKey=passwordReciprocal.decoder(tokenBasedDetails.getAlgorithmKey());
|
||||
tokenBasedDetails.setAlgorithmKey(algorithmKey);
|
||||
@@ -77,12 +77,12 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/update"})
|
||||
public ModelAndView update(@ModelAttribute("tokenBasedDetails") TokenBasedDetails tokenBasedDetails) {
|
||||
public ModelAndView update(@ModelAttribute("tokenBasedDetails") AppsTokenBasedDetails tokenBasedDetails) {
|
||||
//
|
||||
_logger.debug("-update application :" + tokenBasedDetails);
|
||||
transform(tokenBasedDetails);
|
||||
tokenBasedDetails.setAlgorithmKey(tokenBasedDetails.getSecret());
|
||||
if (tokenBasedDetailsService.update(tokenBasedDetails)&&applicationsService.update(tokenBasedDetails)) {
|
||||
if (tokenBasedDetailsService.update(tokenBasedDetails)&&appsService.update(tokenBasedDetails)) {
|
||||
new Message(WebContext.getI18nValue(OPERATEMESSAGE.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
@@ -96,7 +96,7 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
||||
@RequestMapping(value={"/delete/{id}"})
|
||||
public Message delete(@PathVariable("id") String id) {
|
||||
_logger.debug("-delete application :" + id);
|
||||
if (tokenBasedDetailsService.remove(id)&&applicationsService.remove(id)) {
|
||||
if (tokenBasedDetailsService.remove(id)&&appsService.remove(id)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -4,11 +4,11 @@ import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.AccountsService;
|
||||
import org.maxkey.dao.service.ApplicationsService;
|
||||
import org.maxkey.dao.service.AppsService;
|
||||
import org.maxkey.dao.service.UserInfoService;
|
||||
import org.maxkey.domain.Accounts;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -34,8 +34,8 @@ public class AccountsController {
|
||||
AccountsService accountsService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("applicationsService")
|
||||
protected ApplicationsService applicationsService;
|
||||
@Qualifier("appsService")
|
||||
protected AppsService appsService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("userInfoService")
|
||||
@@ -64,7 +64,7 @@ public class AccountsController {
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd(@ModelAttribute("appAccounts") Accounts appAccounts) {
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAdd");
|
||||
//Applications app= applicationsService.get(appAccounts.getAppId());
|
||||
//Applications app= appsService.get(appAccounts.getAppId());
|
||||
//appAccounts.setAppName(app.getName());
|
||||
modelAndView.addObject("model",appAccounts);
|
||||
return modelAndView;
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.dao.service.GroupPrivilegesService;
|
||||
import org.maxkey.domain.GroupPrivileges;
|
||||
import org.maxkey.domain.apps.Applications;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
@@ -44,7 +44,7 @@ public class GroupPrivilegesController {
|
||||
jqGridApp= groupPrivilegesService.queryPageResults("appsInGroup",groupApp);
|
||||
|
||||
if(jqGridApp!=null&&jqGridApp.getRows()!=null){
|
||||
for (Applications app : jqGridApp.getRows()){
|
||||
for (Apps app : jqGridApp.getRows()){
|
||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class GroupPrivilegesController {
|
||||
jqGridApp= groupPrivilegesService.queryPageResults("appsNotInGroup",groupApp);
|
||||
|
||||
if(jqGridApp!=null&&jqGridApp.getRows()!=null){
|
||||
for (Applications app : jqGridApp.getRows()){
|
||||
for (Apps app : jqGridApp.getRows()){
|
||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.dao.service.LoginAppsHistoryService;
|
||||
import org.maxkey.dao.service.LoginHistoryService;
|
||||
import org.maxkey.dao.service.LogsService;
|
||||
import org.maxkey.domain.LoginAppsHistory;
|
||||
import org.maxkey.domain.LoginHistory;
|
||||
import org.maxkey.domain.Logs;
|
||||
import org.maxkey.dao.service.HistoryLoginAppsService;
|
||||
import org.maxkey.dao.service.HistoryLoginService;
|
||||
import org.maxkey.dao.service.HistoryLogsService;
|
||||
import org.maxkey.domain.HistoryLoginApps;
|
||||
import org.maxkey.domain.HistoryLogin;
|
||||
import org.maxkey.domain.HistoryLogs;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -35,13 +35,13 @@ public class LogsController {
|
||||
final static Logger _logger = LoggerFactory.getLogger(LogsController.class);
|
||||
|
||||
@Autowired
|
||||
LoginHistoryService loginHistoryService;
|
||||
HistoryLoginService loginHistoryService;
|
||||
|
||||
@Autowired
|
||||
protected LoginAppsHistoryService loginAppsHistoryService;
|
||||
protected HistoryLoginAppsService loginAppsHistoryService;
|
||||
|
||||
@Autowired
|
||||
LogsService logsService;
|
||||
HistoryLogsService logsService;
|
||||
|
||||
/**
|
||||
* 查询操作日志
|
||||
@@ -50,7 +50,7 @@ final static Logger _logger = LoggerFactory.getLogger(LogsController.class);
|
||||
*/
|
||||
@RequestMapping(value={"/grid"})
|
||||
@ResponseBody
|
||||
public JpaPageResults<Logs> logsDataGrid(@ModelAttribute("logs") Logs logs){
|
||||
public JpaPageResults<HistoryLogs> logsDataGrid(@ModelAttribute("logs") HistoryLogs logs){
|
||||
_logger.debug("logs/datagrid/ logsGrid() "+logs);
|
||||
return logsService.queryPageResults(logs);
|
||||
}
|
||||
@@ -67,12 +67,12 @@ final static Logger _logger = LoggerFactory.getLogger(LogsController.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoginHistory
|
||||
* @param HistoryLogin
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value={"/loginHistory/grid"})
|
||||
@ResponseBody
|
||||
public JpaPageResults<LoginHistory> logAuthsGrid(@ModelAttribute("loginHistory") LoginHistory loginHistory){
|
||||
public JpaPageResults<HistoryLogin> logAuthsGrid(@ModelAttribute("loginHistory") HistoryLogin loginHistory){
|
||||
_logger.debug("logs/loginHistory/datagrid/ logsGrid() "+loginHistory);
|
||||
return loginHistoryService.queryPageResults(loginHistory);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ final static Logger _logger = LoggerFactory.getLogger(LogsController.class);
|
||||
*/
|
||||
@RequestMapping(value={"/loginAppsHistory/grid"})
|
||||
@ResponseBody
|
||||
public JpaPageResults<LoginAppsHistory> loginAppsHistoryGrid(@ModelAttribute("loginAppsHistory") LoginAppsHistory loginAppsHistory){
|
||||
public JpaPageResults<HistoryLoginApps> loginAppsHistoryGrid(@ModelAttribute("loginAppsHistory") HistoryLoginApps loginAppsHistory){
|
||||
_logger.debug("logs/loginAppsHistory/datagrid/ logsGrid() "+loginAppsHistory);
|
||||
loginAppsHistory.setId(null);
|
||||
return loginAppsHistoryService.queryPageResults(loginAppsHistory);
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.maxkey.web.interceptor;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.maxkey.dao.service.LogsService;
|
||||
import org.maxkey.domain.Logs;
|
||||
import org.maxkey.dao.service.HistoryLogsService;
|
||||
import org.maxkey.domain.HistoryLogs;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
import org.maxkey.web.WebContext;
|
||||
@@ -25,13 +25,13 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
public class LogAdapter extends HandlerInterceptorAdapter {
|
||||
public class HistoryLogsAdapter extends HandlerInterceptorAdapter {
|
||||
|
||||
private static final Logger _logger = LoggerFactory.getLogger(LogAdapter.class);
|
||||
private static final Logger _logger = LoggerFactory.getLogger(HistoryLogsAdapter.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("logsService")
|
||||
private LogsService logsService;
|
||||
@Qualifier("historyLogsService")
|
||||
private HistoryLogsService historyLogsService;
|
||||
|
||||
// after the handler is executed
|
||||
@Override
|
||||
@@ -42,7 +42,7 @@ public class LogAdapter extends HandlerInterceptorAdapter {
|
||||
if(message.getMessageScope() == MessageScope.DB || message.getMessageScope() == MessageScope.DB_CLIENT) {//判断message类型
|
||||
UserInfo userInfo =WebContext.getUserInfo();//取得当前用户信息
|
||||
//创建日志记录
|
||||
Logs logs = new Logs(
|
||||
HistoryLogs logs = new HistoryLogs(
|
||||
message.getServiceName(),
|
||||
message.getCode(),
|
||||
message.getMessage(),
|
||||
@@ -54,7 +54,7 @@ public class LogAdapter extends HandlerInterceptorAdapter {
|
||||
""
|
||||
);
|
||||
_logger.debug("insert db logs content : "+logs);
|
||||
logsService.insert(logs);//日志插入数据库
|
||||
historyLogsService.insert(logs);//日志插入数据库
|
||||
if(message.getMessageScope() == MessageScope.DB) {//message类型仅插入数据库
|
||||
WebContext.clearMessage();//清除message
|
||||
}
|
||||
Reference in New Issue
Block a user