facebook

Problems with Scaffold Security

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #314747 Reply

    Glenn Puckett
    Participant

    I 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.

    #314778 Reply

    jayperkins
    Member

    Hi,

    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’)

    #314791 Reply

    Glenn Puckett
    Participant

    Great. 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.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Problems with Scaffold Security

You must be logged in to post in the forum log in