移除未完善的LDAP,数据源支持MySQL8
This commit is contained in:
14
pom.xml
14
pom.xml
@@ -59,15 +59,10 @@
|
|||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
|
||||||
<version>${spring.boot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>5.1.47</version>
|
<version>8.0.32</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sourceforge.jtds</groupId>
|
<groupId>net.sourceforge.jtds</groupId>
|
||||||
@@ -115,11 +110,6 @@
|
|||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.12.0</version>
|
<version>3.12.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis</artifactId>
|
|
||||||
<version>3.5.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
@@ -128,7 +118,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>3.4.3.2</version>
|
<version>3.5.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
|
|||||||
@@ -35,10 +35,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zyplayer</groupId>
|
<groupId>com.zyplayer</groupId>
|
||||||
<artifactId>zyplayer-doc-core</artifactId>
|
<artifactId>zyplayer-doc-core</artifactId>
|
||||||
|
|||||||
@@ -33,10 +33,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zyplayer</groupId>
|
<groupId>com.zyplayer</groupId>
|
||||||
<artifactId>zyplayer-doc-core</artifactId>
|
<artifactId>zyplayer-doc-core</artifactId>
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.ldap.core.LdapTemplate;
|
|
||||||
import org.springframework.ldap.query.LdapQueryBuilder;
|
|
||||||
import org.springframework.util.DigestUtils;
|
import org.springframework.util.DigestUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -40,8 +38,6 @@ public class LoginController {
|
|||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
@Resource
|
@Resource
|
||||||
private UserAuthService userAuthService;
|
private UserAuthService userAuthService;
|
||||||
@Resource
|
|
||||||
private LdapTemplate ldapTemplate;
|
|
||||||
|
|
||||||
@Value("${spring.ldap.enable:false}")
|
@Value("${spring.ldap.enable:false}")
|
||||||
private boolean ldapLoginEnable;
|
private boolean ldapLoginEnable;
|
||||||
@@ -119,15 +115,7 @@ public class LoginController {
|
|||||||
* 参考项目:https://gitee.com/durcframework/torna,方法:cn.torna.service.login.form.impl.LdapLoginManager#ldapAuth
|
* 参考项目:https://gitee.com/durcframework/torna,方法:cn.torna.service.login.form.impl.LdapLoginManager#ldapAuth
|
||||||
*/
|
*/
|
||||||
public LdapPerson getUserFromLdap(String username, String password) {
|
public LdapPerson getUserFromLdap(String username, String password) {
|
||||||
try {
|
// TODO 暂未实现
|
||||||
return ldapTemplate.authenticate(
|
|
||||||
LdapQueryBuilder.query().where("uid").is(username),
|
|
||||||
password,
|
|
||||||
(dirContext, ldapEntryIdentification) ->
|
|
||||||
ldapTemplate.findOne(LdapQueryBuilder.query().where("uid").is(username), LdapPerson.class));
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("LDAP登录失败", e);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.zyplayer.doc.manage.web.param;
|
package com.zyplayer.doc.manage.web.param;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
import org.springframework.ldap.odm.annotations.Attribute;
|
|
||||||
import org.springframework.ldap.odm.annotations.DnAttribute;
|
|
||||||
import org.springframework.ldap.odm.annotations.Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 域账号用户信息
|
* 域账号用户信息
|
||||||
@@ -13,25 +10,20 @@ import org.springframework.ldap.odm.annotations.Entry;
|
|||||||
* @since 2021年8月2日
|
* @since 2021年8月2日
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Entry(objectClasses = "inetOrgPerson")
|
|
||||||
public class LdapPerson {
|
public class LdapPerson {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
@DnAttribute(value = "uid")
|
|
||||||
private String uid;
|
private String uid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
@Attribute(name = "displayName")
|
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Attribute(name = "mail")
|
|
||||||
private String mail;
|
private String mail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ zyplayer:
|
|||||||
originDomainRegex: .*\.zyplayer\.com(:\d+|)$
|
originDomainRegex: .*\.zyplayer\.com(:\d+|)$
|
||||||
# 管理端的数据库配置
|
# 管理端的数据库配置
|
||||||
datasource:
|
datasource:
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
@@ -54,10 +54,3 @@ spring:
|
|||||||
max-request-size: 100MB
|
max-request-size: 100MB
|
||||||
datasource:
|
datasource:
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
# 域账号登录,暂未严格测试
|
|
||||||
ldap:
|
|
||||||
enable: false
|
|
||||||
urls: ldap://10.0.1.1:10389
|
|
||||||
base: dc=xx,dc=net
|
|
||||||
username: cn=Manager,dc=xx,dc=net
|
|
||||||
password: MKDSHYDNIS
|
|
||||||
|
|||||||
Reference in New Issue
Block a user