title: How can I add newly signed up user in the Spring boot security config?
body: <p>I am working <strong>Spring-Boot, Spring Security</strong> with <strong>basic Authentication</strong>. I will send login url from my client application written in AngularJS via RESTful API call.</p>
  
  <p>Everything works as expected. All the users in the DB configured in the <strong>SecurityConfiguration.java</strong> as below.  </p>
  
  <pre><code>@Autowired
  public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
  
      List&lt;User&gt; users = userService.getUsers();
      for (User user : users) {
          auth.inMemoryAuthentication().withUser(user.getUserName()).password(user.getPassword())
                  .roles(user.getRole().getName());
      }
  }
  
  @Override
  protected void configure(HttpSecurity http) throws Exception {
  
      http.csrf().disable().authorizeRequests().antMatchers("/server/rest/secure/**")
      .hasRole("ADMIN").and()
              .httpBasic().realmName(REALM).authenticationEntryPoint(getBasicAuthEntryPoint());
  }
  
  @Bean
  public CustomBasicAuthenticationEntryPoint getBasicAuthEntryPoint() {
      return new CustomBasicAuthenticationEntryPoint();
  }
  </code></pre>
  
  <p><strong>CustomBasicAuthenticationEntryPoint.java</strong></p>
  
  <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.springframework.security.core.AuthenticationException;
  import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
  
  public class CustomBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
  
  @Override
  public void commence(final HttpServletRequest request, 
          final HttpServletResponse response, 
          final AuthenticationException authException) throws IOException, ServletException {
  
      response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
      response.addHeader("WWW-Authenticate", "Basic realm=" + getRealmName() + "");
  
      PrintWriter writer = response.getWriter();
      writer.println("HTTP Status 401 : " + authException.getMessage());
      response.setHeader("WWW-Authenticate", "FormBased");
      response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
  }
  
  @Override
  public void afterPropertiesSet() throws Exception {
      setRealmName("MY_TEST_REALM");
      super.afterPropertiesSet();
  }
  }
  </code></pre>
  
  <p>So If I signup a new user which will inserted in the DB but not added in the above implementation. So authentication fails.</p>
  
  <p>How can refresh the above implementation whenever i'm and doing signup of a new user</p>