• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom credentials in spring security

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Im new to spring security; the applcation im working on uses the default authentication manager which takes
user name and password as credentials.

Now my requirement is that i have to login using user id instead of username;
For this do i need to add my custom authentication manager provider?

In that case what classes i have to create by extending the existing classes (like AuthenticationManager, Authentication)

Please suggest me


Thanks & Regards,
Shanthi Naidu




 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Username, user id, login name, they all mean the same thing to me.

Why do you see it meaning something different?

Which UserDetailsService are you using, JDBC, LDAP, etc?
For JDBC just change the userByUserName property or authoritiesByUserName property to go to the name of the fields in the database that you have that don't match the default built in queries.

Remember the userByUserName property query has to return three fields; username(userID), password, and boolean for enabled.
The authoritiesByUserName query has to return two fields; username(UserID), role
For the role field, make sure it is prefixed with "ROLE_"

Good Luck

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic