java - spring security manual login -


i using spring security , want login users manually.

my controller looks this:

 @requestmapping("/login")     public string login() {         authentication authenticationresult = authenticationmanager.authenticate(new usernamepasswordauthenticationtoken("user2", "password"));         securitycontextholder.getcontext().setauthentication(authenticationresult);         return "redirect:/"; } 

i found example in docs such login made.

http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#what-is-authentication-in-spring-security

i wanted ask whether there downsides or security issues approach?

edit: if can point me class (&docs?) default spring /login request ist handled might answer question how login process implemented spring internally

this work around when need process before user logs in. actual problem comes when following things. of course these not problems :-).

  1. if using spring remember-me token or custom authentication providers.
  2. when using encrypted passwords in db.

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

1111. appearing after print sequence - php -

android - How to create dynamically Fragment pager adapter -