remove Desktop

This commit is contained in:
MaxKey 2021-03-24 08:16:00 +08:00
parent c1c9bb5e87
commit bb13312975
17 changed files with 3 additions and 1306 deletions

View File

@ -1,6 +1,6 @@
#maxkey properties
group =maxkey.top
version =2.6.0
version =2.7.0
vendor =https://www.maxkey.top
author =maxkeyTop

View File

@ -1,331 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package org.maxkey.domain.apps;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.maxkey.domain.Accounts;
/**
* @author Crystal.Sea
*
*/
@Entity
@Table(name = "MXK_APPS_DESKTOP_DETAILS")
public class AppsDesktopDetails extends Apps {
public static final class ParameterType{
public static final String PARAMETER="PARAMETER";
public static final String SIMULATION="SIMULATION";
};
/**
*
*/
private static final long serialVersionUID = 6691566522839823638L;
private String programPath;
//PARAMETER,SIMULATION
private String parameter;
private String preUsername;
private String usernameType;//PARAMETER,SIMULATION
private String usernameParameter;
private String prePassword;
private String passwordType;//PARAMETER,SIMULATION
private String passwordParameter;
private String preSubmit;
//Enter or key
private String submitType;
private String submitKey;
Accounts appUser;
/**
*
*/
public AppsDesktopDetails() {
}
/**
* @return the programPath
*/
public String getProgramPath() {
return programPath;
}
/**
* @param programPath the programPath to set
*/
public void setProgramPath(String programPath) {
this.programPath = programPath;
}
/**
* @return the parameter
*/
public String getParameter() {
return parameter;
}
/**
* @param parameter the parameter to set
*/
public void setParameter(String parameter) {
this.parameter = parameter;
}
/**
* @return the preUsername
*/
public String getPreUsername() {
return preUsername;
}
/**
* @param preUsername the preUsername to set
*/
public void setPreUsername(String preUsername) {
this.preUsername = preUsername;
}
/**
* @return the usernameType
*/
public String getUsernameType() {
return usernameType;
}
/**
* @param usernameType the usernameType to set
*/
public void setUsernameType(String usernameType) {
this.usernameType = usernameType;
}
/**
* @return the usernameParameter
*/
public String getUsernameParameter() {
return usernameParameter;
}
/**
* @param usernameParameter the usernameParameter to set
*/
public void setUsernameParameter(String usernameParameter) {
this.usernameParameter = usernameParameter;
}
/**
* @return the prePassword
*/
public String getPrePassword() {
return prePassword;
}
/**
* @param prePassword the prePassword to set
*/
public void setPrePassword(String prePassword) {
this.prePassword = prePassword;
}
/**
* @return the passwordType
*/
public String getPasswordType() {
return passwordType;
}
/**
* @param passwordType the passwordType to set
*/
public void setPasswordType(String passwordType) {
this.passwordType = passwordType;
}
/**
* @return the passwordParameter
*/
public String getPasswordParameter() {
return passwordParameter;
}
/**
* @param passwordParameter the passwordParameter to set
*/
public void setPasswordParameter(String passwordParameter) {
this.passwordParameter = passwordParameter;
}
/**
* @return the preSubmit
*/
public String getPreSubmit() {
return preSubmit;
}
/**
* @param preSubmit the preSubmit to set
*/
public void setPreSubmit(String preSubmit) {
this.preSubmit = preSubmit;
}
/**
* @return the submitType
*/
public String getSubmitType() {
return submitType;
}
/**
* @param submitType the submitType to set
*/
public void setSubmitType(String submitType) {
this.submitType = submitType;
}
/**
* @return the submitKey
*/
public String getSubmitKey() {
return submitKey;
}
/**
* @param submitKey the submitKey to set
*/
public void setSubmitKey(String submitKey) {
this.submitKey = submitKey;
}
/**
* @return the appUser
*/
public Accounts getAppUser() {
return appUser;
}
/**
* @param appUser the appUser to set
*/
public void setAppUser(Accounts appUser) {
this.appUser = appUser;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AppsDesktopDetails [programPath=");
builder.append(programPath);
builder.append(", parameter=");
builder.append(parameter);
builder.append(", preUsername=");
builder.append(preUsername);
builder.append(", usernameType=");
builder.append(usernameType);
builder.append(", usernameParameter=");
builder.append(usernameParameter);
builder.append(", prePassword=");
builder.append(prePassword);
builder.append(", passwordType=");
builder.append(passwordType);
builder.append(", passwordParameter=");
builder.append(passwordParameter);
builder.append(", preSubmit=");
builder.append(preSubmit);
builder.append(", submitType=");
builder.append(submitType);
builder.append(", submitKey=");
builder.append(submitKey);
builder.append(", appUser=");
builder.append(appUser);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,33 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package org.maxkey.persistence.mapper;
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
import org.maxkey.domain.apps.AppsDesktopDetails;
/**
* @author Crystal.sea
*
*/
public interface AppsDesktopDetailsMapper extends IJpaBaseMapper<AppsDesktopDetails> {
public AppsDesktopDetails getAppDetails(String id);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.persistence.service;
import org.apache.mybatis.jpa.persistence.JpaBaseService;
import org.maxkey.domain.apps.AppsDesktopDetails;
import org.maxkey.persistence.mapper.AppsDesktopDetailsMapper;
import org.springframework.stereotype.Repository;
@Repository
public class AppsDesktopDetailsService extends JpaBaseService<AppsDesktopDetails>{
public AppsDesktopDetailsService() {
super(AppsDesktopDetailsMapper.class);
}
/* (non-Javadoc)
* @see com.connsec.db.service.BaseService#getMapper()
*/
@Override
public AppsDesktopDetailsMapper getMapper() {
// TODO Auto-generated method stub
return (AppsDesktopDetailsMapper)super.getMapper();
}
public AppsDesktopDetails getAppDetails(String id) {
return getMapper().getAppDetails(id);
}
}

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsDesktopDetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsDesktopDetails">
SELECT
*
FROM
MXK_APPS_DESKTOP_DETAILS DD,
MXK_APPS APP
WHERE
APP.ID = #{value}
AND DD.ID = #{value}
AND DD.ID = APP.ID
AND STATUS = 1
</select>
</mapper>

View File

@ -1,15 +0,0 @@
description = "maxkey-protocol-desktop"
dependencies {
//local jars
compile fileTree(dir: '../maxkey-lib/*/', include: '*.jar')
compile project(":maxkey-common")
compile project(":maxkey-core")
compile project(":maxkey-persistence")
compile project(":maxkey-protocols:maxkey-protocol-authorize")
compile project(":maxkey-authentications:maxkey-authentication-core")
}

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -1,100 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package org.maxkey.authz.desktop.endpoint;
import javax.servlet.http.HttpServletRequest;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authz.desktop.endpoint.adapter.DesktopDefaultAdapter;
import org.maxkey.authz.endpoint.AuthorizeBaseEndpoint;
import org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.maxkey.constants.Boolean;
import org.maxkey.domain.Accounts;
import org.maxkey.domain.apps.AppsDesktopDetails;
import org.maxkey.persistence.service.AppsDesktopDetailsService;
import org.maxkey.util.Instance;
import org.maxkey.web.WebContext;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @author Crystal.Sea
*
*/
@Api(tags = "Desktop接口文档模块")
@Controller
public class DesktopAuthorizeEndpoint extends AuthorizeBaseEndpoint{
final static Logger _logger = LoggerFactory.getLogger(DesktopAuthorizeEndpoint.class);
@Autowired
AppsDesktopDetailsService desktopDetailsService;
DesktopDefaultAdapter defaultDesktopAdapter=new DesktopDefaultAdapter();
@ApiOperation(value = "Desktop认证接口", notes = "传递参数应用ID",httpMethod="GET")
@RequestMapping("/authz/desktop/{id}")
public ModelAndView authorize(
HttpServletRequest request,
@PathVariable("id") String id){
AppsDesktopDetails desktopDetails=desktopDetailsService.getAppDetails(id);
_logger.debug(""+desktopDetails);
Accounts appUser=getAccounts(desktopDetails);
if(appUser == null){
return generateInitCredentialModelAndView(id,"/authorize/desktop/"+id);
}else{
desktopDetails.setAppUser(appUser);
ModelAndView modelAndView=new ModelAndView();
AbstractAuthorizeAdapter adapter;
if(Boolean.isTrue(desktopDetails.getIsAdapter())){
adapter =(AbstractAuthorizeAdapter)Instance.newInstance(desktopDetails.getAdapter());
}else{
adapter =(AbstractAuthorizeAdapter)defaultDesktopAdapter;
}
String paramString=adapter.generateInfo(
(SigninPrincipal)WebContext.getAuthentication().getPrincipal(),
WebContext.getUserInfo(), desktopDetails);
String encryptParamString=adapter.encrypt(paramString, null, null);
String signParamString=adapter.sign(encryptParamString, desktopDetails);
modelAndView=adapter.authorize(
WebContext.getUserInfo(),
desktopDetails,
signParamString,
modelAndView);
return modelAndView;
}
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.authz.desktop.endpoint.adapter;
import java.util.HashMap;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.maxkey.crypto.HexUtils;
import org.maxkey.domain.UserInfo;
import org.maxkey.domain.apps.Apps;
import org.maxkey.domain.apps.AppsDesktopDetails;
import org.maxkey.util.JsonUtils;
import org.maxkey.util.StringGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
public class DesktopDefaultAdapter extends AbstractAuthorizeAdapter {
final static Logger _logger = LoggerFactory.getLogger(DesktopDefaultAdapter.class);
@Override
public String generateInfo(SigninPrincipal authentication,UserInfo userInfo,Object app) {
AppsDesktopDetails details=(AppsDesktopDetails)app;
String parameter=details.getParameter()==null?"":details.getParameter();
if(details.getUsernameType().equalsIgnoreCase(AppsDesktopDetails.ParameterType.PARAMETER)){
parameter = parameter+ " "+details.getUsernameParameter();
parameter = parameter+ " "+ details.getAppUser().getRelatedUsername();
}
if(details.getPasswordType().equalsIgnoreCase(AppsDesktopDetails.ParameterType.PARAMETER)){
parameter = parameter+ " "+details.getPasswordParameter();
parameter = parameter+ " "+ details.getAppUser().getRelatedPassword();
}
HashMap<String,String> beanMap=new HashMap<String,String>();
beanMap.put("randomId",(new StringGenerator()).uuidGenerate());
beanMap.put("programPath", details.getProgramPath());
beanMap.put("parameter", details.getParameter());
beanMap.put("preUsername", details.getPreUsername());
beanMap.put("usernameType", details.getUsernameType());
beanMap.put("usernameParameter", details.getUsernameParameter());
beanMap.put("username", details.getAppUser().getRelatedUsername());
beanMap.put("prePassword", details.getPrePassword());
beanMap.put("passwordType", details.getPasswordType());
beanMap.put("passwordParameter", details.getPasswordParameter());
beanMap.put("password", details.getAppUser().getRelatedPassword());
beanMap.put("preSubmit", details.getPreSubmit());
beanMap.put("submitType", details.getSubmitType());
beanMap.put("submitKey", details.getSubmitKey());
String jsonString=JsonUtils.object2Json(beanMap);
_logger.debug("Token : "+jsonString);
return jsonString;
}
@Override
public String encrypt(String data, String algorithmKey, String algorithm) {
_logger.debug("Parameter String : "+data);
String encoderParamString=HexUtils.bytes2HexString(data.getBytes());
return encoderParamString;
}
/* (non-Javadoc)
* @see com.connsec.web.authorize.endpoint.adapter.AbstractAuthorizeAdapter#sign(java.lang.String, com.connsec.domain.apps.Applications)
*/
@Override
public String sign(String data, Apps app) {
String signData=super.sign(data, app);
return signData;
}
@Override
public ModelAndView authorize(UserInfo userInfo, Object app, String data,ModelAndView modelAndView) {
modelAndView.setViewName("authorize/desktop_sso_execute");
AppsDesktopDetails details=(AppsDesktopDetails)app;
modelAndView.addObject("username", details.getAppUser().getRelatedUsername());
modelAndView.addObject("password", details.getAppUser().getRelatedPassword());
modelAndView.addObject("encoderParam", data);
return modelAndView;
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.authz.desktop.endpoint.adapter;
import java.util.HashMap;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.maxkey.crypto.HexUtils;
import org.maxkey.domain.UserInfo;
import org.maxkey.domain.apps.Apps;
import org.maxkey.domain.apps.AppsDesktopDetails;
import org.maxkey.util.JsonUtils;
import org.maxkey.util.StringGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
public class DesktopQQAdapter extends AbstractAuthorizeAdapter {
final static Logger _logger = LoggerFactory.getLogger(DesktopQQAdapter.class);
@Override
public String generateInfo(SigninPrincipal authentication,UserInfo userInfo,Object app) {
AppsDesktopDetails details=(AppsDesktopDetails)app;
String parameter=details.getParameter()==null?"":details.getParameter();
if(details.getUsernameType().equalsIgnoreCase(AppsDesktopDetails.ParameterType.PARAMETER)){
parameter = parameter+ " "+details.getUsernameParameter();
parameter = parameter+ " "+ details.getAppUser().getRelatedUsername();
}
if(details.getPasswordType().equalsIgnoreCase(AppsDesktopDetails.ParameterType.PARAMETER)){
parameter = parameter+ " "+details.getPasswordParameter();
parameter = parameter+ " "+ details.getAppUser().getRelatedPassword();
}
HashMap<String,String> beanMap=new HashMap<String,String>();
beanMap.put("randomId",(new StringGenerator()).uuidGenerate());
beanMap.put("programPath", details.getProgramPath());
beanMap.put("parameter", details.getParameter());
beanMap.put("preUsername", details.getPreUsername());
beanMap.put("usernameType", details.getUsernameType());
beanMap.put("usernameParameter", details.getUsernameParameter());
beanMap.put("username", details.getAppUser().getRelatedUsername());
beanMap.put("prePassword", details.getPrePassword());
beanMap.put("passwordType", details.getPasswordType());
beanMap.put("passwordParameter", details.getPasswordParameter());
beanMap.put("password", details.getAppUser().getRelatedPassword());
beanMap.put("preSubmit", details.getPreSubmit());
beanMap.put("submitType", details.getSubmitType());
beanMap.put("submitKey", details.getSubmitKey());
String jsonString=JsonUtils.object2Json(beanMap);
_logger.debug("Token : "+jsonString);
return jsonString;
}
@Override
public String encrypt(String data, String algorithmKey, String algorithm) {
_logger.debug("Parameter String : "+data);
String encoderParamString=HexUtils.bytes2HexString(data.getBytes());
return encoderParamString;
}
/* (non-Javadoc)
* @see com.connsec.web.authorize.endpoint.adapter.AbstractAuthorizeAdapter#sign(java.lang.String, com.connsec.domain.apps.Applications)
*/
@Override
public String sign(String data, Apps app) {
String signData=super.sign(data, app);
return signData;
}
@Override
public ModelAndView authorize(UserInfo userInfo, Object app, String data,ModelAndView modelAndView) {
modelAndView.setViewName("authorize/desktop_qq_sso_execute");
AppsDesktopDetails details=(AppsDesktopDetails)app;
modelAndView.addObject("username", details.getAppUser().getRelatedUsername());
modelAndView.addObject("password", details.getAppUser().getRelatedPassword());
modelAndView.addObject("encoderParam", data);
return modelAndView;
}
}

View File

@ -1,123 +0,0 @@
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.apps.contorller;
import java.util.List;
import org.maxkey.constants.ConstantsOperateMessage;
import org.maxkey.constants.ConstantsProtocols;
import org.maxkey.crypto.ReciprocalUtils;
import org.maxkey.domain.apps.AppsDesktopDetails;
import org.maxkey.persistence.service.AppsDesktopDetailsService;
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/desktop"})
public class DesktopDetailsController extends BaseAppContorller {
final static Logger _logger = LoggerFactory.getLogger(DesktopDetailsController.class);
@Autowired
AppsDesktopDetailsService desktopDetailsService;
@RequestMapping(value = { "/forwardAdd" })
public ModelAndView forwardAdd() {
ModelAndView modelAndView=new ModelAndView("apps/desktop/appAdd");
AppsDesktopDetails desktopDetails=new AppsDesktopDetails();
desktopDetails.setId(desktopDetails.generateId());
desktopDetails.setProtocol(ConstantsProtocols.DESKTOP);
desktopDetails.setSecret(ReciprocalUtils.generateKey(""));
modelAndView.addObject("model",desktopDetails);
return modelAndView;
}
@RequestMapping(value={"/add"})
public ModelAndView insert(@ModelAttribute("desktopDetails") AppsDesktopDetails desktopDetails) {
_logger.debug("-Add :" + desktopDetails);
transform(desktopDetails);
desktopDetailsService.insert(desktopDetails);
if (appsService.insertApp(desktopDetails)) {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success);
} else {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.error);
}
return WebContext.forward("forwardUpdate/"+desktopDetails.getId());
}
@RequestMapping(value = { "/forwardUpdate/{id}" })
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
ModelAndView modelAndView=new ModelAndView("apps/desktop/appUpdate");
AppsDesktopDetails desktopDetails=desktopDetailsService.getAppDetails(id);
decoderSecret(desktopDetails);
decoderSharedPassword(desktopDetails);
WebContext.setAttribute(desktopDetails.getId(), desktopDetails.getIcon());
modelAndView.addObject("model",desktopDetails);
return modelAndView;
}
/**
* modify
* @param application
* @return
*/
@RequestMapping(value={"/update"})
public ModelAndView update(@ModelAttribute("desktopDetails") AppsDesktopDetails desktopDetails) {
//
_logger.debug("-update application :" + desktopDetails);
transform(desktopDetails);
if (desktopDetailsService.update(desktopDetails)&&appsService.updateApp(desktopDetails)) {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_SUCCESS),MessageType.success);
} else {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_ERROR),MessageType.error);
}
return WebContext.forward("forwardUpdate/"+desktopDetails.getId());
}
@ResponseBody
@RequestMapping(value={"/delete/{id}"})
public Message delete(@PathVariable("id") String id) {
_logger.debug("-delete application :" + id);
if (desktopDetailsService.remove(id)&&appsService.remove(id)) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.error);
}
}
}

View File

@ -2,7 +2,7 @@
#application
application.title=MaxKey
application.name=MaxKey-Mgt
application.formatted-version=v2.6.0 GA
application.formatted-version=v2.7.0 GA
#server config
#server port
server.port=9527

View File

@ -23,7 +23,6 @@
protocolArray["Extend_API"]="extendapi";
protocolArray["CAS"]="cas";
protocolArray["Basic"]="basic";
protocolArray["Desktop"]="desktop";
protocolArray["JWT"]="jwt";
$(function () {
@ -140,7 +139,6 @@
<a class="dropdown-item" target="_blank" href="<@base/>/apps/jwt/forwardAdd">&nbsp;&nbsp;<@locale code="apps.protocol.jwt" /></a>
<a class="dropdown-item" target="_blank" href="<@base/>/apps/tokenbased/forwardAdd">&nbsp;&nbsp;<@locale code="apps.protocol.tokenbased" /></a>
<a class="dropdown-item" target="_blank" href="<@base/>/apps/extendapi/forwardAdd">&nbsp;&nbsp;<@locale code="apps.protocol.extendapi" /></a>
<a class="dropdown-item" target="_blank" href="<@base/>/apps/desktop/forwardAdd">&nbsp;&nbsp;<@locale code="apps.protocol.desktop" /></a>
<a class="dropdown-item" target="_blank" href="<@base/>/apps/basic/forwardAdd">&nbsp;&nbsp;<@locale code="apps.protocol.basic" /></a>
</div>
</div>

View File

@ -1,215 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "../../layout/header.ftl"/>
<#include "../../layout/common.cssjs.ftl"/>
<#include "../appCommonHead.ftl"/>
<script type="text/javascript">
<!--
$(function(){
$("#usernameType").change(function(){
if($(this).val()=="SIMULATION"){
$(".usernameParameter").hide();
$(".preUsername").show();
}else{
$(".usernameParameter").show();
$(".preUsername").hide();
}
});
$("#passwordType").change(function(){
if($(this).val()=="SIMULATION"){
$(".passwordParameter").hide();
$(".prePassword").show();
}else{
$(".passwordParameter").show();
$(".prePassword").hide();
}
});
$("#submitType").change(function(){
if($(this).val()=="Enter"){
$("#submitKey").hide();
$(".preSubmit").show();
$(".preSubmit").show();
}else if($(this).val()=="Key"){
$("#submitKey").show();
$(".preSubmit").show();
$(".preSubmit").show();
}else{
$("#submitKey").hide();
$(".preSubmit").hide();
$(".preSubmit").hide();
}
});
$(".credential").on("click",function(){
if($(this).val()=="3"){
$("#sharedconfigure").hide();
$("#systemconfigure").hide();
}else if($(this).val()=="1"){
$("#sharedconfigure").hide();
$("#systemconfigure").show();
}else if($(this).val()=="2"){
$("#sharedconfigure").show();
$("#systemconfigure").hide();
}
});
});
//-->
</script>
</head>
<body>
<form id="actionForm_app" method="post" type="label" autoclose="true" closeWindow="true"
action="<@base/>/apps/desktop/add"
forward="<@base/>/apps/list"
enctype="multipart/form-data"
class="needs-validation" novalidate>
<!-- content -->
<!--table-->
<table width="960" class="table table-bordered" >
<tbody>
<tr>
<td ><#include "../appAddCommon.ftl"/></td>
</tr>
<tr>
<td>
<table width="960" class="table table-bordered" >
<tbody>
<tr>
<td colspan=4><@locale code="apps.desktop.info" /></td>
</tr>
<tr>
<th ><@locale code="apps.desktop.programPath" /></th>
<td colspan="3">
<textarea id="programPath" name="programPath" rows="4" cols="60" class="form-control" required="" ></textarea>
<b class="orange">*</b><label for="programPath"></label>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.parameter" /></th>
<td colspan="3">
<textarea id="parameter" name="parameter" rows="4" cols="60" class="form-control" ></textarea>
<b class="orange">*</b><label for="parameter"></label>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.usernameType" /></th>
<td >
<select id="usernameType" name="usernameType" class="form-control" >
<option value="SIMULATION" selected>SIMULATION</option>
<option value="PARAMETER">PARAMETER</option>
</select>
<b class="orange">*</b><label for="usernameType"></label>
</td>
<th class="usernameParameter" style="display:none"><@locale code="apps.desktop.usernameParameter" /></th>
<td class="usernameParameter" style="display:none">
<input type="text" id="usernameParameter" name="usernameParameter" title="" value="username" class="form-control" />
<b class="orange">*</b><label for="usernameParameter"></label>
</td>
<th class="preUsername"><@locale code="apps.desktop.preUsername" /></th>
<td class="preUsername">
<input type="text" id="preUsername" name="preUsername" title="" value="" class="form-control" />
<b class="orange">*</b><label for="preUsername"></label>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.passwordType" /></th>
<td >
<select id="passwordType" name="passwordType" class="form-control" >
<option value="SIMULATION" selected>SIMULATION</option>
<option value="PARAMETER">PARAMETER</option>
</select>
<b class="orange">*</b><label for="passwordType"></label>
</td>
<th class="passwordParameter" style="display:none"><@locale code="apps.desktop.passwordParameter" /></th>
<td class="passwordParameter" style="display:none">
<input type="text" id="passwordParameter" name="passwordParameter" title="" value="password" class="form-control" />
<b class="orange">*</b><label for="passwordParameter"></label>
</td>
<th class="prePassword" ><@locale code="apps.desktop.prePassword" /></th>
<td class="prePassword" >
<input type="text" id="prePassword" name="prePassword" title="" value="" class="form-control" />
<b class="orange">*</b><label for="prePassword"></label>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.submitType" /></th>
<td >
<select id="submitType" name="submitType" class="form-control" >
<option value="Enter" selected>Enter</option>
<option value="Key">Key</option>
<option value="None">None</option>
</select>
<input style="display:none" type="text" id="submitKey" class="form-control" name="submitKey" size="3" title="" value=""/>
<b class="orange">*</b><label for="submitType"></label>
</td>
<th class="preSubmit"><@locale code="apps.desktop.preSubmit" /></th>
<td class="preSubmit">
<input type="text" id="preSubmit" name="preSubmit" class="form-control" title="" value=""/>
<b class="orange">*</b><label for="preSubmit"></label>
</td>
</tr>
<tr>
<th style="width:15%;"><@locale code="apps.credential" /></th>
<td style="width:35%;">
<input type="radio" id="credential-user-defined" name="credential" class="credential form-control" value="3" checked style="float:left;width: 30px;"/>
<@locale code="apps.credential.user-defined" />
<input type="radio" id="credential-shared" name="credential" class="credential form-control" value="2" style="float:left;width: 30px;"/>
<@locale code="apps.credential.shared" />
<input type="radio" id="credential-system" name="credential" class="credential form-control" value="1" style="float:left;width: 30px;" />
<@locale code="apps.credential.system" />
<b class="orange">*</b><label for="credential"></label>
</td>
<th style="width:15%;"></th>
<td style="width:35%;" >
</td>
</tr>
>
</tr>
<tr id="systemconfigure" style="display:none">
<th><@locale code="apps.credential" /></th>
<td colspan="3">
<select id="systemUserAttr" name="systemUserAttr" class="form-control" >
<option value="uid"><@locale code="userinfo.id" /></option>
<option value="employeeNumber"><@locale code="userinfo.employeeNumber" /></option>
<option value="username" selected><@locale code="userinfo.username" /></option>
<option value="email"><@locale code="userinfo.email" /></option>
<option value="windowsaccount"><@locale code="userinfo.windowsAccount" /></option>
</select>
<b class="orange">*</b><label for="systemUserAttr"></label>
</td>
</tr>
<tr id="sharedconfigure" style="display:none">
<th><@locale code="apps.credential.sharedUsername" /></th>
<td >
<input type="text" id="sharedUsername" name="sharedUsername" value="" class="form-control" />
<b class="orange">*</b><label for="sharedUsername"></label>
</td>
<th ><@locale code="apps.credential.sharedPassword" /></th>
<td >
<input type="text" id="sharedPassword" name="sharedPassword" value="" class="form-control" />
<b class="orange">*</b><label for="sharedPassword"></label>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<input id="status" type="hidden" name="status" value="1"/>
<input class="button btn btn-primary mr-3" id="submitBtn" type="submit" value="<@locale code="button.text.save" />"/>
<input class="button btn btn-secondary mr-3" id="backBtn" type="button" value="<@locale code="button.text.cancel" />"/>
</form>
</body>
</html>

View File

@ -1,219 +0,0 @@
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "../../layout/header.ftl"/>
<#include "../../layout/common.cssjs.ftl"/>
<#include "../appCommonHead.ftl"/>
<script type="text/javascript">
<!--
$(function(){
$("#usernameType").change(function(){
if($(this).val()=="SIMULATION"){
$(".usernameParameter").hide();
$(".preUsername").show();
}else{
$(".usernameParameter").show();
$(".preUsername").hide();
}
});
$("#passwordType").change(function(){
if($(this).val()=="SIMULATION"){
$(".passwordParameter").hide();
$(".prePassword").show();
}else{
$(".passwordParameter").show();
$(".prePassword").hide();
}
});
$("#submitType").change(function(){
if($(this).val()=="Enter"){
$("#submitKey").hide();
$(".preSubmit").show();
$(".preSubmit").show();
}else if($(this).val()=="Key"){
$("#submitKey").show();
$(".preSubmit").show();
$(".preSubmit").show();
}else{
$("#submitKey").hide();
$(".preSubmit").hide();
$(".preSubmit").hide();
}
});
$(".credential").on("click",function(){
if($(this).val()=="3"){
$("#sharedconfigure").hide();
$("#systemconfigure").hide();
}else if($(this).val()=="1"){
$("#sharedconfigure").hide();
$("#systemconfigure").show();
}else if($(this).val()=="2"){
$("#sharedconfigure").show();
$("#systemconfigure").hide();
}
});
});
//-->
</script>
</head>
<body>
<form id="actionForm_app" method="post" type="label" autoclose="true" closeWindow="true"
action="<@base/>/apps/desktop/update"
forward="<@base/>/apps/list"
enctype="multipart/form-data"
class="needs-validation" novalidate>
<!-- content -->
<!--table-->
<table class="table table-bordered" >
<tbody>
<tr>
<td ><#include "../appUpdateCommon.ftl"/></td>
</tr>
<tr>
<td>
<table class="table table-bordered" >
<tbody>
<tr>
<td colspan=4><@locale code="apps.desktop.info" /></td>
</tr>
<tr>
<th><@locale code="apps.desktop.programPath" /></th>
<td colspan="3">
<textarea class="form-control" id="programPath" name="programPath" rows="4" cols="60" required="" >${model.programPath}</textarea>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.parameter" /></th>
<td colspan="3">
<textarea class="form-control" id="parameter" name="parameter" rows="4" cols="60">${model.parameter}</textarea>
</td>
</tr>
<tr>
<th ><@locale code="apps.desktop.usernameType" /></th>
<td >
<select id="usernameType" name="usernameType" class="form-control">
<option value="SIMULATION" <#if 'SIMULATION'==model.usernameType>selected</#if> >SIMULATION</option>
<option value="PARAMETER" <#if 'PARAMETER'==model.usernameType>selected</#if> >PARAMETER</option>
</select>
</td>
<th class="usernameParameter" <#if 'SIMULATION'==model.usernameType>style="display:none"</#if> >
<@locale code="apps.desktop.usernameParameter" /></th>
<td class="usernameParameter" <#if 'SIMULATION'==model.usernameType>style="display:none"</#if> >
<input type="text" class="form-control" id="usernameParameter" name="usernameParameter" title="" value="${model.usernameParameter}" />
</td>
<th class="preUsername" <#if 'PARAMETER'==model.usernameType>style="display:none"</#if> >
<@locale code="apps.desktop.preUsername" /></th>
<td class="preUsername" <#if 'PARAMETER'==model.usernameType>style="display:none"</#if> >
<input type="text" class="form-control" id="preUsername" name="preUsername" title="" value="${model.preUsername}"/>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.passwordType" /></th>
<td >
<select id="passwordType" name="passwordType" class="form-control">
<option value="SIMULATION" <#if 'SIMULATION'==model.passwordType>selected</#if> >SIMULATION</option>
<option value="PARAMETER" <#if 'PARAMETER'==model.passwordType>selected</#if> >PARAMETER</option>
</select>
</td>
<th class="passwordParameter" <#if 'SIMULATION'==model.passwordType>style="display:none"</#if> >
<@locale code="apps.desktop.passwordParameter" /></th>
<td class="passwordParameter" <#if 'SIMULATION'==model.passwordType>style="display:none"</#if> >
<input type="text" class="form-control" id="passwordParameter" name="passwordParameter" title="" value="${model.passwordParameter}" />
</td>
<th class="prePassword" <#if 'PARAMETER'==model.passwordType>style="display:none"</#if> >
<@locale code="apps.desktop.prePassword" /></th>
<td class="prePassword" <#if 'PARAMETER'==model.passwordType>style="display:none"</#if> >
<input type="text" class="form-control" id="prePassword" name="prePassword" title="" value="${model.prePassword}"/>
</td>
</tr>
<tr>
<th><@locale code="apps.desktop.submitType" /></th>
<td >
<select id="submitType" name="submitType" class="form-control">
<option value="Enter" <#if 'Enter'==model.submitType>selected</#if> >Enter</option>
<option value="Key" <#if 'Key'==model.submitType>selected</#if> >Key</option>
<option value="None" <#if 'None'==model.submitType>selected</#if> >None</option>
</select>
<input <#if 'Key'!=model.submitType>style="display:none"</#if> type="text" id="submitKey" name="submitKey" size="3" title="" value="${model.submitKey}"/>
</td>
<th class="preSubmit" <#if 'None'==model.submitType>style="display:none"</#if> >
<@locale code="apps.desktop.preSubmit" /></th>
<td class="preSubmit" <#if 'None'==model.submitType>style="display:none"</#if> >
<input type="text" class="form-control" id="preSubmit" name="preSubmit" title="" value="${model.preSubmit}"/>
</td>
</tr>
<tr>
<th style="width:15%;"><@locale code="apps.credential" /></th>
<td style="width:35%;">
<input type="radio" id="credential-user-defined" name="credential" class="credential" value="3" <#if 3==model.credential>checked</#if> />
<@locale code="apps.credential.user-defined" />
<input type="radio" id="credential-shared" name="credential" class="credential" value="2" <#if 2==model.credential>checked</#if> />
<@locale code="apps.credential.shared" />
<input type="radio" id="credential-system" name="credential" class="credential" value="1" <#if 1==model.credential>checked</#if> />
<@locale code="apps.credential.system" />
</td>
<th style="width:15%;"></th>
<td style="width:35%;">
</td>
</tr>
<tr id="systemconfigure" <#if 1!=model.credential> style="display:none"</#if> >
<th><@locale code="apps.credential.system" /></th>
<td colspan="3">
<select id="systemUserAttr" name="systemUserAttr" class="form-control">
<option value="uid" <#if 'uid'==model.systemUserAttr>selected</#if> ><@locale code="userinfo.id" /></option>
<option value="employeeNumber" <#if 'employeeNumber'==model.systemUserAttr>selected</#if> ><@locale code="userinfo.employeeNumber" /></option>
<option value="username" <#if 'username'==model.systemUserAttr>selected</#if> ><@locale code="userinfo.username" /></option>
<option value="email" <#if 'email'==model.systemUserAttr>selected</#if> ><@locale code="userinfo.email" /></option>
<option value="windowsaccount" <#if 'windowsaccount'==model.systemUserAttr>selected</#if> ><@locale code="userinfo.windowsAccount" /></option>
</select>
</td>
</tr>
<tr id="sharedconfigure" <#if 2!=model.credential> style="display:none"</#if>>
<th><@locale code="apps.credential.sharedUsername" /></th>
<td>
<input type="text" class="form-control" id="sharedUsername" name="sharedUsername" value="${model.sharedUsername}" />
</td>
<th ><@locale code="apps.credential.sharedPassword" /></th>
<td>
<input type="text" class="form-control" id="sharedPassword" name="sharedPassword" value="${model.sharedPassword}" />
</td>
</tr>
</tbody>
<tbody >
<tr>
<td colspan =4>
<input class="button btn btn-primary mr-3" id="submitBtn" type="submit" value="<@locale code="button.text.save" />"/>
<input class="button btn btn-secondary mr-3" id="backBtn" type="button" value="<@locale code="button.text.cancel" />"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>

View File

@ -15,7 +15,6 @@ dependencies {
compile project(":maxkey-protocols:maxkey-protocol-authorize")
compile project(":maxkey-protocols:maxkey-protocol-cas")
compile project(":maxkey-protocols:maxkey-protocol-desktop")
compile project(":maxkey-protocols:maxkey-protocol-extendapi")
compile project(":maxkey-protocols:maxkey-protocol-formbased")
compile project(":maxkey-protocols:maxkey-protocol-tokenbased")

View File

@ -27,7 +27,7 @@ include 'maxkey-protocols:maxkey-protocol-jwt'
include 'maxkey-protocols:maxkey-protocol-formbased'
include 'maxkey-protocols:maxkey-protocol-tokenbased'
include 'maxkey-protocols:maxkey-protocol-extendapi'
include 'maxkey-protocols:maxkey-protocol-desktop'
//include 'maxkey-webs'
//maxkey