mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
Merge branch 'main' of https://gitee.com/dromara/MaxKey
This commit is contained in:
@@ -103,9 +103,9 @@ maxkey.notices.visible =false
|
||||
spring.datasource.type =com.alibaba.druid.pool.DruidDataSource
|
||||
#mysql
|
||||
spring.datasource.driver-class-name =com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username =${DATABASE_USER:root}
|
||||
spring.datasource.password =${DATABASE_PWD:maxkey}
|
||||
spring.datasource.url =jdbc:mysql://${DATABASE_HOST:localhost}:${DATABASE_PORT:3306}/${DATABASE_NAME:maxkey}?autoReconnect=true&characterEncoding=UTF-8&serverTimezone=UTC
|
||||
spring.datasource.username =root
|
||||
spring.datasource.password =root
|
||||
spring.datasource.url =jdbc:mysql://127.0.0.1:3306/maxkey?useSSL=false&serverTimezone=UTC
|
||||
#highgo
|
||||
#spring.datasource.driver-class-name=com.highgo.jdbc.Driver
|
||||
#spring.datasource.username=highgo
|
||||
|
||||
@@ -25,6 +25,8 @@ import org.dromara.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
import org.dromara.maxkey.persistence.repository.LoginRepository;
|
||||
import org.dromara.maxkey.persistence.repository.PasswordPolicyValidator;
|
||||
import org.dromara.maxkey.persistence.service.UserInfoService;
|
||||
import org.dromara.maxkey.synchronizer.ISynchronizerService;
|
||||
import org.dromara.maxkey.synchronizer.ldap.LdapSynchronizerService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -69,4 +71,12 @@ public class MaxKeyMgtConfig {
|
||||
return tfaOtpAuthn;
|
||||
}
|
||||
|
||||
/*@Bean
|
||||
public ISynchronizerService ldapSynchronizerService() {
|
||||
LdapSynchronizerService ldapSynchronizerService = new LdapSynchronizerService();
|
||||
ldapSynchronizerService.setId("LDAP_11122");
|
||||
ldapSynchronizerService.syncOrg();
|
||||
return ldapSynchronizerService;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ package org.dromara.maxkey.web.config.contorller;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.maxkey.authn.annotation.CurrentUser;
|
||||
import org.dromara.maxkey.crypto.password.PasswordReciprocal;
|
||||
import org.dromara.maxkey.entity.*;
|
||||
import org.dromara.maxkey.persistence.service.SynchronizersService;
|
||||
import org.dromara.maxkey.synchronizer.ISynchronizerService;
|
||||
import org.dromara.maxkey.synchronizer.service.SyncJobConfigFieldService;
|
||||
import org.dromara.maxkey.entity.Connectors;
|
||||
import org.dromara.maxkey.entity.Message;
|
||||
import org.dromara.maxkey.entity.Synchronizers;
|
||||
@@ -30,10 +34,13 @@ import org.dromara.maxkey.util.StrUtils;
|
||||
import org.dromara.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -44,6 +51,9 @@ public class SynchronizersController {
|
||||
@Autowired
|
||||
SynchronizersService synchronizersService;
|
||||
|
||||
@Autowired
|
||||
SyncJobConfigFieldService syncJobConfigFieldService;
|
||||
|
||||
@RequestMapping(value = {"/fetch"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
@ResponseBody
|
||||
public Message<?> fetch(Synchronizers synchronizers, @CurrentUser UserInfo currentUser) {
|
||||
@@ -126,4 +136,53 @@ public class SynchronizersController {
|
||||
return new Message<Synchronizers>(Message.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/mapping-list/{jobId}"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> mapping(@PathVariable Long jobId) {
|
||||
logger.debug("mapping {}", jobId);
|
||||
List<SyncJobConfigField> syncJobConfigFields = syncJobConfigFieldService.findByJobId(jobId);
|
||||
return new Message<>(syncJobConfigFields).buildResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/mapping-get/{id}"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> mappingGet(@PathVariable Long id) {
|
||||
logger.debug("mapping get {}", id);
|
||||
SyncJobConfigField syncJobConfigFields = syncJobConfigFieldService.get(String.valueOf(id));
|
||||
return new Message<>(syncJobConfigFields).buildResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/mapping-delete/{id}"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> mappingDelete(@PathVariable Long id) {
|
||||
logger.debug("mappingDelete {}", id);
|
||||
syncJobConfigFieldService.deleteFieldMapById(id);
|
||||
return new Message<SyncJobConfigField>(Message.SUCCESS).buildResponse();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = {"/mapping-add"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public ResponseEntity<?> mappingadd(@RequestBody SyncJobConfigField syncJobConfigField, @CurrentUser UserInfo currentUser) {
|
||||
logger.debug("-mapping add : {}", syncJobConfigField);
|
||||
syncJobConfigField.setCreateTime(new Date());
|
||||
if (syncJobConfigFieldService.insert(syncJobConfigField)) {
|
||||
return new Message<Synchronizers>(Message.SUCCESS).buildResponse();
|
||||
} else {
|
||||
return new Message<Synchronizers>(Message.FAIL).buildResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PutMapping(value = {"/mapping-update"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public ResponseEntity<?> mappingupdate(@RequestBody SyncJobConfigField syncJobConfigField, @CurrentUser UserInfo currentUser) {
|
||||
logger.debug("-mapping update : {}", syncJobConfigField);
|
||||
syncJobConfigField.setUpdateTime(new Date());
|
||||
if (syncJobConfigFieldService.update(syncJobConfigField)) {
|
||||
return new Message<Synchronizers>(Message.SUCCESS).buildResponse();
|
||||
} else {
|
||||
return new Message<Synchronizers>(Message.FAIL).buildResponse();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ maxkey.login.jwt.issuer =${LOGIN_JWT_ISSUER:${maxkey.ser
|
||||
spring.datasource.type =com.alibaba.druid.pool.DruidDataSource
|
||||
#mysql
|
||||
spring.datasource.driver-class-name =com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username =${DATABASE_USER:root}
|
||||
spring.datasource.password =${DATABASE_PWD:maxkey}
|
||||
spring.datasource.url =jdbc:mysql://${DATABASE_HOST:localhost}:${DATABASE_PORT:3306}/${DATABASE_NAME:maxkey}?autoReconnect=true&characterEncoding=UTF-8&serverTimezone=UTC
|
||||
spring.datasource.username =root
|
||||
spring.datasource.password =root
|
||||
spring.datasource.url =jdbc:mysql://localhost/maxkey?autoReconnect=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false
|
||||
#highgo
|
||||
#spring.datasource.driver-class-name=com.highgo.jdbc.Driver
|
||||
#spring.datasource.username=highgo
|
||||
|
||||
Reference in New Issue
Block a user