webtier@glassfish.java.net

Using servlet request.login with jdbcRealm?

From: <forums_at_java.net>
Date: Sun, 4 Nov 2012 11:48:13 -0600 (CST)

I would like to use the new Servlet 3.0 login with a jdbcRealm, but I don't
see any documentation on how to set this up. GlassFish 3.1.2 Netbeans 7.3 SQL
Server 2008 R2 with Microsoft's Type 4 JDBC driver I have a jdbcRealm set up
as follows: JAAS Context: jdbcRealm JNDI: jdbc/omSecurity User Table:
OM_SECURITY.User User Name Column: Name Password Column: Password Group
Table: OM_SECURITY.SignInGroup Group Table User Name Column: UserName Group
Name Column: GroupName Assign Groups: (blank) Database User: (blank) Database
Password: (blank) Digest Algorithm: SHA-512 Password Encryption Algorithm:
AES Encoding: Hex Charset: (blank) The user table is created using this
script: CREATE TABLE [OM_SECURITY].[User]( [UserID] [int] IDENTITY(1,1) NOT
NULL, [Name] [nvarchar](32) NOT NULL, [Password] [char](128) NOT NULL,
[LastName] [nvarchar](32) NULL, [FirstName] [nvarchar](32) NULL, [Email]
[nvarchar](64) NULL, [Active] [bit] NOT NULL ) ON [PRIMARY] This is the View
used to return every user in that table as being in the "User" group/role:
SELECT 'User' AS GroupName, Name AS UserName FROM OM_SECURITY.[User] WHERE
(Active = 1) There is one record in the User table (admin/password): 1 admin
B109F3BBBC244EB82441917ED06D618B9008DD09B3BEFD1B5E07394C706A8BB980B1D7785E5976EC049B46DF5F1326AF5A2EA6D103FD07C95385FFAB0CACBC86
NULL NULL NULL 1 Here is my web.xml: <?xml version="1.0" encoding="UTF-8"?>
30 omRealm User These are the errors that come up in the GlassFish console
when I try to log in: SEVERE: jdbcrealm.invaliduserreason WARNING: WEB9102:
Web Login Failed:
com.sun.enterprise.security.auth.login.common.LoginException: Login failed:
Security Exception SEVERE: Servlet Exception: javax.servlet.ServletException:
Exception thrown while attempting to authenticate for user: admin WARNING:
DPL5032:An authentication method was not defined in the web.xml descriptor.
Using default BASIC for login configuration. WARNING: No Principals mapped to
Role [User]. These are the request parameters as copied from the Chrome
network tool: username:admin
password:b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86

--
[Message sent by forum member 'pacific202']
View Post: http://forums.java.net/node/891970