title: Java SprinBoot Security + Active Directory attributes
body: <p>I am using Java + SpringBoot Security for autorization on my web app.
  Bellow is working config and no claims)</p>
  <p>My questions:</p>
  <ol>
  <li>Can I use this way to connect to AD for to get from AD attrubutes of users (eg. sAMAccountName, mail)?</li>
  <li>There is possible setting up aceess to page by the AD groups?</li>
  </ol>
  <p>If i right understand AuthenticationManagerBuilder just connector to AD.</p>
  <pre><code>@Configuration
  class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http
                  .authorizeRequests()
                  .antMatchers(&quot;/home&quot;, &quot;/logout/**&quot;,&quot;/logout-success&quot;,&quot;/login/**&quot;).permitAll()
                  .anyRequest()
                  .authenticated()
                  .and()
                  .formLogin()
                  .and()
                  .logout()
                  .permitAll();
      }
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder authBuilder) throws Exception {
          authBuilder
                  .ldapAuthentication()
                  .userSearchFilter(&quot;(sAMAccountName={0})&quot;)
                  .userSearchBase(&quot;OU=Active,OU=Users,OU=nsk,DC=regions,DC=office,DC=ru&quot;)
                  .groupSearchBase(&quot;OU=Groups,OU=nsk,DC=regions,DC=office,DC=ru&quot;)
                  .groupSearchFilter(&quot;member={0}&quot;)
                  .contextSource()
                  .url(&quot;ldap://regions.office.ru:389&quot;)
                  .managerDn(&quot;CN=ldap_user_ro,OU=Service,OU=Users,OU=nsk,DC=regions,DC=office,DC=ru&quot;)
                  .managerPassword(&quot;passw&quot;);
      }
  }
  </code></pre>