Spring Security(Third Edition)
上QQ阅读APP看书,第一时间看更新

Searching for the user

Now that we have a connection, we can use it to look up the user's DN that we wish to bind to, by performing the following steps:

  1. Right-click on DIT and select New | New Search.
  2. Enter a search base of dc=jbcpcalendar,dc=com. This corresponds to the baseDn attribute of our DefaultSpringSecurityContextSource object that we specified.
  3. Enter a filter of uid=user1@example.com. This corresponds to the value we specified for the userSearchFilter method of AuthenticationManagerBuilder. Note that we have included the parentheses and have substituted the username we are attempting to log in with with the {0} value.
  4. Click on Search.
  5. Click on the DN of the single result returned by our search. You can now see that our LDAP user is displayed. Note that this DN matches the value we searched for. Remember this DN, as it will be used in our next step.