Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6195557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:29:16+00:00 2026-05-24T03:29:16+00:00

I have been busy setting up authentication, a JDBC realm in particular, on GlassFish

  • 0

I have been busy setting up authentication, a JDBC realm in particular, on GlassFish 3.1. I have been operating under the assumption that:

  • The “User” table contains the login name (“email_address”) and the password (“password”)
  • The “Group” table contains a list of group names (“name”)
  • A “User_Group” table matches users and groups up.

Nowhere was I able to configure the “User_Group” table however so I was left wondering how the server would ever be able to match users up to groups. Needless to say it did not work. Closer inspection however suggests that:

  • The “User” table contains the login name (“email_address”) and the password (“password”)
  • The “Group” table contains the login name (“email_address”) as primary key, and a comma-separated list of group names (“Administrator,User”) in a single column (“groups”)

Is this correct and, if so, why go through the trouble of creating a separate “Group” table? Since it seems you can have only one grouplist per login (“email_address”) wouldn’t it be just as easy as to simply add a column called “groups” to the “User” table and discard the “Group” table altogether?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:29:16+00:00Added an answer on May 24, 2026 at 3:29 am

    I’m not sure what material you’ve followed to configure the JDBC realm, but it appear to be incomplete or incorrect. Following is a description of the configuration I’ve used to configure the JDBC realm.


    The database structure (as DDL statements):

    The USERS table

    CREATE TABLE USERS (
            USERID VARCHAR(50) NOT NULL,
            PASSWORD VARCHAR(128) NOT NULL
        );
    
    --//@UNDO
    
    DROP TABLE USERS;
    

    The GROUPS table

    CREATE TABLE GROUPS (
            GROUPID VARCHAR(20) NOT NULL
        );
    
    --//@UNDO
    
    DROP TABLE GROUPS;
    

    The USERS_GROUPS join table

    CREATE TABLE USERS_GROUPS (
            GROUPID VARCHAR(20) NOT NULL,
            USERID VARCHAR(50) NOT NULL
        );
    
    --//@UNDO
    
    DROP TABLE USERS_GROUPS;
    

    The Glassfish JDBCRealm configuration snippet from domain.xml:

        <auth-realm name="MyRealm" classname="com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm">
          <property description="null" name="jaas-context" value="jdbcRealm"></property>
          <property name="encoding" value="Hex"></property>
          <property description="null" name="password-column" value="PASSWORD"></property>
          <property name="datasource-jndi" value="jdbc/myDS"></property>
          <property name="group-table" value="USERS_GROUPS"></property>
          <property name="user-table" value="USERS"></property>
          <property description="null" name="group-name-column" value="GROUPID"></property>
          <property name="digest-algorithm" value="SHA-512"></property>
          <property description="null" name="user-name-column" value="USERID"></property>
        </auth-realm>
    

    Note, the group-name-column attribute having a value of GROUPID, which maps to the GROUPID column of the join table USERS_GROUPS and not the group table GROUPS. This is because the JDBCRealm issues the following SQL statements (if you decompile the com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm class):

    The password query, with the user Id being the parameter that is passed from the DigestLoginModule:

    SELECT <passwordColumn> FROM <userTable> WHERE <userNameColumn> = ?
    

    The group query, with the user Id being passed as the parameter:

    SELECT <groupNameColumn> FROM <groupTable> WHERE <groupTableUserNameColumn> = ?;
    

    When you consider the second query’s structure, it is quite obvious that the group Table must either contain the user Id mapped to a group Id (which leads to duplication of group data for users mapped to multiple groups), or that the group Table must be the join table that maps users to groups.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been busy in my project creating a webapp (in struts) that manages
I have been busy integrating Wordpress to one of a CakePHP application.Last Monday I
I have been busy with a exercise where I need to compare a winning
Have been trying to encrypt an xml file to a string so that I
So we have a busy legacy web service that needs to be replaced by
I have a bachelor in computer science. And have been busy doing security research
$(#profile_bar).mouseover(function(){ <?php $_SESSION['sessionasdf'] = 'asdf'; ?> }); Hello! I have been busy with this
I've been busy with this for months now. I currently have 2 servers for
(WPF) We have been asked to build a little window that pops up when
I have a question that might seem a bit dumb since I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.