- This topic has 2 replies, 2 voices, and was last updated 13 years, 10 months ago by Glenn Puckett.
-
AuthorPosts
-
Glenn PuckettParticipantI have been working on my first Spring project that I used Scaffold CRUD to generate. Now I am trying to add Spring Security. The Scaffold process appeared to complete with no problems. I let it take the defaults and used database security.
When I started the application (Tomcat) I noticed in the log that it couldn’t find the three security tables. I assumed it built the tables on the fly because they were there when I checked. The problem is they are empty. According to the tutorial it would automatically create an admin user. It did not. So I am not sure what to do. I have deleted the project and started from scratch 3 times with the same result. When I start the application I get the login page but I don’t have anthing on the user/athorities tables so I can’t get past that.
I’m not sure what to do. I would try to add some entries in the tables but I’m not sure what to put in the authorities table. I tried adding a user to the user table but it didn’t work. I assume because I didn’t know what to put in the authorities table.
jayperkinsMemberHi,
Is this the tutorial you are referring to?
https://www.genuitec.com/forums/topic/problems-with-scaffold-security/That tutorial covers the in memory option where the users and roles are stored directly in you generated-security.xml file.
When you select the database option, we will not populate it with any data. You can use the following sql to populate your database with some data
insert into “CLASSICCARS”.”USERS”
(id, enabled, password, username)
values
(‘admin’, 1, ‘password’, ‘admin’)insert into “CLASSICCARS”.”AUTHORITIES”
(id, authorityname)
values
(‘sysadmin’, ‘sysadmin’)insert into “CLASSICCARS”.”USERS_AUTHORITIES”
(user_id, authorities_id)
values
(‘admin’, ‘sysadmin’)
Glenn PuckettParticipantGreat. I was able to get it working with your help. I just need to do some reading and learn how everything fits together. It’s not clear at all how the security system works. I need to be able to limit access to specific pages based on an individual’s authority. The tutorial didn’t even mention how you go about managing the security. It’s great to know HOW to set it up, but it would have been even better to have an extra 5 minutes in there to give a brief explanation as to how to apply the security once you have it set up. I’ll go back and see what other tutorials and references I can find to help. Any suggestions would be helpful.
-
AuthorPosts