1
votes

I am trying to have a login form in my Spring MVC/ Hibernate app, where users can login with only a valid username, (no password) is required. I am currently using Spring Security but it required a user name and password, so I was wondering if it is possible to allow login with no password? and if yes how? Any sample, link to tutorial/ example is highly appreciated. Thanks

1

1 Answers

-1
votes

you can try to do it with

Authentication auth = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());

SecurityContextHolder.getContext().setAuthentication(auth);

null here is password, but not required.