title: Authentication Success Handler for pre-authenticated scenario
body: <p>I am looking for a way to add some custom code right when the user is pre-authenticated from a Java EE container (using Kerberos). I am using Spring Security for authorization, which works very well. But now I want to be able to detect if the current user exists in the database using a simple Spring service (and then repository) method.</p>
  
  <p>My SecurityConfig.java file</p>
  
  <pre><code>@Configuration
  @EnableWebMvcSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
  @Override
  protected void configure(HttpSecurity http) throws Exception {
  
      http
              .logout()
                  .logoutUrl("/rest/logout")
                  .logoutSuccessUrl("/static/jsp/logout.jsp")
                  .invalidateHttpSession(true)
                  .permitAll()
  
          .and()
          .authorizeRequests()
  
              .antMatchers("/login","/accessDenied", "/resources/**", "/static/*").permitAll()
  
              .antMatchers("/security/*").hasRole("ADMIN")
              .anyRequest().authenticated()
              .anyRequest().hasRole("USER")
              .and().anonymous().disable()
  
           .jee()
  
              .mappableRoles("USER","ADMIN");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My stack:</p>
  
  <ul>
  <li>JBoss 7.2</li>
  <li>Spring MVC 4.0.6</li>
  <li>Spring Security 3.2.4</li>
  </ul>
  
  <p>Any example or hint would be greatly appreciated.</p>
  
  <p>Thank you</p>