|
JUnit test of a EJB using JAAS: msg#00037java.jboss.user
My problem is to make a junit test to access the EJB's using security. I tried to use the tests from CVS. My server uses ldap to authenticate users. From embbeded tomcat it works allright, i did the following to access through junit task : - ant build.xml file that calls junit test: <junit printsummary="true" fork="yes"> <formatter type="xml" /> <sysproperty key="java.security.auth.login.config" value="${config.tests}/auth.conf"/> <batchtest fork="yes" todir="${tests.report.dir}"> <fileset dir="${tests.dir}"> <include name="**/*Test*.class" /> </fileset> </batchtest> <classpath> ... </classpath> </junit> - auth.conf file : other { org.jboss.security.ClientLoginModule required; }; - junit test case method (excerpt) : ... LoginContext lc = null; boolean loggedIn = false; try { AppCallbackHandler handler = new AppCallbackHandler("admin","admin".toCharArray()); lc = new LoginContext("other", handler); lc.login(); } catch (LoginException e) {assertTrue("login not ok"+e.getMessage(),false);} ... (call EJB methods though businness delegates ) obs : the AppCallbackHandler is the one of JBoss tests. The client doesn't give me any error (during login) and the server gives me the following message : 16:45:19,511 ERROR [SecurityInterceptor] Authentication exception, principal=null 16:45:19,731 ERROR [SecurityInterceptor] Authentication exception, principal=null 16:45:19,821 ERROR [SecurityInterceptor] Authentication exception, principal=null 16:45:19,935 ERROR [SecurityInterceptor] Authentication exception, principal=null One question : with this steps done (if it's not missing nothing), may I call the ejb's methods without any other code, that the user context (principal) will be sent to the jboss server??? obs: the jboss server, as I said before, uses ldap to authenticate and autorize, and it works very well for the tomcat embbeded. Correct me if i'm wrong, but for the client, it doens't matter what kind of jaas loginModule the server uses, isn't? ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Space Bar to Continue?, Starsinic, Frank |
|---|---|
| Next by Date: | Re: ClassCastException, Burkhard Vogel |
| Previous by Thread: | RE: Space Bar to Continue?, Starsinic, Frank |
| Next by Thread: | Re: JUnit test of a EJB using JAAS, Emerson Cargnin - MSA |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |