title: How to create Custom UserDetail Object in Spring Security
body: <p>I have built my custom Authenticaton Manager for Spring Security which goes something like this</p>
  
  <pre><code>   public class AccountAuthenticationProvider implements  AuthenticationProvider{
  
      @Autowired
      private AuthenticationService authService;
  
      @Override
      public Authentication authenticate(Authentication authentication) throws AuthenticationException {
  
          String userName = authentication.getName();
          String password = (String)authentication.getCredentials();
  
          if(authService.isValid(userName,password)){
              List&lt;GrantedAuthority&gt; grantedAuthorityList = new ArrayList&lt;GrantedAuthority&gt;();
              grantedAuthorityList.add(new SimpleGrantedAuthority("ROLE_USER"));
              SecurityContext securityContext = new SecurityContextImpl();
              return  new UsernamePasswordAuthenticationToken(userName,password);
          }
  
          return null;
      }
  
  
      public void setAuthService(AuthenticationService authService) {
          this.authService = authService;
      }
  
      @Override
      public boolean supports(Class&lt;?&gt; authentication) {
          return true;
      }
  
  }
  </code></pre>
  
  <p>but how do I create my own custom UserDetail object?  I'll use that to store account related values</p>