• 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

customized authentication provider

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new in spring security. I have to implement login option using spring security (using Hibernate Annotation). I have InnoDB supports for MySQL DB. My employee login tables are..
1. tbl_employee[emp_no bigint primary key, password varchar(20), authority_id int]
2. tbl_authority[authority_id (foreign key of same in tbl_employee), authority_name varchar(50)]
3. tbl_profile[emp_no(foreign key of same in tbl_employee), office_name varchar(100)]

My doubt is how to make one-to-many relation from tbl_employee table towards tbl_profile table to get the proper office_name after the successful login. We are using myeclipse for spring scaffolding to generate mvc and spring security code. On that users, users_authorities, and authorities table on security scaffolding. We have to replace that with above 3 tables. Can anybody help me with sample source code. Sent to my gmail accnt ajesh123.
 
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
My article here might help.

http://www.theserverside.com/tip/-Spring-Security-Customizing-Your-User-and-Authorization-in

Basically a UserDetailsService object is the one that does the querying to your database. It has one method loadUserByUserName(String userName) It returns a UserDetails object. So you can take the username and do any type of querying you want in your UserDetailsService implementation, if the ones that Spring created doesn't work for you.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic