移除未完善的LDAP,数据源支持MySQL8
This commit is contained in:
@@ -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