• 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

Spring security adding users

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm builidng a hospital managment application(Using Spring boot + mySql). I want to be able to add patients with user roles, so that they can log in the user panel.As i understand, Spring secuirty needs these tables in MySql, users(with username and password), authorities connecting Roles with usernames and roles which define the available roles. I want my Patient Entity which looks like this:

To be added,upon creating a new patient, as a user with ROLE_USER. For now i'm stuck with this(attached ss). Patient has a username and a password, the user_role table connects the user_id with a correct role_id, but no user is created and therefore no authority is added. How should i go about making the patient enitity a user that is connected with authentication? when i tried renaming the patient entity to users I got all kinds of errors and everything crashed. Here is my security config:

Patient service implementation:

And patient controller action, which I wanted to first add the patient to db and the also create a user based on patient:

How should i go about making it work?

Screenshot-from-2018-09-14-23-55-04.png
[Thumbnail for Screenshot-from-2018-09-14-23-55-04.png]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic