移除未完善的LDAP,数据源支持MySQL8
This commit is contained in:
14
pom.xml
14
pom.xml
@@ -59,15 +59,10 @@
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.47</version>
|
||||
<version>8.0.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
@@ -115,11 +110,6 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
@@ -128,7 +118,7 @@
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.3.2</version>
|
||||
<version>3.5.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
|
||||
@@ -14,8 +14,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -40,8 +38,6 @@ public class LoginController {
|
||||
private UserInfoService userInfoService;
|
||||
@Resource
|
||||
private UserAuthService userAuthService;
|
||||
@Resource
|
||||
private LdapTemplate ldapTemplate;
|
||||
|
||||
@Value("${spring.ldap.enable:false}")
|
||||
private boolean ldapLoginEnable;
|
||||
@@ -119,15 +115,7 @@ public class LoginController {
|
||||
* 参考项目:https://gitee.com/durcframework/torna,方法:cn.torna.service.login.form.impl.LdapLoginManager#ldapAuth
|
||||
*/
|
||||
public LdapPerson getUserFromLdap(String username, String password) {
|
||||
try {
|
||||
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);
|
||||
}
|
||||
// TODO 暂未实现
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.zyplayer.doc.manage.web.param;
|
||||
|
||||
import lombok.*;
|
||||
import org.springframework.ldap.odm.annotations.Attribute;
|
||||
import org.springframework.ldap.odm.annotations.DnAttribute;
|
||||
import org.springframework.ldap.odm.annotations.Entry;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 域账号用户信息
|
||||
@@ -13,25 +10,20 @@ import org.springframework.ldap.odm.annotations.Entry;
|
||||
* @since 2021年8月2日
|
||||
*/
|
||||
@Data
|
||||
@Entry(objectClasses = "inetOrgPerson")
|
||||
public class LdapPerson {
|
||||
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@DnAttribute(value = "uid")
|
||||
private String uid;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Attribute(name = "displayName")
|
||||
private String displayName;
|
||||
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Attribute(name = "mail")
|
||||
private String mail;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ zyplayer:
|
||||
originDomainRegex: .*\.zyplayer\.com(:\d+|)$
|
||||
# 管理端的数据库配置
|
||||
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
|
||||
username: root
|
||||
password: root
|
||||
@@ -54,10 +54,3 @@ spring:
|
||||
max-request-size: 100MB
|
||||
datasource:
|
||||
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