|
@@ -10,7 +10,10 @@ import com.management.platform.service.FeishuInfoService;
|
|
import com.management.platform.service.UserService;
|
|
import com.management.platform.service.UserService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.ldap.core.LdapTemplate;
|
|
|
|
+import org.springframework.ldap.filter.EqualsFilter;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -39,6 +42,9 @@ public class UserController {
|
|
@Resource
|
|
@Resource
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private LdapTemplate ldapTemplate;
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private FeishuInfoService feishuInfoService;
|
|
private FeishuInfoService feishuInfoService;
|
|
|
|
|
|
@@ -300,5 +306,15 @@ public class UserController {
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/testLdap4", method = RequestMethod.GET)
|
|
|
|
+ public HttpRespMsg testLdap4(@RequestParam String username, @RequestParam String passWord) {
|
|
|
|
+ EqualsFilter filter = new EqualsFilter("sAMAccountName", username);
|
|
|
|
+ boolean res = ldapTemplate.authenticate("",filter.toString(), passWord);
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ httpRespMsg.setMsg(res==true?"验证成功":"验证失败");
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|