title: Using Custom class instead of User class in spring security for encoding and password authentication
body: <p>I am new to Spring Security .I have Android <code>application and JAVA as back end</code> service.Customer Service has been exposed via <code>REST</code>.</p>
  
  <p>My requirement is to encode the password for customer and save it into the database while sign up process and later I can authenticate it using Spring Security in java backend. All the Customer data is feeded in JSON format from android while sign up and login process</p>
  
  <p>I have seen that Spring has its own <code>User</code> and <code>UserService</code> class for authentication purpose.</p>
  
  <p>I have a requirement to use Customer class instead of USER(Spring provided bean) class.Customer Bean is having password as a field . Is there any way to use our own class and table in spring security? How can i decode the password and later authenticate while login ? please shed some light over it as i have tight requirement not to use User class of spring</p>
  
  <p><strong>Customer  Bean</strong> </p>
  
  <pre><code>@XmlRootElement(name = "customer")
  @XmlAccessorType(value = XmlAccessType.FIELD)
  public class CustomerWrapper {
  
      @XmlElement
      protected Long id;
  
      @XmlElement
      protected String firstName;
  
      @XmlElement
      protected String lastName;
  
      @XmlElement
      protected String emailAddress;
      @XmlElement
      protected String username;
  
      @XmlElement
      protected String primaryPhone;
  
      @XmlElement
      protected String secondaryPhone;
  
      @XmlElement
      protected String password;
  
      @XmlElement(name = "customerAddress")
      @XmlElementWrapper(name = "customerAddress")
      protected List&lt;AddressWrapper&gt; customerAddress = new ArrayList&lt;AddressWrapper&gt;();
  
  setter and getter
  </code></pre>