title: SpringMVC 3 Spring Security Creating User Login
body: <p>I'm trying to use <a href="http://blog.solidcraft.eu/2011/03/spring-security-by-example-set-up-and.html" rel="nofollow">this tutorial</a> to create a spring mvc user login page.</p>
  
  <p>The tutorial is great but one thing is not clear, on the <a href="http://blog.solidcraft.eu/2011/03/spring-security-by-example-user-in.html" rel="nofollow">second page</a> he talks about the <code>UserRepository</code> interface. The interface methods return <code>User</code>. What I'm confused about is of the <code>User</code> he's referring to is the <code>User</code> object part of the spring framework? The reason I ask if because I want to have an email address field which is not there in the <code>User</code> object which is part of the Spring security framework.</p>
  
  <p>Also, in his implementation of the <code>UserLoginService</code> he has a method:</p>
  
  <pre><code>@Override
  public User getLoggedUser() {
      User loggedUser = null;
      AuthenticationUserDetails userDetails = getLoggedUserDetails();
      if (userDetails != null) {            
          loggedUser = userRepository.findById(userDetails.getId());
      }
      return loggedUser;
  }
  </code></pre>
  
  <p>the trouble is that the <code>AuthenticationUserDetails</code> does not have a <code>getId()</code> method, which makes me think he intends us to extend Spring's User to create our own Account entity or something.</p>
  
  <p>I want to use Hibernate to create my <code>Account</code> and <code>Role</code> entities and so far every tutorial I've found seems to be before Spring MVC 3 or just giving bits and pieces.</p>
  
  <p>Can anyone provide clarification on this or refer me to a good tutorial for User Login with Spring Security and SpringMVC?</p>