Search code examples
javasqlsecurityjdbcjsecurity

jSecurity JDBCRealm SQL setup


I am trying to use jSecurity for an enterprise java app, but the documentation is...well...lacking.

Has anyone out there in SO-land been able to get the JDBCRealm setup, and if so did you find a SQL setup script or did you just derive it on your own? Either way, can you provide the create SQL statements to make this work?

I have posted to the mailing list here, but I don't know if\when I will get a response\I don't have a long time to wait.

Thanks in advance!


Solution

  • So far as I can tell, this is it (or will work well enough in most circumstances):

    CREATE TABLE [dbo].[users](
        [username] [varchar](50) NOT NULL,
        [password] [varchar](50) NOT NULL
    )
    
    CREATE TABLE [dbo].[user_roles](
        [username] [varchar](50) NOT NULL,
        [role_name] [varchar](50) NOT NULL
    )
    
    CREATE TABLE [dbo].[roles_permissions](
        [role_name] [varchar](50) NOT NULL,
        [permission] [varchar](50) NOT NULL
    )
    

    [EDIT: If you are using Maven you will need ehcache and commons-logging in your POM as well]