JAASAuthentication Sample

trying to configure the sun java system application server platform edition 8.2 (as per the JAASAuthentication sample help)

file: login.conf

jdbcAuth {

jaasauthentication.MyJdbcLoginModule required

what do i use to replace the: "MyJdbcLoginModule required" with?

Thanks

[306 byte] By [farmboy] at [2007-11-26 8:53:11]
# 1

To run this sample, no need to replace

jaasauthentication.MyJdbcLoginModule

There is a class included in the zip file of this Sample

named MyJdbcLoginModule in the jaasauthentication package.

http://developers.sun.com/prodtech/javatools/jscreator/reference/code/sampleapp s/2/JaasAuthentication.zip

John

jawbe at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 2

Application Server reports these errors:

[#|2006-07-20T08:26:49.937-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=11;|ADM1041:Sent the event to instance:[ApplicationDeployEvent -- reference-added JAASAuthentication]|#]

[#|2006-07-20T08:26:49.984-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=11;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]

[#|2006-07-20T08:26:50.000-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=13;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- deploy web/JAASAuthentication]|#]

[#|2006-07-20T08:26:50.015-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=13;|WEB0100: Loading web module [JAASAuthentication] in virtual server [server] at [/JaasAuthentication]|#]

[#|2006-07-20T08:26:50.062-0600|SEVERE|sun-appserver-pe8.2|javax.enterprise.sys tem.container.web|_ThreadID=13;|WEB0600: WebModule [/JaasAuthentication] failed to deploy and has been disabled: [java.lang.IllegalArgumentException: Invalid <url-pattern> /faces/*.jsp in filter mapping].|#]

[#|2006-07-20T08:26:51.562-0600|WARNING|sun-appserver-pe8.2|org.apache.commons. beanutils.MethodUtils|_ThreadID=13;|Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.|#]

[#|2006-07-20T08:26:51.765-0600|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=13;|[ComponentRule]{faces-config/component} Merge(com.sun.rave.web.ui.Time)|#]

[#|2006-07-20T08:26:51.890-0600|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=13;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)|#]

[#|2006-07-20T08:26:51.906-0600|WARNING|sun-appserver-pe8.2|org.apache.commons. digester.Digester|_ThreadID=13;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)|#]

[#|2006-07-20T08:26:53.328-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.tools.admin|_ThreadID=13;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]

[#|2006-07-20T08:27:34.109-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WebModule[/JaasAuthentication]Login.java:: Logging in userjaasauth|#]

[#|2006-07-20T08:27:34.250-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WebModule[/JaasAuthentication]SessionBean1::Except ion Occured:access denied (javax.security.auth.AuthPermission createLoginContext.jdbcAuth)|#]

[#|2006-07-20T08:27:34.250-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WebModule[/JaasAuthentication]Login.java::Error Creating login context.|#]

[#|2006-07-20T08:28:17.031-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.stream.out|_ThreadID=14;|Email Received: webmstr@uc.usbr.gov|#]

[#|2006-07-20T08:28:17.046-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.stream.out|_ThreadID=14;|

Password received: jerry jerry|#]

[#|2006-07-20T08:28:17.046-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WebModule[/JaasAuthentication]RegisterUser::regist er_action() called.|#]

[#|2006-07-20T08:28:17.062-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=14;|WebModule[/JaasAuthentication]login conf: jaasauthentication.MyJdbcLoginModule|#]

[#|2006-07-20T08:28:28.281-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]Login.java:: Logging in userjerry|#]

[#|2006-07-20T08:28:28.281-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]SessionBean1::Except ion Occured:access denied (javax.security.auth.AuthPermission createLoginContext.jdbcAuth)|#]

[#|2006-07-20T08:28:28.281-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]Login.java::Error Creating login context.|#]

[#|2006-07-20T08:28:52.859-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]Login.java:: Logging in userjerry|#]

[#|2006-07-20T08:28:52.859-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]SessionBean1::Except ion Occured:access denied (javax.security.auth.AuthPermission createLoginContext.jdbcAuth)|#]

[#|2006-07-20T08:28:52.859-0600|INFO|sun-appserver-pe8.2|javax.enterprise.syste m.container.web|_ThreadID=15;|WebModule[/JaasAuthentication]Login.java::Error Creating login context.|#]

I believe everything noted in the JAAS Help file went ok..

I did not add a "servletfilter" as noted in the "Technical Tip - JAAS Authentication" document..

The Servlet Filters section of web.xml shows an UploadFilter, however, when clicking on Go To Source (the file can not be found)

The SecurityFilter (for a total of two) shows: "/faces/*.jsp " in the "Applies To" column.

I am able to register, but going back to the login page with the new username/password fails with this System Messages: Error Creating LoginContext, Please make sure your application has been configured properly.

What's the fix to get this to run..

Thanks

farmboy at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 3

In the Sample, the username/password is jaasauth/jaasauth.

Looks like they got changed. Username is now jerry?

If you're using LDAP then the LDAP server must also have an account

with username jerry.

If you change username then you may have to restart the servers

Also, for LDAP, make sure you do the following (mentioned at the end of

the readme:

Switching from Database to LDAP Authentication:

In order to use the LDAP Login Module you need to have a LDAP directory setup for yourself. Once you have a LDAP Directory server, please make the following changes. (Note that you can change the MyLdapLoginModule class and LdapUserData classes to suite your needs and do authentication as you wish.)

1.

For step No. 6 above, fill the appropriate information about your LDAP server into the login.conf file.

2.

Back in Creator window, go to the Project Navigator window and open the file LdapUserData.java located under the SourcePackages/jaasauthentication folder. Add the LDAP_HOST and SEARCHBASE_DN values in here.

3.

Open the SessionBean.java file, and change the value for private static variable login_config from "jdbcAuth" to 搇dapAuth?

hth

John

jawbe at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 4
In my last posting the info was for LDAP authentication, For JDBC authentication, if you changed your username thenyou need to modify the sql scripts at the beginning, re-execute themand also modify the Jaasauth datasourceJohn
jawbe at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 5

The sql scripts to modify are in the dbscripts folder.

e.g. if you want to use a different username/password, modify the username/password in jaas-auth-derby.sql

-- create the user

CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(

'derby.user.jaasauth', 'jaasauth');

John

jawbe at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 6

Thanks... I got it working with jdbcAuth..

Now i would like to get it to work with my Sun Java System Directory Server 5.x, Solaris 9 SPARC

I am not sure as to what to use;

ldapAuth {

jaasauthentication.MyLdapModule required

URL="ldap://its.abc.com:389"

SEARCHBASE="cn=DirectoryManagerUsername", ou=us, dc=its, dc=abc, dc=com"

Can you correct and/or help with the above

Directory Manager username, in this case: DirectoryManager

ou is our group which in this case is: us

dc are the sections of our domain name

is the Directory Manager pasword needed anywhere here..

is the value of the CN the user account which has admin (R/W/E/D) permissions for the Directory Server?

or, what is the valuse of cn suppose to be...

Thanks

farmboy at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...
# 7
One more thing you need to do is in the SessionBean, unfortunately, thiswas poor practice, the username must be change to ldapAuth private static String login_config = "ldapAuth";You don't need the password in the login.conf for ldaphthJohn
jawbe at 2007-7-6 22:47:17 > top of Java-index,Development Tools,Java Tools...