JDBCRealm
ClassTo protect your web pages or web applications, you can set the security so that only registered users can access them. This is known as the authentication facility. This type of realm involves storing the credentials of your users inside a database. The GlassFish Server uses the database information and the enabled JDBC realm option inside the configuration file.
The following properties are required for a JDBC realm.
The JAAS (Java Authentication and Authorization Service) context (the identifier for the login module to use for this realm). The only valid value is jdbcRealm
.
The JNDI name for this realm. The default value is jdbc/security
.
The table that contains a list of authorized users for this realm. The default value is usertable
.
The name of the column that contains the list of users inside the user table. The default value is userid
.
The name of the column that contains the respective user's password in the user table. The default value is password
.
The name of the group table in the database. The default value is grouptable
.
The name of the group name column in the database's group table. The default value is groupid
.
The following optional properties are available for a JDBC realm.
A comma-separated list of group names. All clients who present valid certificates are assigned to these groups, for example, employee,manager
, where these are the names of user groups.
Allows you to specify the database user name in the realm instead of the jdbc-connection-pool
. This prevents other applications from looking up the database, getting a connection, and browsing the user table. By default, the jdbc-connection-pool
configuration is used.
Allows you to specify the database password in the realm instead of the jdbc-connection-pool
. This prevents other applications from looking up the database, getting a connection, and browsing the user table. By default, the jdbc-connection-pool
configuration is used.
(Optional) Specifies the digest algorithm. The default is SHA-256
. You can use any algorithm supported in the JDK, or none.
Note:
In versions of GlassFish Server prior to 3.1.2, the default algorithm was MD5
. If you have applications that depend on the MD5
algorithm, you can override the default SHA-25
algorithm by using the asadmin set
subcommand:
asadmin> set server.security-service.property.default-digest-algorithm=MD5
You can use the asadmin get
subcommand to determine what algorithm is currently being used:
asadmin> get server.security-service.property.default-digest-algorithm
Also note that, to maintain backward compatibility, if an upgrade is performed from GlassFish Server v2.x or v3.0.x to GlassFish Server 3.1.2, the default algorithm is automatically set to MD5
in cases where the digest algorithm had not been explicitly set in the older GlassFish Server version.
The encoding. Allowed values are Hex
and Base64
. If digest-algorithm
is specified, the default is Hex
. If digest-algorithm
is not specified, by default no encoding is specified.
The algorithm for encrypting passwords stored in the database.
Note:
It is a security risk not to specify a password encryption algorithm.
The charset for the digest algorithm.