spring-ldap

Spring LDAP querybuilder PartialResultException

自作多情 提交于 2019-12-07 18:40:14
问题 I'm trying to get all the users from my LDAP server, doing the search from the base, this is my code: public LdapTemplate ldapTemplate() { LdapContextSource ctxSrc = new LdapContextSource(); ctxSrc.setUrl("ldap://127.0.0.1:389/"); ctxSrc.setBase("dc=test,dc=com"); ctxSrc.setUserDn("admin"); ctxSrc.setPassword("password"); ctxSrc.afterPropertiesSet(); LdapTemplate lt = new LdapTemplate(ctxSrc); return lt; } private LdapTemplate ldapTemplate = ldapTemplate(); public List<User> getAllUsers() {

Spring Security Ldap, log in only users in specified group

我怕爱的太早我们不能终老 提交于 2019-12-07 15:57:11
问题 Just like in title, I want that only users of spec. Here is my authentication code: public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.ldapAuthentication().userSearchFilter("(sAMAccountName={0})") .contextSource(contextSource()); } I found that there are functions like groupSearchFilter and groupSearchBase or groupRoleAttribute but I have no idea how to use them 回答1: "(sAMAccountName={0})" should be replaced with following "(&(objectCategory=Person)

Spring 5 LDAP Authentication and JWT Token as response

夙愿已清 提交于 2019-12-06 09:34:32
Hello i have been trying to configure spring to have it return JWT token if user/pass is authenticated to LDAP Server; Consider the use case below ; On the above diagram, i have configured WebSecurity to check/filter out requests with Bearer. See code below WebSecurityConfig.java @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private JwtAuthenticationEntryPoint unauthorizedHandler; @Autowired JwtAuthorizationTokenFilter authenticationTokenFilter; @Override protected void configure(HttpSecurity http) throws Exception { //

Implementation of timeout in LDAP

拜拜、爱过 提交于 2019-12-06 08:59:29
I have been handling an application in which we are using LDAP to fetch user details. Sometimes it will take more time to fetch user details. I want to implement time out on methods that fetch details so that we can avoid hanging transactions in server in worst case. Here we are using LdapUtil class in which we have configured LdapTemplate class to fetch the required details. How can we implement timeout on LDAP methods? (In this case ldapTemplate.search(...) methods) public class LdapUtil { @Autowired(required = true) @Qualifier(value = "ldapTemplateApp") LdapTemplate ldapTemplate; public Set

Spring LDAP and Spring Boot configuration

我怕爱的太早我们不能终老 提交于 2019-12-06 07:40:24
I have educational problem: There are virtual machine with windows server 2003 (AD) with users and their passwords. Connection to the machine is established (ip:192.168.56.101:389). The purpose of the web application is to enable the user to change his password in AD. Problem: can't configure connection to windws server 2003. I started from this tutorial https://spring.io/guides/gs/authenticating-ldap/ When I try to log in as "Jack Wood" and pass "1234" I got error. org.springframework.security.authentication.InternalAuthenticationServiceException: Uncategorized exception occured during LDAP

NoClassDefFoundError in Websphere — JARs are present

佐手、 提交于 2019-12-06 07:32:10
I have a simple Spring MVC application that looks up some user details from an LDAP server and prints out a simple HTML page using a JSP. The application works fine on Tomcat 6. It uses Spring LDAP 1.3.1 and LDAPTemplate to do the LDAP lookups. However, when I deploy this application WAR to Websphere 7, the app doesn't run -- Websphere returns a 500 Internal server error. Looking at Websphere's log file, I see [14/12/10 14:50:09:169 GMT] 00000022 DispatcherSer E org.springframework.web.servlet.FrameworkServlet initServletBean Context initialization failed org.springframework.beans.factory

Spring Security Ldap, log in only users in specified group

☆樱花仙子☆ 提交于 2019-12-06 03:31:19
Just like in title, I want that only users of spec. Here is my authentication code: public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.ldapAuthentication().userSearchFilter("(sAMAccountName={0})") .contextSource(contextSource()); } I found that there are functions like groupSearchFilter and groupSearchBase or groupRoleAttribute but I have no idea how to use them "(sAMAccountName={0})" should be replaced with following "(&(objectCategory=Person)(sAMAccountName=*)(memberOf=cn=entergroup,ou=users,dc=company,dc=com))" where cn, ou,dc are the specifications of

Spring LDAP Template Usage

萝らか妹 提交于 2019-12-06 00:35:09
Please take a look at the test class below. I am trying to do an LDAP search with Spring LDAP Template. I am able to search and produce a list of entries corresponding to the search criteria without the Spring LDAP template by using the DirContext as shown in the method searchWithoutTemplate(). But when I use a LdapTemplate, I end up with a NPE as shown further below. I am sure I must be missing something. Can someone help please? import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory

Spring embedded ldap server in unit tests

偶尔善良 提交于 2019-12-05 20:50:21
问题 I am currently trying to use an embedded ldap server for unit tests. In Spring Security, you can quickly define an embedded ldap server for testing with the tag with some sample data loaded from the specified ldif. I will be using Spring Ldap to perform ldap operations, and thinking of testing the usual CRUD features of my User service object. Is there, however, a way to ensure that the entries in the embedded server to be in the same consistent state (sort of like a delete all and reload the

Spring LDAP querybuilder PartialResultException

拈花ヽ惹草 提交于 2019-12-05 20:46:02
I'm trying to get all the users from my LDAP server, doing the search from the base, this is my code: public LdapTemplate ldapTemplate() { LdapContextSource ctxSrc = new LdapContextSource(); ctxSrc.setUrl("ldap://127.0.0.1:389/"); ctxSrc.setBase("dc=test,dc=com"); ctxSrc.setUserDn("admin"); ctxSrc.setPassword("password"); ctxSrc.afterPropertiesSet(); LdapTemplate lt = new LdapTemplate(ctxSrc); return lt; } private LdapTemplate ldapTemplate = ldapTemplate(); public List<User> getAllUsers() { LdapQuery query= query().base("").where("objectclass").is("user"); return ldapTemplate.search(query, new