title: How to implement custom authentication in Spring Security 3?
body: <p>I know this has been answered so many times, but I am confused. I already have an Authentication mechanism in my application and I just want to use the authorization part of Spring MVC. I'm using Spring MVC 3 and Spring Security 3.</p>
  
  <p>When I search on internet I found two solutions, the first one is to just implement AuthenticationProvider interface. <a href="http://danielkaes.wordpress.com/2013/02/20/custom-authentication-provider-in-spring/" rel="nofollow noreferrer">Example1</a>. The second one is to implement UserDetails and UserDetailsService, <a href="http://kh-yiu.blogspot.com/2012/12/spring-mvc-security-custom.html" rel="nofollow noreferrer">Example2</a> so I'm lost here.</p>
  
  <p>----Update----</p>
  
  <p>The second part of the Question is <a href="https://stackoverflow.com/questions/18562331/why-my-custom-authentication-is-not-working-in-spring-security-3/18563176?noredirect=1#18563176">here</a>. And the solution to the workaround.</p>