private AuthenticationManager createAuthenticationManager() throws Exception {
   registerAuthentication(authenticationRegistry);
   return authenticationRegistry.build();
 }