You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Er...@kryos.com on 2006/03/20 17:46:01 UTC

JAAS configuration in geronimo

Sorry... let's try that with a subject heading
.....



Eric Cho/Kryos 
20/03/2006 09:44 AM

To
user@geronimo.apache.org
cc

Subject












Hi all,

I'm trying to port an app over to WAS CE (which we all know is geronimo 
with and ibm admin console). 

I have a JAAS component and I'm having trouble configuring it.

In tomcat it's as easy as opening the tomcat properties dialogue, going to 
the java tab and adding the following under java options:
-Djava.security.auth.login.config=C:\Tomcat 
5.5\conf\JAASConfig\thisSitesSecurity.config


How do I got about doing it in WAS CE? In the config.xml or the 
geromino-web.xml?

Any help would be appreciated,

Eric





Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
I've attempted to create a DB pool using the console......

and I got the following stack trace....after I attempted the save/deploy. 
The test connection seemed to work fine.

Can  you make sense of this?  Could it be a bug in the console?   Should I 
try doing it by command line?  If so, can you point me to a resource that 
outlines the command lines for creating a db pool?

As a side note:  Could the problems I've been having be a result of me 
using jre1.5.0.x?  Should I be using 1.4?


Thanks,
Eric


13:23:41,368 ERROR [DatabasePoolPortlet] Unable to save connection pool
java.lang.NullPointerException
        at 
org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.save(DatabasePoolPortlet.java:831)
        at 
org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.processAction(DatabasePoolPortlet.java:338)
        at 
org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:229)
        at 
org.apache.pluto.core.PortletServlet.doPost(PortletServlet.java:163)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at 
org.apache.pluto.core.PortletServlet.service(PortletServlet.java:153)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
        at 
org.apache.pluto.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:120)
        at 
org.apache.pluto.invoker.impl.PortletInvokerImpl.action(PortletInvokerImpl.java:68)
        at 
org.apache.pluto.PortletContainerImpl.processPortletAction(PortletContainerImpl.java:164)
        at 
org.apache.pluto.portalImpl.core.PortletContainerWrapperImpl.processPortletAction(PortletContainerWrapperImpl.java:82)
        at org.apache.pluto.portalImpl.Servlet.doGet(Servlet.java:227)
        at org.apache.pluto.portalImpl.Servlet.doPost(Servlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at 
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:52)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at 
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:262)
        at 
org.apache.geronimo.tomcat.valve.PolicyContextValve.invoke(PolicyContextValve.java:50)
        at 
org.apache.geronimo.tomcat.valve.TransactionContextValve.invoke(TransactionContextValve.java:53)
        at 
org.apache.geronimo.tomcat.valve.ComponentContextValve.invoke(ComponentContextValve.java:47)
        at 
org.apache.geronimo.tomcat.valve.InstanceContextValve.invoke(InstanceContextValve.java:60)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
        at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:534)






"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
20/03/2006 01:04 PM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo






The error seems to be saying that it can't find com.mysql.jdbc.Driver in 
the MySQL 3.0.15 JAR that you put in the repository.  It seems unlikely, 
but can you run a "jar -tf" on that JAR and make sure that there's a 
com/mysql/jdbc/Driver.class in there?  If there is, perhaps we have a bug 
and we don't load the JAR correctly for the test. 

I'm pretty sure this will work if you set up a JDBC pool in the console 
and then just point your security realm to that instead of separately 
configuring the JDBC JAR and connection settings in the security realm 
screen. 

Thanks,
     Aaron

On 3/20/06, EricCho@kryos.com <EricCho@kryos.com > wrote:

Thanks Aaron..... that's leading me in the right direction..... 

I'm having troubles setting up the security realm.... 

I'm using the WAS CE console.... which pretty much looks like the geronimo 
console.. 


I'm not exactly sure what the error message is asking for.   A dependency 
in the web app?  I wouldn't think so, because the security realm seems to 
be a totally separate component to the web app.... 

Do you see any glaring errors?  Or is there something else i should be 
doing? 

Thanks, 
Eric 








"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com 
20/03/2006 11:01 AM 


Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo








So we override the default JAAS file-based configuration mechanism
with a configuration system of our own based on Geronimo components
(GBeans).

If you are doing this for a web application and you can use the normal
J2EE login routines, you can configure your login module as a Geronimo
security realm and let J2EE/Geronimo handle the login.

If you are intentionally avoiding the J2EE login handling, then you
probably need to rewrite your JAAS configuration as a Geronimo service
configuration (we have GBeans that wrap login module configuration,
etc.).  You'll also need to put your classes in a JAR in the
repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
will probably be a little painful to write the configuration plan, but
hey, you only need to do it once.  :)

If you're going to need to write the plan, can you post the relevent
section from your existing JAAS config file?

Thanks,
   Aaron

On 3/20/06, EricCho@kryos.com < EricCho@kryos.com> wrote:
>
>
> Hi Aaron,
>
> Sorry, should have been more descriptive.
>
> I create a loginContext and pass it in the name of the config file and 
hand it the custom login call back handler.
>
> Then the login method is called; it goes back and grabs the user from a 
MySQL database.  If the user exists and the credentials fit, we figure out 
their role and send them on their way.  If not, it throws a Login 
Exception and punts them back to the login page.
>
>
> Hopefully this helps.
>
> Thanks,
> Eric
>
>
>
>
>
>
>  "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
>
> 20/03/2006 09:50 AM
>
> Please respond to
>  user@geronimo.apache.org
>
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
> How are you planning to use this JAAS component?  For example, is it a
>  LoginModule that you want to use to validate logins to the web
>  container?
>
>  Thanks,
>      Aaron
>
>  On 3/20/06, EricCho@kryos.com < EricCho@kryos.com> wrote:
>  >
>  >
>  > Sorry... let's try that with a subject heading
>  > .....
>  >
>  >
>  >
>  >  Eric Cho/Kryos
>  >
>  > 20/03/2006 09:44 AM
>  >
>  > To user@geronimo.apache.org
>  >
>  > cc
>  >
>  >
>  > Subject
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  Hi all,
>  >
>  >  I'm trying to port an app over to WAS CE (which we all know is 
geronimo with and ibm admin console).
>  >
>  > I have a JAAS component and I'm having trouble configuring it.
>  >
>  >  In tomcat it's as easy as opening the tomcat properties dialogue, 
going to the java tab and adding the following under java options:
>  >  -Djava.security.auth.login.config=C:\Tomcat 
5.5\conf\JAASConfig\thisSitesSecurity.config
>  >
>  >
>  >  How do I got about doing it in WAS CE? In the config.xml or the 
geromino-web.xml?
>  >
>  >  Any help would be appreciated,
>  >
>  > Eric
>  >
>  >
>  >
>  >
>  >
>
>



Re: JAAS configuration in geronimo

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
The error seems to be saying that it can't find com.mysql.jdbc.Driver in the
MySQL 3.0.15 JAR that you put in the repository.  It seems unlikely, but can
you run a "jar -tf" on that JAR and make sure that there's a
com/mysql/jdbc/Driver.class in there?  If there is, perhaps we have a bug
and we don't load the JAR correctly for the test.

I'm pretty sure this will work if you set up a JDBC pool in the console and
then just point your security realm to that instead of separately
configuring the JDBC JAR and connection settings in the security realm
screen.

Thanks,
     Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Thanks Aaron..... that's leading me in the right direction.....
>
> I'm having troubles setting up the security realm....
>
> I'm using the WAS CE console.... which pretty much looks like the geronimo
> console..
>
>
> I'm not exactly sure what the error message is asking for.   A dependency
> in the web app?  I wouldn't think so, because the security realm seems to be
> a totally separate component to the web app....
>
> Do you see any glaring errors?  Or is there something else i should be
> doing?
>
> Thanks,
> Eric
>
>
>
>
>
>
>
>  *"Aaron Mulder" <am...@alumni.princeton.edu>*
> Sent by: ammulder@gmail.com
>
> 20/03/2006 11:01 AM
>  Please respond to
> user@geronimo.apache.org
>
>   To
> user@geronimo.apache.org  cc
>
>  Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
> So we override the default JAAS file-based configuration mechanism
> with a configuration system of our own based on Geronimo components
> (GBeans).
>
> If you are doing this for a web application and you can use the normal
> J2EE login routines, you can configure your login module as a Geronimo
> security realm and let J2EE/Geronimo handle the login.
>
> If you are intentionally avoiding the J2EE login handling, then you
> probably need to rewrite your JAAS configuration as a Geronimo service
> configuration (we have GBeans that wrap login module configuration,
> etc.).  You'll also need to put your classes in a JAR in the
> repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
> will probably be a little painful to write the configuration plan, but
> hey, you only need to do it once.  :)
>
> If you're going to need to write the plan, can you post the relevent
> section from your existing JAAS config file?
>
> Thanks,
>    Aaron
>
> On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
> >
> >
> > Hi Aaron,
> >
> > Sorry, should have been more descriptive.
> >
> > I create a loginContext and pass it in the name of the config file and
> hand it the custom login call back handler.
> >
> > Then the login method is called; it goes back and grabs the user from a
> MySQL database.  If the user exists and the credentials fit, we figure out
> their role and send them on their way.  If not, it throws a Login Exception
> and punts them back to the login page.
> >
> >
> > Hopefully this helps.
> >
> > Thanks,
> > Eric
> >
> >
> >
> >
> >
> >
> >  "Aaron Mulder" <am...@alumni.princeton.edu>
> > Sent by: ammulder@gmail.com
> >
> > 20/03/2006 09:50 AM
> >
> > Please respond to
> >  user@geronimo.apache.org
> >
> >
> > To user@geronimo.apache.org
> >
> > cc
> >
> >
> > Subject Re: JAAS configuration in geronimo
> >
> >
> >
> >
> >
> >
> >
> >
> > How are you planning to use this JAAS component?  For example, is it a
> >  LoginModule that you want to use to validate logins to the web
> >  container?
> >
> >  Thanks,
> >      Aaron
> >
> >  On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
> >  >
> >  >
> >  > Sorry... let's try that with a subject heading
> >  > .....
> >  >
> >  >
> >  >
> >  >  Eric Cho/Kryos
> >  >
> >  > 20/03/2006 09:44 AM
> >  >
> >  > To user@geronimo.apache.org
> >  >
> >  > cc
> >  >
> >  >
> >  > Subject
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >  Hi all,
> >  >
> >  >  I'm trying to port an app over to WAS CE (which we all know is
> geronimo with and ibm admin console).
> >  >
> >  > I have a JAAS component and I'm having trouble configuring it.
> >  >
> >  >  In tomcat it's as easy as opening the tomcat properties dialogue,
> going to the java tab and adding the following under java options:
> >  >  -Djava.security.auth.login.config=C:\Tomcat
> 5.5\conf\JAASConfig\thisSitesSecurity.config
> >  >
> >  >
> >  >  How do I got about doing it in WAS CE? In the config.xml or the
> geromino-web.xml?
> >  >
> >  >  Any help would be appreciated,
> >  >
> >  > Eric
> >  >
> >  >
> >  >
> >  >
> >  >
> >
> >
>
>

Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
Ok, I think I got it working.

What I ended up doing was puting all the supporting JARs(ex spring.jar) 
into the /repository/login/jars/ directory.  I renamed them so that they 
all have the version that geronimo looks for (ex. spring-1.0.jar).  Then I 
went ahead and put the dependency of each jar in the geronimo-web.xml 
file.  (I've listed it below).

I've also JARed up all my class files and threw them into the same 
directory(thisSite-loginCode-1.0.jar). 

I'm not completely sure if I need those hidden file filters anymore......

So it looks like all the code that's being used by the application is from 
the dependencies aside from what's in the WebContent (jsf, jsp, css, 
images.....etc)

Like I said, it works but I'm not sure its the best way of doing things. 
Alternatives are welcome (seems like a messy way of doing things).  If 
not... this is my solution....minus some refactoring.

Regards,
Eric 

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0" configId=
"thisSite">
 
    <dependency>
                <groupId>login</groupId>
                <artifactId>thisSite-loginCode</artifactId>
                <version>1.0</version>
        </dependency>
 
        <dependency>
                <groupId>login</groupId>
                <artifactId>spring-mock</artifactId>
                <version>1.0</version>
        </dependency>
 
         <dependency>
                <groupId>login</groupId>
                <artifactId>spring</artifactId>
                <version>1.0</version>
        </dependency>
 
         <dependency>
                <groupId>login</groupId>
                <artifactId>jsf-impl</artifactId>
                <version>1.0</version>
        </dependency>
                 <dependency>
                <groupId>login</groupId>
                <artifactId>jsf-api</artifactId>
                <version>1.0</version>
        </dependency> 
 
        <dependency>
                <groupId>login</groupId>
                <artifactId>hibernate</artifactId>
                <version>3.0</version>
        </dependency>
 
                         <dependency>
                <groupId>login</groupId>
                <artifactId>mail</artifactId>
                <version>1.0</version>
        </dependency>
 
                                 <dependency>
                <groupId>login</groupId>
                <artifactId>dom4j</artifactId>
                <version>1.6</version>
        </dependency>
 
                                         <dependency>
                <groupId>login</groupId>
                <artifactId>ehcache</artifactId>
                <version>1.1</version>
        </dependency>
 
                                         <dependency>
                <groupId>login</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>3.1.11</version>
        </dependency>
 
 
                                                 <dependency>
                <groupId>login</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>3.1.11</version>
        </dependency>
 
                                                         <dependency>
                <groupId>login</groupId>
                <artifactId>jstl</artifactId>
                <version>1.0</version>
        </dependency>
 
                                                                 <
dependency>
                <groupId>login</groupId>
                <artifactId>antlr</artifactId>
                <version>2.7.5H3</version>
        </dependency>
 
    <hidden-classes><filter>org.springframework.</filter></hidden-classes>
    <hidden-classes><filter>antlr</filter></hidden-classes>
    <hidden-classes>
    <filter>javax.faces.el.</filter>
        </hidden-classes>
        <hidden-classes>
            <filter>org.hibernate.</filter>
        </hidden-classes>
        <hidden-classes>
            <filter>javax.mail.</filter>
        </hidden-classes>
        <hidden-classes>
            <filter>net.sf.ehcache.</filter>
        </hidden-classes>

    <context-root>/thisSite</context-root>
    <context-priority-classloader>false</context-priority-classloader>
 

    <gbean name="thisSite" class=
"org.apache.geronimo.security.realm.GenericSecurityRealm">
        <attribute name="realmName">thisSite</attribute>
        <reference name="ServerInfo">
            <gbean-name>
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-system/1.0/car,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo
</gbean-name>
        </reference>
        <reference name="LoginService">
            <gbean-name>
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-security/1.0/car,J2EEServer=geronimo,j2eeType=JaasLoginService,name=JaasLoginService
</gbean-name>
        </reference>

        <xml-reference name="LoginModuleConfiguration">
            <log:login-config xmlns:log=
"http://geronimo.apache.org/xml/ns/loginconfig-1.0">
                <log:login-module control-flag="REQUIRED" server-side=
"true" wrap-principals="false">
                    <log:login-domain-name>thisSite</log:login-domain-name
>
                    <log:login-module-class>com.company.thisSite.jaas.
thisSiteLoginModule</log:login-module-class>
                </log:login-module>
            </log:login-config>
        </xml-reference> 
    </gbean>
 
</web-app>





David Jencks <da...@yahoo.com> 
23/03/2006 02:54 PM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo







On Mar 23, 2006, at 10:15 AM, EricCho@kryos.com wrote:


I've now packaged all my classes in the JAR file which is supposed to 
contain only my login code. 
But now it's complaining that it can't find any of the spring classes. 

So, does this mean I should package the spring, hibernate and all the 
other jars within this thisSiteLoginCode-1.0.jar 

OR 

Does that mean I should rename the supporting jars (ex spring-1.0.jar) and 
put them in the /repository/login/jars/ directory?  Then put each of them 
as a dependency above the Login code dependency? 

OR 

Is there something else I should be doing? 

Probably, but it's difficult to tell what without knowing more about what 
you are doing now.  Can you post your geronimo plan?

thanks
david jencks


Thanks again, 
Eric 






David Jencks <da...@yahoo.com> 
22/03/2006 12:16 PM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo









On Mar 22, 2006, at 9:46 AM, EricCho@kryos.com wrote: 


Hi David, 

Thanks for the help..... but as with most things....."2 steps forward... 1 
step back" 

As you suggested, I put the security gbean at the end of my web deploy 
plan (geronimo-web.xml) and I put the login dependency at the top of the 
web app plan since it is just a single web app. 
This surely beats having a separate deploy plan for the security realm. 

At any rate, now when I attempt to go to the login page I get a series of 
NoClassDefFoundErrors.  I figure its because the class doesn't exist in 
the JAR file.  So, I tried adding the class it's complaining about into 
the JAR, but after every addition, it complains about another.  Shouldn't 
it be looking for the class in the WAR if it doesn't find it in the 
dependent JAR? 

It should, but due to the way the web classloaders in 1.0 and trunk work, 
it won't :-(  This is fixed in the (currently taken apart into small 
pieces spread all over the floor, i.e. not working) 1.1 branch. 

Do you recommend I just JAR up all the classes?   


yes, at least until 1.1 is available. 
Note: I do have the context priority classloader set to false in the web 
deploy plan. 


That's probably going to help things work :-) 

thanks 
david jencks 

Thanks again, 
Eric 



David Jencks <da...@yahoo.com> 
21/03/2006 12:32 PM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo











On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote: 


Thanks guys, 

I think I've made some headway.... although I'm still having problems. 
Here's the latest..... 

In the thisSiteLoginCode-1.0.jar I have the loginModule and custom 
userCallback classes (and a custom exception). 

In my custom loginModule, I create a callback array: 
        Callback[] callbacks = new Callback[3]; 
        callbacks[0] = new NameCallback("Enter user name"); 
        callbacks[1] = new PasswordCallback("Enter password",true); 
        callbacks[2] = new UserCallback(); 

then I ask the callbackHandler to handle it.... 

callBackHandler.handle(callbacks); 

Then it goes into the loginCallBackHandler and I iterate through the 
callback array 
    for (int i=0; i < callbacks.length; i++) 
    { 
        if (callbacks[i] instanceof NameCallback) 
        { 
            ((NameCallback)callbacks[i]).setName(getEmail()); 
        } 
        else if (callbacks[i] instanceof PasswordCallback) 
        { 
        blah blah 

        } 
       else if (callbacks[i] instanceof UserCallback) 
        { 
        ((UserCallback) callbacks[i]).setUser(retrievedUser); 
     } 
        else 
        { 
            throw new UnsupportedCallbackException(callbacks[i]); 
        } 
} 


It gets through i = 0 , then i=1 but when i =2 it seems as though 
"callbacks[2] instanceof UserCallback" doesn't work. 

I put some debug code in there 
(System.out.println(callbacks[2].toString());) and it does show the 
appropriate class name.   

So, I'm wondering if perhaps when the original UserCallback was 
instantiated and put into the callbacks array, it was the class from the 
separated jar file.  And now when it does the instanceof, is it possible 
that it's referencing the UserCallback in the packaged WAR file? 

yes, that is definitely a possibility.  If you have 
contextPriorityClassloading=true (I think that's the default) that is 
almost certainly happening. 
Has anyone else had a problem with this? 

yes, in various ways.  At least some fixes for it will be in 1.1. 
 Should I not be including the JARed classes in the WAR? 

I think that will help a lot.  I'm not exactly sure how many 
plans/configurations/application parts you have here.  If you have a 
single web app  what I would do is combine everything into one plan: take 
the gbean configurations out of the console-generated plan and put them at 
the end of your web app plan, and put the dependency at the beginning of 
your web app plan, and take the login module jar out of the WEB-INF/lib.  
This should make very sure that you login module classes are only loaded 
in one classloader. 

If this is not practical, you need to make sure that the login 
configuration is loaded as a parent of your application.  You can do this 
by including something like 

<import> 
  <groupId>foo</groupId> 
  <artifactId>bar</artifactId> 
  <version>42</version> 
</import> 

where the login configuration has configId="foo/bar/42/car" 

You can probably see why I think having only one plan is simpler :-) 

I hope the syntax here is sufficiently accurate, I've been immersed in 1.1 
where we have significantly changed the syntax.... 

hope this helps 
david jencks 


Thanks, 
Eric 


"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
21/03/2006 08:25 AM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo












The console does not yet let you specify a JAR where it should look
for the login module code -- there's an outstanding JIRA issue for
this.  So what you need to do is configure things in the console (but
don't have it try a login), and then instead of deploying the security
realm right there, have it generate a plan for you, put the
<dependency> element David described into the plan (at the top, just
inside the main element), and then save that to a file and deploy it
on the command line like:

java -jar bin/deployer.jar deploy my-security-plan.xml

Thanks,
   Aaron

On 3/21/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged the
> module, callback, callbackHandler and principal into a jar and threw it 
into
> the /repository/login/thisSiteLoginCode-1.0.jar.
>
> Assuming this is the geronimo repository, it should be in
> repository/login/jars/thisSiteLoginCode-1.0.jar
>
> The plan that defines the GenericSecurityRealm and the LoginModule gbean
> needs to include
>
> <dependency>
>   <groupId>login</groupId>
>   <artifactId>thisSiteLoginCode</artifactId>
>   <version>1.0</version>
> </dependency>
>
>
>
> Then I created a securty realm using the console defining, the module 
class,
> control flag to "requred", servier side to "servier side" and "no" 
support
> advanced mapping.
>
> Restarted the server and when I try a login, I get the following 
exception:
>
> org.apache.geronimo.common.GeronimoSecurityException:
> Unable to instantiate login module
> at
> 
org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there...... so 
what
> am I missing.
>
>
>
> <snip>
> I'm not exactly sure what the console does, so I recommend checking the
> plans it generates and posting them if the above doesn't work.
>
> thanks
> david jencks
>
>





Re: JAAS configuration in geronimo

Posted by David Jencks <da...@yahoo.com>.
On Mar 23, 2006, at 10:15 AM, EricCho@kryos.com wrote:

>
> I've now packaged all my classes in the JAR file which is supposed  
> to contain only my login code.
> But now it's complaining that it can't find any of the spring classes.
>
> So, does this mean I should package the spring, hibernate and all  
> the other jars within this thisSiteLoginCode-1.0.jar
>
> OR
>
> Does that mean I should rename the supporting jars (ex  
> spring-1.0.jar) and put them in the /repository/login/jars/  
> directory?  Then put each of them as a dependency above the Login  
> code dependency?
>
> OR
>
> Is there something else I should be doing?

Probably, but it's difficult to tell what without knowing more about  
what you are doing now.  Can you post your geronimo plan?

thanks
david jencks

>
> Thanks again,
> Eric
>
>
>
>
>
>
> David Jencks <da...@yahoo.com>
> 22/03/2006 12:16 PM
> Please respond to
> user@geronimo.apache.org
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
> On Mar 22, 2006, at 9:46 AM, EricCho@kryos.com wrote:
>
>
> Hi David,
>
> Thanks for the help..... but as with most things....."2 steps  
> forward... 1 step back"
>
> As you suggested, I put the security gbean at the end of my web  
> deploy plan (geronimo-web.xml) and I put the login dependency at  
> the top of the web app plan since it is just a single web app.
> This surely beats having a separate deploy plan for the security  
> realm.
>
> At any rate, now when I attempt to go to the login page I get a  
> series of NoClassDefFoundErrors.  I figure its because the class  
> doesn't exist in the JAR file.  So, I tried adding the class it's  
> complaining about into the JAR, but after every addition, it  
> complains about another.  Shouldn't it be looking for the class in  
> the WAR if it doesn't find it in the dependent JAR?
>
> It should, but due to the way the web classloaders in 1.0 and trunk  
> work, it won't :-(  This is fixed in the (currently taken apart  
> into small pieces spread all over the floor, i.e. not working) 1.1  
> branch.
>
> Do you recommend I just JAR up all the classes?
>
>
> yes, at least until 1.1 is available.
> Note: I do have the context priority classloader set to false in  
> the web deploy plan.
>
>
> That's probably going to help things work :-)
>
> thanks
> david jencks
>
> Thanks again,
> Eric
>
>
>
> David Jencks <da...@yahoo.com>
> 21/03/2006 12:32 PM
> Please respond to
> user@geronimo.apache.org
>
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
> On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote:
>
>
> Thanks guys,
>
> I think I've made some headway.... although I'm still having problems.
> Here's the latest.....
>
> In the thisSiteLoginCode-1.0.jar I have the loginModule and custom  
> userCallback classes (and a custom exception).
>
> In my custom loginModule, I create a callback array:
>         Callback[] callbacks = new Callback[3];
>         callbacks[0] = new NameCallback("Enter user name");
>         callbacks[1] = new PasswordCallback("Enter password",true);
>         callbacks[2] = new UserCallback();
>
> then I ask the callbackHandler to handle it....
>
> callBackHandler.handle(callbacks);
>
> Then it goes into the loginCallBackHandler and I iterate through  
> the callback array
>     for (int i=0; i < callbacks.length; i++)
>     {
>         if (callbacks[i] instanceof NameCallback)
>         {
>             ((NameCallback)callbacks[i]).setName(getEmail());
>         }
>         else if (callbacks[i] instanceof PasswordCallback)
>         {
>         blah blah
>
>         }
>        else if (callbacks[i] instanceof UserCallback)
>         {
>         ((UserCallback) callbacks[i]).setUser(retrievedUser);
>      }
>         else
>         {
>             throw new UnsupportedCallbackException(callbacks[i]);
>         }
> }
>
>
> It gets through i = 0 , then i=1 but when i =2 it seems as though  
> "callbacks[2] instanceof UserCallback" doesn't work.
>
> I put some debug code in there (System.out.println(callbacks 
> [2].toString());) and it does show the appropriate class name.
>
> So, I'm wondering if perhaps when the original UserCallback was  
> instantiated and put into the callbacks array, it was the class  
> from the separated jar file.  And now when it does the instanceof,  
> is it possible that it's referencing the UserCallback in the  
> packaged WAR file?
>
> yes, that is definitely a possibility.  If you have  
> contextPriorityClassloading=true (I think that's the default) that  
> is almost certainly happening.
> Has anyone else had a problem with this?
>
> yes, in various ways.  At least some fixes for it will be in 1.1.
>  Should I not be including the JARed classes in the WAR?
>
> I think that will help a lot.  I'm not exactly sure how many plans/ 
> configurations/application parts you have here.  If you have a  
> single web app  what I would do is combine everything into one  
> plan: take the gbean configurations out of the console-generated  
> plan and put them at the end of your web app plan, and put the  
> dependency at the beginning of your web app plan, and take the  
> login module jar out of the WEB-INF/lib.  This should make very  
> sure that you login module classes are only loaded in one classloader.
>
> If this is not practical, you need to make sure that the login  
> configuration is loaded as a parent of your application.  You can  
> do this by including something like
>
> <import>
>   <groupId>foo</groupId>
>   <artifactId>bar</artifactId>
>   <version>42</version>
> </import>
>
> where the login configuration has configId="foo/bar/42/car"
>
> You can probably see why I think having only one plan is simpler :-)
>
> I hope the syntax here is sufficiently accurate, I've been immersed  
> in 1.1 where we have significantly changed the syntax....
>
> hope this helps
> david jencks
>
>
> Thanks,
> Eric
>
>
> "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
> 21/03/2006 08:25 AM
> Please respond to
> user@geronimo.apache.org
>
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
>
> The console does not yet let you specify a JAR where it should look
> for the login module code -- there's an outstanding JIRA issue for
> this.  So what you need to do is configure things in the console (but
> don't have it try a login), and then instead of deploying the security
> realm right there, have it generate a plan for you, put the
> <dependency> element David described into the plan (at the top, just
> inside the main element), and then save that to a file and deploy it
> on the command line like:
>
> java -jar bin/deployer.jar deploy my-security-plan.xml
>
> Thanks,
>    Aaron
>
> On 3/21/06, David Jencks <da...@yahoo.com> wrote:
> >
> >
> > On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
> >
> > OK.....
> >
> > Since I've got a custom login module I've went ahead and packaged  
> the
> > module, callback, callbackHandler and principal into a jar and  
> threw it into
> > the /repository/login/thisSiteLoginCode-1.0.jar.
> >
> > Assuming this is the geronimo repository, it should be in
> > repository/login/jars/thisSiteLoginCode-1.0.jar
> >
> > The plan that defines the GenericSecurityRealm and the  
> LoginModule gbean
> > needs to include
> >
> > <dependency>
> >   <groupId>login</groupId>
> >   <artifactId>thisSiteLoginCode</artifactId>
> >   <version>1.0</version>
> > </dependency>
> >
> >
> >
> > Then I created a securty realm using the console defining, the  
> module class,
> > control flag to "requred", servier side to "servier side" and  
> "no" support
> > advanced mapping.
> >
> > Restarted the server and when I try a login, I get the following  
> exception:
> >
> > org.apache.geronimo.common.GeronimoSecurityException:
> > Unable to instantiate login module
> > at
> >  
> org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration. 
> getLoginModule(JassLoginModuleConfiguration.java:71)
> > ........
> > further down:
> >
> > Caused by: java.lang.ClassNotFoundException:
> > com.company.site.jaas.siteLoginModule.......
> >
> > I checked the common libraries and the jar seems to be  
> there...... so what
> > am I missing.
> >
> >
> >
> > <snip>
> > I'm not exactly sure what the console does, so I recommend  
> checking the
> > plans it generates and posting them if the above doesn't work.
> >
> > thanks
> > david jencks
> >
> >
>
>
>


Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
I've now packaged all my classes in the JAR file which is supposed to 
contain only my login code.
But now it's complaining that it can't find any of the spring classes.

So, does this mean I should package the spring, hibernate and all the 
other jars within this thisSiteLoginCode-1.0.jar 

OR

Does that mean I should rename the supporting jars (ex spring-1.0.jar) and 
put them in the /repository/login/jars/ directory?  Then put each of them 
as a dependency above the Login code dependency?

OR

Is there something else I should be doing?

Thanks again,
Eric







David Jencks <da...@yahoo.com> 
22/03/2006 12:16 PM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo







On Mar 22, 2006, at 9:46 AM, EricCho@kryos.com wrote:


Hi David, 

Thanks for the help..... but as with most things....."2 steps forward... 1 
step back" 

As you suggested, I put the security gbean at the end of my web deploy 
plan (geronimo-web.xml) and I put the login dependency at the top of the 
web app plan since it is just a single web app. 
This surely beats having a separate deploy plan for the security realm. 

At any rate, now when I attempt to go to the login page I get a series of 
NoClassDefFoundErrors.  I figure its because the class doesn't exist in 
the JAR file.  So, I tried adding the class it's complaining about into 
the JAR, but after every addition, it complains about another.  Shouldn't 
it be looking for the class in the WAR if it doesn't find it in the 
dependent JAR? 

It should, but due to the way the web classloaders in 1.0 and trunk work, 
it won't :-(  This is fixed in the (currently taken apart into small 
pieces spread all over the floor, i.e. not working) 1.1 branch.

Do you recommend I just JAR up all the classes?   


yes, at least until 1.1 is available.
Note: I do have the context priority classloader set to false in the web 
deploy plan. 


That's probably going to help things work :-)

thanks
david jencks

Thanks again, 
Eric 




David Jencks <da...@yahoo.com> 
21/03/2006 12:32 PM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo









On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote: 


Thanks guys, 

I think I've made some headway.... although I'm still having problems. 
Here's the latest..... 

In the thisSiteLoginCode-1.0.jar I have the loginModule and custom 
userCallback classes (and a custom exception). 

In my custom loginModule, I create a callback array: 
        Callback[] callbacks = new Callback[3]; 
        callbacks[0] = new NameCallback("Enter user name"); 
        callbacks[1] = new PasswordCallback("Enter password",true); 
        callbacks[2] = new UserCallback(); 

then I ask the callbackHandler to handle it.... 

callBackHandler.handle(callbacks); 

Then it goes into the loginCallBackHandler and I iterate through the 
callback array 
    for (int i=0; i < callbacks.length; i++) 
    { 
        if (callbacks[i] instanceof NameCallback) 
        { 
            ((NameCallback)callbacks[i]).setName(getEmail()); 
        } 
        else if (callbacks[i] instanceof PasswordCallback) 
        { 
        blah blah 

        } 
       else if (callbacks[i] instanceof UserCallback) 
        { 
        ((UserCallback) callbacks[i]).setUser(retrievedUser); 
     } 
        else 
        { 
            throw new UnsupportedCallbackException(callbacks[i]); 
        } 
} 


It gets through i = 0 , then i=1 but when i =2 it seems as though 
"callbacks[2] instanceof UserCallback" doesn't work. 

I put some debug code in there 
(System.out.println(callbacks[2].toString());) and it does show the 
appropriate class name.   

So, I'm wondering if perhaps when the original UserCallback was 
instantiated and put into the callbacks array, it was the class from the 
separated jar file.  And now when it does the instanceof, is it possible 
that it's referencing the UserCallback in the packaged WAR file? 

yes, that is definitely a possibility.  If you have 
contextPriorityClassloading=true (I think that's the default) that is 
almost certainly happening. 
Has anyone else had a problem with this? 

yes, in various ways.  At least some fixes for it will be in 1.1. 
 Should I not be including the JARed classes in the WAR? 

I think that will help a lot.  I'm not exactly sure how many 
plans/configurations/application parts you have here.  If you have a 
single web app  what I would do is combine everything into one plan: take 
the gbean configurations out of the console-generated plan and put them at 
the end of your web app plan, and put the dependency at the beginning of 
your web app plan, and take the login module jar out of the WEB-INF/lib.  
This should make very sure that you login module classes are only loaded 
in one classloader. 

If this is not practical, you need to make sure that the login 
configuration is loaded as a parent of your application.  You can do this 
by including something like 

<import> 
  <groupId>foo</groupId> 
  <artifactId>bar</artifactId> 
  <version>42</version> 
</import> 

where the login configuration has configId="foo/bar/42/car" 

You can probably see why I think having only one plan is simpler :-) 

I hope the syntax here is sufficiently accurate, I've been immersed in 1.1 
where we have significantly changed the syntax.... 

hope this helps 
david jencks 


Thanks, 
Eric 



"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
21/03/2006 08:25 AM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo










The console does not yet let you specify a JAR where it should look
for the login module code -- there's an outstanding JIRA issue for
this.  So what you need to do is configure things in the console (but
don't have it try a login), and then instead of deploying the security
realm right there, have it generate a plan for you, put the
<dependency> element David described into the plan (at the top, just
inside the main element), and then save that to a file and deploy it
on the command line like:

java -jar bin/deployer.jar deploy my-security-plan.xml

Thanks,
   Aaron

On 3/21/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged the
> module, callback, callbackHandler and principal into a jar and threw it 
into
> the /repository/login/thisSiteLoginCode-1.0.jar.
>
> Assuming this is the geronimo repository, it should be in
> repository/login/jars/thisSiteLoginCode-1.0.jar
>
> The plan that defines the GenericSecurityRealm and the LoginModule gbean
> needs to include
>
> <dependency>
>   <groupId>login</groupId>
>   <artifactId>thisSiteLoginCode</artifactId>
>   <version>1.0</version>
> </dependency>
>
>
>
> Then I created a securty realm using the console defining, the module 
class,
> control flag to "requred", servier side to "servier side" and "no" 
support
> advanced mapping.
>
> Restarted the server and when I try a login, I get the following 
exception:
>
> org.apache.geronimo.common.GeronimoSecurityException:
> Unable to instantiate login module
> at
> 
org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there...... so 
what
> am I missing.
>
>
>
> <snip>
> I'm not exactly sure what the console does, so I recommend checking the
> plans it generates and posting them if the above doesn't work.
>
> thanks
> david jencks
>
>




Re: JAAS configuration in geronimo

Posted by David Jencks <da...@yahoo.com>.
On Mar 22, 2006, at 9:46 AM, EricCho@kryos.com wrote:

>
> Hi David,
>
> Thanks for the help..... but as with most things....."2 steps  
> forward... 1 step back"
>
> As you suggested, I put the security gbean at the end of my web  
> deploy plan (geronimo-web.xml) and I put the login dependency at  
> the top of the web app plan since it is just a single web app.
> This surely beats having a separate deploy plan for the security  
> realm.
>
> At any rate, now when I attempt to go to the login page I get a  
> series of NoClassDefFoundErrors.  I figure its because the class  
> doesn't exist in the JAR file.  So, I tried adding the class it's  
> complaining about into the JAR, but after every addition, it  
> complains about another.  Shouldn't it be looking for the class in  
> the WAR if it doesn't find it in the dependent JAR?

It should, but due to the way the web classloaders in 1.0 and trunk  
work, it won't :-(  This is fixed in the (currently taken apart into  
small pieces spread all over the floor, i.e. not working) 1.1 branch.
>
> Do you recommend I just JAR up all the classes?
>

yes, at least until 1.1 is available.
> Note: I do have the context priority classloader set to false in  
> the web deploy plan.
>

That's probably going to help things work :-)

thanks
david jencks

> Thanks again,
> Eric
>
>
>
>
> David Jencks <da...@yahoo.com>
> 21/03/2006 12:32 PM
> Please respond to
> user@geronimo.apache.org
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
> On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote:
>
>
> Thanks guys,
>
> I think I've made some headway.... although I'm still having problems.
> Here's the latest.....
>
> In the thisSiteLoginCode-1.0.jar I have the loginModule and custom  
> userCallback classes (and a custom exception).
>
> In my custom loginModule, I create a callback array:
>         Callback[] callbacks = new Callback[3];
>         callbacks[0] = new NameCallback("Enter user name");
>         callbacks[1] = new PasswordCallback("Enter password",true);
>         callbacks[2] = new UserCallback();
>
> then I ask the callbackHandler to handle it....
>
> callBackHandler.handle(callbacks);
>
> Then it goes into the loginCallBackHandler and I iterate through  
> the callback array
>     for (int i=0; i < callbacks.length; i++)
>     {
>         if (callbacks[i] instanceof NameCallback)
>         {
>             ((NameCallback)callbacks[i]).setName(getEmail());
>         }
>         else if (callbacks[i] instanceof PasswordCallback)
>         {
>         blah blah
>
>         }
>        else if (callbacks[i] instanceof UserCallback)
>         {
>         ((UserCallback) callbacks[i]).setUser(retrievedUser);
>      }
>         else
>         {
>             throw new UnsupportedCallbackException(callbacks[i]);
>         }
> }
>
>
> It gets through i = 0 , then i=1 but when i =2 it seems as though  
> "callbacks[2] instanceof UserCallback" doesn't work.
>
> I put some debug code in there (System.out.println(callbacks 
> [2].toString());) and it does show the appropriate class name.
>
> So, I'm wondering if perhaps when the original UserCallback was  
> instantiated and put into the callbacks array, it was the class  
> from the separated jar file.  And now when it does the instanceof,  
> is it possible that it's referencing the UserCallback in the  
> packaged WAR file?
>
> yes, that is definitely a possibility.  If you have  
> contextPriorityClassloading=true (I think that's the default) that  
> is almost certainly happening.
> Has anyone else had a problem with this?
>
> yes, in various ways.  At least some fixes for it will be in 1.1.
>  Should I not be including the JARed classes in the WAR?
>
> I think that will help a lot.  I'm not exactly sure how many plans/ 
> configurations/application parts you have here.  If you have a  
> single web app  what I would do is combine everything into one  
> plan: take the gbean configurations out of the console-generated  
> plan and put them at the end of your web app plan, and put the  
> dependency at the beginning of your web app plan, and take the  
> login module jar out of the WEB-INF/lib.  This should make very  
> sure that you login module classes are only loaded in one classloader.
>
> If this is not practical, you need to make sure that the login  
> configuration is loaded as a parent of your application.  You can  
> do this by including something like
>
> <import>
>   <groupId>foo</groupId>
>   <artifactId>bar</artifactId>
>   <version>42</version>
> </import>
>
> where the login configuration has configId="foo/bar/42/car"
>
> You can probably see why I think having only one plan is simpler :-)
>
> I hope the syntax here is sufficiently accurate, I've been immersed  
> in 1.1 where we have significantly changed the syntax....
>
> hope this helps
> david jencks
>
>
> Thanks,
> Eric
>
>
>
> "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
> 21/03/2006 08:25 AM
> Please respond to
> user@geronimo.apache.org
>
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
> The console does not yet let you specify a JAR where it should look
> for the login module code -- there's an outstanding JIRA issue for
> this.  So what you need to do is configure things in the console (but
> don't have it try a login), and then instead of deploying the security
> realm right there, have it generate a plan for you, put the
> <dependency> element David described into the plan (at the top, just
> inside the main element), and then save that to a file and deploy it
> on the command line like:
>
> java -jar bin/deployer.jar deploy my-security-plan.xml
>
> Thanks,
>    Aaron
>
> On 3/21/06, David Jencks <da...@yahoo.com> wrote:
> >
> >
> > On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
> >
> > OK.....
> >
> > Since I've got a custom login module I've went ahead and packaged  
> the
> > module, callback, callbackHandler and principal into a jar and  
> threw it into
> > the /repository/login/thisSiteLoginCode-1.0.jar.
> >
> > Assuming this is the geronimo repository, it should be in
> > repository/login/jars/thisSiteLoginCode-1.0.jar
> >
> > The plan that defines the GenericSecurityRealm and the  
> LoginModule gbean
> > needs to include
> >
> > <dependency>
> >   <groupId>login</groupId>
> >   <artifactId>thisSiteLoginCode</artifactId>
> >   <version>1.0</version>
> > </dependency>
> >
> >
> >
> > Then I created a securty realm using the console defining, the  
> module class,
> > control flag to "requred", servier side to "servier side" and  
> "no" support
> > advanced mapping.
> >
> > Restarted the server and when I try a login, I get the following  
> exception:
> >
> > org.apache.geronimo.common.GeronimoSecurityException:
> > Unable to instantiate login module
> > at
> >  
> org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration. 
> getLoginModule(JassLoginModuleConfiguration.java:71)
> > ........
> > further down:
> >
> > Caused by: java.lang.ClassNotFoundException:
> > com.company.site.jaas.siteLoginModule.......
> >
> > I checked the common libraries and the jar seems to be  
> there...... so what
> > am I missing.
> >
> >
> >
> > <snip>
> > I'm not exactly sure what the console does, so I recommend  
> checking the
> > plans it generates and posting them if the above doesn't work.
> >
> > thanks
> > david jencks
> >
> >
>
>


Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
Hi David,

Thanks for the help..... but as with most things....."2 steps forward... 1 
step back"

As you suggested, I put the security gbean at the end of my web deploy 
plan (geronimo-web.xml) and I put the login dependency at the top of the 
web app plan since it is just a single web app.
This surely beats having a separate deploy plan for the security realm.

At any rate, now when I attempt to go to the login page I get a series of 
NoClassDefFoundErrors.  I figure its because the class doesn't exist in 
the JAR file.  So, I tried adding the class it's complaining about into 
the JAR, but after every addition, it complains about another.  Shouldn't 
it be looking for the class in the WAR if it doesn't find it in the 
dependent JAR?

Do you recommend I just JAR up all the classes? 

Note: I do have the context priority classloader set to false in the web 
deploy plan.

Thanks again,
Eric





David Jencks <da...@yahoo.com> 
21/03/2006 12:32 PM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo







On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote:


Thanks guys, 

I think I've made some headway.... although I'm still having problems. 
Here's the latest..... 

In the thisSiteLoginCode-1.0.jar I have the loginModule and custom 
userCallback classes (and a custom exception). 

In my custom loginModule, I create a callback array: 
        Callback[] callbacks = new Callback[3]; 
        callbacks[0] = new NameCallback("Enter user name"); 
        callbacks[1] = new PasswordCallback("Enter password",true); 
        callbacks[2] = new UserCallback(); 

then I ask the callbackHandler to handle it.... 

callBackHandler.handle(callbacks); 

Then it goes into the loginCallBackHandler and I iterate through the 
callback array 
    for (int i=0; i < callbacks.length; i++) 
    { 
        if (callbacks[i] instanceof NameCallback) 
        { 
            ((NameCallback)callbacks[i]).setName(getEmail()); 
        } 
        else if (callbacks[i] instanceof PasswordCallback) 
        { 
        blah blah 

        } 
       else if (callbacks[i] instanceof UserCallback) 
        { 
        ((UserCallback) callbacks[i]).setUser(retrievedUser); 
     } 
        else 
        { 
            throw new UnsupportedCallbackException(callbacks[i]); 
        } 
} 


It gets through i = 0 , then i=1 but when i =2 it seems as though 
"callbacks[2] instanceof UserCallback" doesn't work. 

I put some debug code in there 
(System.out.println(callbacks[2].toString());) and it does show the 
appropriate class name.   

So, I'm wondering if perhaps when the original UserCallback was 
instantiated and put into the callbacks array, it was the class from the 
separated jar file.  And now when it does the instanceof, is it possible 
that it's referencing the UserCallback in the packaged WAR file? 

yes, that is definitely a possibility.  If you have 
contextPriorityClassloading=true (I think that's the default) that is 
almost certainly happening.
Has anyone else had a problem with this? 

yes, in various ways.  At least some fixes for it will be in 1.1.
 Should I not be including the JARed classes in the WAR? 

I think that will help a lot.  I'm not exactly sure how many 
plans/configurations/application parts you have here.  If you have a 
single web app  what I would do is combine everything into one plan: take 
the gbean configurations out of the console-generated plan and put them at 
the end of your web app plan, and put the dependency at the beginning of 
your web app plan, and take the login module jar out of the WEB-INF/lib.  
This should make very sure that you login module classes are only loaded 
in one classloader.

If this is not practical, you need to make sure that the login 
configuration is loaded as a parent of your application.  You can do this 
by including something like

<import>
  <groupId>foo</groupId>
  <artifactId>bar</artifactId>
  <version>42</version>
</import>

where the login configuration has configId="foo/bar/42/car"

You can probably see why I think having only one plan is simpler :-)

I hope the syntax here is sufficiently accurate, I've been immersed in 1.1 
where we have significantly changed the syntax....

hope this helps
david jencks


Thanks, 
Eric 




"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
21/03/2006 08:25 AM 

Please respond to
user@geronimo.apache.org



To
user@geronimo.apache.org 
cc

Subject
Re: JAAS configuration in geronimo








The console does not yet let you specify a JAR where it should look
for the login module code -- there's an outstanding JIRA issue for
this.  So what you need to do is configure things in the console (but
don't have it try a login), and then instead of deploying the security
realm right there, have it generate a plan for you, put the
<dependency> element David described into the plan (at the top, just
inside the main element), and then save that to a file and deploy it
on the command line like:

java -jar bin/deployer.jar deploy my-security-plan.xml

Thanks,
   Aaron

On 3/21/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged the
> module, callback, callbackHandler and principal into a jar and threw it 
into
> the /repository/login/thisSiteLoginCode-1.0.jar.
>
> Assuming this is the geronimo repository, it should be in
> repository/login/jars/thisSiteLoginCode-1.0.jar
>
> The plan that defines the GenericSecurityRealm and the LoginModule gbean
> needs to include
>
> <dependency>
>   <groupId>login</groupId>
>   <artifactId>thisSiteLoginCode</artifactId>
>   <version>1.0</version>
> </dependency>
>
>
>
> Then I created a securty realm using the console defining, the module 
class,
> control flag to "requred", servier side to "servier side" and "no" 
support
> advanced mapping.
>
> Restarted the server and when I try a login, I get the following 
exception:
>
> org.apache.geronimo.common.GeronimoSecurityException:
> Unable to instantiate login module
> at
> 
org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there...... so 
what
> am I missing.
>
>
>
> <snip>
> I'm not exactly sure what the console does, so I recommend checking the
> plans it generates and posting them if the above doesn't work.
>
> thanks
> david jencks
>
>



Re: JAAS configuration in geronimo

Posted by David Jencks <da...@yahoo.com>.
On Mar 21, 2006, at 10:40 AM, EricCho@kryos.com wrote:

>
> Thanks guys,
>
> I think I've made some headway.... although I'm still having problems.
> Here's the latest.....
>
> In the thisSiteLoginCode-1.0.jar I have the loginModule and custom  
> userCallback classes (and a custom exception).
>
> In my custom loginModule, I create a callback array:
>         Callback[] callbacks = new Callback[3];
>         callbacks[0] = new NameCallback("Enter user name");
>         callbacks[1] = new PasswordCallback("Enter password",true);
>         callbacks[2] = new UserCallback();
>
> then I ask the callbackHandler to handle it....
>
> callBackHandler.handle(callbacks);
>
> Then it goes into the loginCallBackHandler and I iterate through  
> the callback array
>     for (int i=0; i < callbacks.length; i++)
>     {
>         if (callbacks[i] instanceof NameCallback)
>         {
>             ((NameCallback)callbacks[i]).setName(getEmail());
>         }
>         else if (callbacks[i] instanceof PasswordCallback)
>         {
>         blah blah
>
>         }
>        else if (callbacks[i] instanceof UserCallback)
>         {
>         ((UserCallback) callbacks[i]).setUser(retrievedUser);
>      }
>         else
>         {
>             throw new UnsupportedCallbackException(callbacks[i]);
>         }
> }
>
>
> It gets through i = 0 , then i=1 but when i =2 it seems as though  
> "callbacks[2] instanceof UserCallback" doesn't work.
>
> I put some debug code in there (System.out.println(callbacks 
> [2].toString());) and it does show the appropriate class name.
>
> So, I'm wondering if perhaps when the original UserCallback was  
> instantiated and put into the callbacks array, it was the class  
> from the separated jar file.  And now when it does the instanceof,  
> is it possible that it's referencing the UserCallback in the  
> packaged WAR file?

yes, that is definitely a possibility.  If you have  
contextPriorityClassloading=true (I think that's the default) that is  
almost certainly happening.
> Has anyone else had a problem with this?

yes, in various ways.  At least some fixes for it will be in 1.1.
>  Should I not be including the JARed classes in the WAR?

I think that will help a lot.  I'm not exactly sure how many plans/ 
configurations/application parts you have here.  If you have a single  
web app  what I would do is combine everything into one plan: take  
the gbean configurations out of the console-generated plan and put  
them at the end of your web app plan, and put the dependency at the  
beginning of your web app plan, and take the login module jar out of  
the WEB-INF/lib.  This should make very sure that you login module  
classes are only loaded in one classloader.

If this is not practical, you need to make sure that the login  
configuration is loaded as a parent of your application.  You can do  
this by including something like

<import>
   <groupId>foo</groupId>
   <artifactId>bar</artifactId>
   <version>42</version>
</import>

where the login configuration has configId="foo/bar/42/car"

You can probably see why I think having only one plan is simpler :-)

I hope the syntax here is sufficiently accurate, I've been immersed  
in 1.1 where we have significantly changed the syntax....

hope this helps
david jencks

>
> Thanks,
> Eric
>
>
>
>
> "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
> 21/03/2006 08:25 AM
> Please respond to
> user@geronimo.apache.org
>
>
> To
> user@geronimo.apache.org
> cc
> Subject
> Re: JAAS configuration in geronimo
>
>
>
>
>
> The console does not yet let you specify a JAR where it should look
> for the login module code -- there's an outstanding JIRA issue for
> this.  So what you need to do is configure things in the console (but
> don't have it try a login), and then instead of deploying the security
> realm right there, have it generate a plan for you, put the
> <dependency> element David described into the plan (at the top, just
> inside the main element), and then save that to a file and deploy it
> on the command line like:
>
> java -jar bin/deployer.jar deploy my-security-plan.xml
>
> Thanks,
>    Aaron
>
> On 3/21/06, David Jencks <da...@yahoo.com> wrote:
> >
> >
> > On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
> >
> > OK.....
> >
> > Since I've got a custom login module I've went ahead and packaged  
> the
> > module, callback, callbackHandler and principal into a jar and  
> threw it into
> > the /repository/login/thisSiteLoginCode-1.0.jar.
> >
> > Assuming this is the geronimo repository, it should be in
> > repository/login/jars/thisSiteLoginCode-1.0.jar
> >
> > The plan that defines the GenericSecurityRealm and the  
> LoginModule gbean
> > needs to include
> >
> > <dependency>
> >   <groupId>login</groupId>
> >   <artifactId>thisSiteLoginCode</artifactId>
> >   <version>1.0</version>
> > </dependency>
> >
> >
> >
> > Then I created a securty realm using the console defining, the  
> module class,
> > control flag to "requred", servier side to "servier side" and  
> "no" support
> > advanced mapping.
> >
> > Restarted the server and when I try a login, I get the following  
> exception:
> >
> > org.apache.geronimo.common.GeronimoSecurityException:
> > Unable to instantiate login module
> > at
> >  
> org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration. 
> getLoginModule(JassLoginModuleConfiguration.java:71)
> > ........
> > further down:
> >
> > Caused by: java.lang.ClassNotFoundException:
> > com.company.site.jaas.siteLoginModule.......
> >
> > I checked the common libraries and the jar seems to be  
> there...... so what
> > am I missing.
> >
> >
> >
> > <snip>
> > I'm not exactly sure what the console does, so I recommend  
> checking the
> > plans it generates and posting them if the above doesn't work.
> >
> > thanks
> > david jencks
> >
> >
>


Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
Thanks guys,

I think I've made some headway.... although I'm still having problems.
Here's the latest.....

In the thisSiteLoginCode-1.0.jar I have the loginModule and custom 
userCallback classes (and a custom exception).

In my custom loginModule, I create a callback array:
        Callback[] callbacks = new Callback[3];
        callbacks[0] = new NameCallback("Enter user name");
        callbacks[1] = new PasswordCallback("Enter password",true);
        callbacks[2] = new UserCallback();

then I ask the callbackHandler to handle it....

callBackHandler.handle(callbacks);

Then it goes into the loginCallBackHandler and I iterate through the 
callback array
    for (int i=0; i < callbacks.length; i++)
    {
        if (callbacks[i] instanceof NameCallback)
        {
            ((NameCallback)callbacks[i]).setName(getEmail());
        }
        else if (callbacks[i] instanceof PasswordCallback)
        {
        blah blah

        }
       else if (callbacks[i] instanceof UserCallback)
        {
        ((UserCallback) callbacks[i]).setUser(retrievedUser);
     }
        else
        {
            throw new UnsupportedCallbackException(callbacks[i]);
        }
}


It gets through i = 0 , then i=1 but when i =2 it seems as though 
"callbacks[2] instanceof UserCallback" doesn't work.

I put some debug code in there 
(System.out.println(callbacks[2].toString());) and it does show the 
appropriate class name. 

So, I'm wondering if perhaps when the original UserCallback was 
instantiated and put into the callbacks array, it was the class from the 
separated jar file.  And now when it does the instanceof, is it possible 
that it's referencing the UserCallback in the packaged WAR file?
Has anyone else had a problem with this?  Should I not be including the 
JARed classes in the WAR?

Thanks,
Eric





"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
21/03/2006 08:25 AM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo






The console does not yet let you specify a JAR where it should look
for the login module code -- there's an outstanding JIRA issue for
this.  So what you need to do is configure things in the console (but
don't have it try a login), and then instead of deploying the security
realm right there, have it generate a plan for you, put the
<dependency> element David described into the plan (at the top, just
inside the main element), and then save that to a file and deploy it
on the command line like:

java -jar bin/deployer.jar deploy my-security-plan.xml

Thanks,
    Aaron

On 3/21/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged the
> module, callback, callbackHandler and principal into a jar and threw it 
into
> the /repository/login/thisSiteLoginCode-1.0.jar.
>
> Assuming this is the geronimo repository, it should be in
> repository/login/jars/thisSiteLoginCode-1.0.jar
>
> The plan that defines the GenericSecurityRealm and the LoginModule gbean
> needs to include
>
> <dependency>
>   <groupId>login</groupId>
>   <artifactId>thisSiteLoginCode</artifactId>
>   <version>1.0</version>
> </dependency>
>
>
>
> Then I created a securty realm using the console defining, the module 
class,
> control flag to "requred", servier side to "servier side" and "no" 
support
> advanced mapping.
>
> Restarted the server and when I try a login, I get the following 
exception:
>
> org.apache.geronimo.common.GeronimoSecurityException:
> Unable to instantiate login module
> at
> 
org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there...... so 
what
> am I missing.
>
>
>
> <snip>
> I'm not exactly sure what the console does, so I recommend checking the
> plans it generates and posting them if the above doesn't work.
>
> thanks
> david jencks
>
>


Re: JAAS configuration in geronimo

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
The console does not yet let you specify a JAR where it should look
for the login module code -- there's an outstanding JIRA issue for
this.  So what you need to do is configure things in the console (but
don't have it try a login), and then instead of deploying the security
realm right there, have it generate a plan for you, put the
<dependency> element David described into the plan (at the top, just
inside the main element), and then save that to a file and deploy it
on the command line like:

java -jar bin/deployer.jar deploy my-security-plan.xml

Thanks,
    Aaron

On 3/21/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:
>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged the
> module, callback, callbackHandler and principal into a jar and threw it into
> the /repository/login/thisSiteLoginCode-1.0.jar.
>
> Assuming this is the geronimo repository, it should be in
> repository/login/jars/thisSiteLoginCode-1.0.jar
>
> The plan that defines the GenericSecurityRealm and the LoginModule gbean
> needs to include
>
> <dependency>
>   <groupId>login</groupId>
>   <artifactId>thisSiteLoginCode</artifactId>
>   <version>1.0</version>
> </dependency>
>
>
>
> Then I created a securty realm using the console defining, the module class,
> control flag to "requred", servier side to "servier side" and "no" support
> advanced mapping.
>
> Restarted the server and when I try a login, I get the following exception:
>
> org.apache.geronimo.common.GeronimoSecurityException:
> Unable to instantiate login module
> at
> org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there...... so what
> am I missing.
>
>
>
> <snip>
> I'm not exactly sure what the console does, so I recommend checking the
> plans it generates and posting them if the above doesn't work.
>
> thanks
> david jencks
>
>

Re: JAAS configuration in geronimo

Posted by David Jencks <da...@yahoo.com>.
On Mar 20, 2006, at 6:50 PM, EricCho@kryos.com wrote:

>
> OK.....
>
> Since I've got a custom login module I've went ahead and packaged  
> the module, callback, callbackHandler and principal into a jar and  
> threw it into the /repository/login/thisSiteLoginCode-1.0.jar.

Assuming this is the geronimo repository, it should be in repository/ 
login/jars/thisSiteLoginCode-1.0.jar

The plan that defines the GenericSecurityRealm and the LoginModule  
gbean needs to include

<dependency>
   <groupId>login</groupId>
   <artifactId>thisSiteLoginCode</artifactId>
   <version>1.0</version>
</dependency>

>
> Then I created a securty realm using the console defining, the  
> module class, control flag to "requred", servier side to "servier  
> side" and "no" support advanced mapping.
>
> Restarted the server and when I try a login, I get the following  
> exception:
>
> org.apache.geronimo.common.GeronimoSecurityException: Unable to  
> instantiate login module
> at  
> org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration. 
> getLoginModule(JassLoginModuleConfiguration.java:71)
> ........
> further down:
>
> Caused by: java.lang.ClassNotFoundException:   
> com.company.site.jaas.siteLoginModule.......
>
> I checked the common libraries and the jar seems to be there......  
> so what am I missing.
>
>
>
> <snip>

I'm not exactly sure what the console does, so I recommend checking  
the plans it generates and posting them if the above doesn't work.

thanks
david jencks


Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
OK.....

Since I've got a custom login module I've went ahead and packaged the 
module, callback, callbackHandler and principal into a jar and threw it 
into the /repository/login/thisSiteLoginCode-1.0.jar.

Then I created a securty realm using the console defining, the module 
class, control flag to "requred", servier side to "servier side" and "no" 
support advanced mapping.

Restarted the server and when I try a login, I get the following 
exception:

org.apache.geronimo.common.GeronimoSecurityException: Unable to 
instantiate login module
at 
org.apache.geronimo.security.jaas.server.JaasLoginModuleConfiguration.getLoginModule(JassLoginModuleConfiguration.java:71)
........
further down:

Caused by: java.lang.ClassNotFoundException: 
com.company.site.jaas.siteLoginModule.......

I checked the common libraries and the jar seems to be there...... so what 
am I missing. 








"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
20/03/2006 11:01 AM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo






So we override the default JAAS file-based configuration mechanism
with a configuration system of our own based on Geronimo components
(GBeans).

If you are doing this for a web application and you can use the normal
J2EE login routines, you can configure your login module as a Geronimo
security realm and let J2EE/Geronimo handle the login.

If you are intentionally avoiding the J2EE login handling, then you
probably need to rewrite your JAAS configuration as a Geronimo service
configuration (we have GBeans that wrap login module configuration,
etc.).  You'll also need to put your classes in a JAR in the
repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
will probably be a little painful to write the configuration plan, but
hey, you only need to do it once.  :)

If you're going to need to write the plan, can you post the relevent
section from your existing JAAS config file?

Thanks,
    Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Hi Aaron,
>
> Sorry, should have been more descriptive.
>
> I create a loginContext and pass it in the name of the config file and 
hand it the custom login call back handler.
>
> Then the login method is called; it goes back and grabs the user from a 
MySQL database.  If the user exists and the credentials fit, we figure out 
their role and send them on their way.  If not, it throws a Login 
Exception and punts them back to the login page.
>
>
> Hopefully this helps.
>
> Thanks,
> Eric
>
>
>
>
>
>
>  "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
>
> 20/03/2006 09:50 AM
>
> Please respond to
>  user@geronimo.apache.org
>
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
> How are you planning to use this JAAS component?  For example, is it a
>  LoginModule that you want to use to validate logins to the web
>  container?
>
>  Thanks,
>      Aaron
>
>  On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>  >
>  >
>  > Sorry... let's try that with a subject heading
>  > .....
>  >
>  >
>  >
>  >  Eric Cho/Kryos
>  >
>  > 20/03/2006 09:44 AM
>  >
>  > To user@geronimo.apache.org
>  >
>  > cc
>  >
>  >
>  > Subject
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  Hi all,
>  >
>  >  I'm trying to port an app over to WAS CE (which we all know is 
geronimo with and ibm admin console).
>  >
>  > I have a JAAS component and I'm having trouble configuring it.
>  >
>  >  In tomcat it's as easy as opening the tomcat properties dialogue, 
going to the java tab and adding the following under java options:
>  >  -Djava.security.auth.login.config=C:\Tomcat 
5.5\conf\JAASConfig\thisSitesSecurity.config
>  >
>  >
>  >  How do I got about doing it in WAS CE? In the config.xml or the 
geromino-web.xml?
>  >
>  >  Any help would be appreciated,
>  >
>  > Eric
>  >
>  >
>  >
>  >
>  >
>
>


Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
Thanks Aaron..... that's leading me in the right direction.....

I'm having troubles setting up the security realm....

I'm using the WAS CE console.... which pretty much looks like the geronimo 
console..


I'm not exactly sure what the error message is asking for.   A dependency 
in the web app?  I wouldn't think so, because the security realm seems to 
be a totally separate component to the web app....

Do you see any glaring errors?  Or is there something else i should be 
doing?

Thanks,
Eric








"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
20/03/2006 11:01 AM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo






So we override the default JAAS file-based configuration mechanism
with a configuration system of our own based on Geronimo components
(GBeans).

If you are doing this for a web application and you can use the normal
J2EE login routines, you can configure your login module as a Geronimo
security realm and let J2EE/Geronimo handle the login.

If you are intentionally avoiding the J2EE login handling, then you
probably need to rewrite your JAAS configuration as a Geronimo service
configuration (we have GBeans that wrap login module configuration,
etc.).  You'll also need to put your classes in a JAR in the
repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
will probably be a little painful to write the configuration plan, but
hey, you only need to do it once.  :)

If you're going to need to write the plan, can you post the relevent
section from your existing JAAS config file?

Thanks,
    Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Hi Aaron,
>
> Sorry, should have been more descriptive.
>
> I create a loginContext and pass it in the name of the config file and 
hand it the custom login call back handler.
>
> Then the login method is called; it goes back and grabs the user from a 
MySQL database.  If the user exists and the credentials fit, we figure out 
their role and send them on their way.  If not, it throws a Login 
Exception and punts them back to the login page.
>
>
> Hopefully this helps.
>
> Thanks,
> Eric
>
>
>
>
>
>
>  "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
>
> 20/03/2006 09:50 AM
>
> Please respond to
>  user@geronimo.apache.org
>
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
> How are you planning to use this JAAS component?  For example, is it a
>  LoginModule that you want to use to validate logins to the web
>  container?
>
>  Thanks,
>      Aaron
>
>  On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>  >
>  >
>  > Sorry... let's try that with a subject heading
>  > .....
>  >
>  >
>  >
>  >  Eric Cho/Kryos
>  >
>  > 20/03/2006 09:44 AM
>  >
>  > To user@geronimo.apache.org
>  >
>  > cc
>  >
>  >
>  > Subject
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  Hi all,
>  >
>  >  I'm trying to port an app over to WAS CE (which we all know is 
geronimo with and ibm admin console).
>  >
>  > I have a JAAS component and I'm having trouble configuring it.
>  >
>  >  In tomcat it's as easy as opening the tomcat properties dialogue, 
going to the java tab and adding the following under java options:
>  >  -Djava.security.auth.login.config=C:\Tomcat 
5.5\conf\JAASConfig\thisSitesSecurity.config
>  >
>  >
>  >  How do I got about doing it in WAS CE? In the config.xml or the 
geromino-web.xml?
>  >
>  >  Any help would be appreciated,
>  >
>  > Eric
>  >
>  >
>  >
>  >
>  >
>
>


Re: JAAS configuration in geronimo

Posted by Yeray Cabrera <ye...@integraas.com>.
Hi all,

I have a problem with my custom security realm.

I get deploy my web-app with my custom security-realm (including 
dependencies, ...). It work fine, but when in my code I run 
HttpServletRequest.isUserInRole("role"), always return false.

I debugged my code ... userPrincipal had the correct name and subjects 
but roles is null (is a JAASTomcatPrincipal).

Then, I debugged with geronimo source and I saw that my web-app used the 
org.apache.geronimo.tomcat.realm.TomcatGeronimoRealm and should use 
org.apache.geronimo.tomcat.realm.TomcatJAASRealm to assign  the roles to 
JAASTomcatPrincipal whit the subject.

Looking for wiki I saw  http://wiki.apache.org/geronimo/Tomcat and I put 
this code in my geronimo-web.xml plan:

....
    <container-config container="Tomcat">
        <config-param 
name="TomcatJAASRealm">TomcatJAASRealm</config-param>      
    </container-config>
....
    <gbean name="TomcatJAASRealm" 
class="org.apache.geronimo.tomcat.RealmGBean">
        <attribute 
name="className">org.apache.geronimo.tomcat.realm.TomcatJAASRealm</attribute>
        <attribute name="initParams">
            userClassNames=com.ias.ibms.auth.IBMSUser
            roleClassNames=com.ias.ibms.auth.IBMSRole
        </attribute>
    </gbean>

But don't work :(

Somebody Know how I can assign to use TomcatJAASRealm instead of  
TomcatGeronimoRealm

    Thanks

    Yeray Cabrera!

Aaron Mulder escribió:
> So we override the default JAAS file-based configuration mechanism
> with a configuration system of our own based on Geronimo components
> (GBeans).
>
> If you are doing this for a web application and you can use the normal
> J2EE login routines, you can configure your login module as a Geronimo
> security realm and let J2EE/Geronimo handle the login.
>
> If you are intentionally avoiding the J2EE login handling, then you
> probably need to rewrite your JAAS configuration as a Geronimo service
> configuration (we have GBeans that wrap login module configuration,
> etc.).  You'll also need to put your classes in a JAR in the
> repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
> will probably be a little painful to write the configuration plan, but
> hey, you only need to do it once.  :)
>
> If you're going to need to write the plan, can you post the relevent
> section from your existing JAAS config file?
>
> Thanks,
>     Aaron
>
> On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>   
>> Hi Aaron,
>>
>> Sorry, should have been more descriptive.
>>
>> I create a loginContext and pass it in the name of the config file and hand it the custom login call back handler.
>>
>> Then the login method is called; it goes back and grabs the user from a MySQL database.  If the user exists and the credentials fit, we figure out their role and send them on their way.  If not, it throws a Login Exception and punts them back to the login page.
>>
>>
>> Hopefully this helps.
>>
>> Thanks,
>> Eric
>>
>>
>>
>>
>>
>>
>>  "Aaron Mulder" <am...@alumni.princeton.edu>
>> Sent by: ammulder@gmail.com
>>
>> 20/03/2006 09:50 AM
>>
>> Please respond to
>>  user@geronimo.apache.org
>>
>>
>> To user@geronimo.apache.org
>>
>> cc
>>
>>
>> Subject Re: JAAS configuration in geronimo
>>
>>
>>
>>
>>
>>
>>
>>
>> How are you planning to use this JAAS component?  For example, is it a
>>  LoginModule that you want to use to validate logins to the web
>>  container?
>>
>>  Thanks,
>>      Aaron
>>
>>  On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>>  >
>>  >
>>  > Sorry... let's try that with a subject heading
>>  > .....
>>  >
>>  >
>>  >
>>  >  Eric Cho/Kryos
>>  >
>>  > 20/03/2006 09:44 AM
>>  >
>>  > To user@geronimo.apache.org
>>  >
>>  > cc
>>  >
>>  >
>>  > Subject
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >  Hi all,
>>  >
>>  >  I'm trying to port an app over to WAS CE (which we all know is geronimo with and ibm admin console).
>>  >
>>  > I have a JAAS component and I'm having trouble configuring it.
>>  >
>>  >  In tomcat it's as easy as opening the tomcat properties dialogue, going to the java tab and adding the following under java options:
>>  >  -Djava.security.auth.login.config=C:\Tomcat 5.5\conf\JAASConfig\thisSitesSecurity.config
>>  >
>>  >
>>  >  How do I got about doing it in WAS CE? In the config.xml or the geromino-web.xml?
>>  >
>>  >  Any help would be appreciated,
>>  >
>>  > Eric
>>  >
>>  >
>>  >
>>  >
>>  >
>>
>>
>>     
>
>   

Re: JAAS configuration in geronimo

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
So we override the default JAAS file-based configuration mechanism
with a configuration system of our own based on Geronimo components
(GBeans).

If you are doing this for a web application and you can use the normal
J2EE login routines, you can configure your login module as a Geronimo
security realm and let J2EE/Geronimo handle the login.

If you are intentionally avoiding the J2EE login handling, then you
probably need to rewrite your JAAS configuration as a Geronimo service
configuration (we have GBeans that wrap login module configuration,
etc.).  You'll also need to put your classes in a JAR in the
repository (geronimo/repository/whatever/your-login-code-1.0.jar).  It
will probably be a little painful to write the configuration plan, but
hey, you only need to do it once.  :)

If you're going to need to write the plan, can you post the relevent
section from your existing JAAS config file?

Thanks,
    Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Hi Aaron,
>
> Sorry, should have been more descriptive.
>
> I create a loginContext and pass it in the name of the config file and hand it the custom login call back handler.
>
> Then the login method is called; it goes back and grabs the user from a MySQL database.  If the user exists and the credentials fit, we figure out their role and send them on their way.  If not, it throws a Login Exception and punts them back to the login page.
>
>
> Hopefully this helps.
>
> Thanks,
> Eric
>
>
>
>
>
>
>  "Aaron Mulder" <am...@alumni.princeton.edu>
> Sent by: ammulder@gmail.com
>
> 20/03/2006 09:50 AM
>
> Please respond to
>  user@geronimo.apache.org
>
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject Re: JAAS configuration in geronimo
>
>
>
>
>
>
>
>
> How are you planning to use this JAAS component?  For example, is it a
>  LoginModule that you want to use to validate logins to the web
>  container?
>
>  Thanks,
>      Aaron
>
>  On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>  >
>  >
>  > Sorry... let's try that with a subject heading
>  > .....
>  >
>  >
>  >
>  >  Eric Cho/Kryos
>  >
>  > 20/03/2006 09:44 AM
>  >
>  > To user@geronimo.apache.org
>  >
>  > cc
>  >
>  >
>  > Subject
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  Hi all,
>  >
>  >  I'm trying to port an app over to WAS CE (which we all know is geronimo with and ibm admin console).
>  >
>  > I have a JAAS component and I'm having trouble configuring it.
>  >
>  >  In tomcat it's as easy as opening the tomcat properties dialogue, going to the java tab and adding the following under java options:
>  >  -Djava.security.auth.login.config=C:\Tomcat 5.5\conf\JAASConfig\thisSitesSecurity.config
>  >
>  >
>  >  How do I got about doing it in WAS CE? In the config.xml or the geromino-web.xml?
>  >
>  >  Any help would be appreciated,
>  >
>  > Eric
>  >
>  >
>  >
>  >
>  >
>
>

Re: JAAS configuration in geronimo

Posted by Er...@kryos.com.
Hi Aaron,

Sorry, should have been more descriptive.

I create a loginContext and pass it in the name of the config file and 
hand it the custom login call back handler.

Then the login method is called; it goes back and grabs the user from a 
MySQL database.  If the user exists and the credentials fit, we figure out 
their role and send them on their way.  If not, it throws a Login 
Exception and punts them back to the login page. 


Hopefully this helps.

Thanks,
Eric






"Aaron Mulder" <am...@alumni.princeton.edu> 
Sent by: ammulder@gmail.com
20/03/2006 09:50 AM
Please respond to
user@geronimo.apache.org


To
user@geronimo.apache.org
cc

Subject
Re: JAAS configuration in geronimo






How are you planning to use this JAAS component?  For example, is it a
LoginModule that you want to use to validate logins to the web
container?

Thanks,
    Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Sorry... let's try that with a subject heading
> .....
>
>
>
>  Eric Cho/Kryos
>
> 20/03/2006 09:44 AM
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject
>
>
>
>
>
>
>
>
>
>
>
>
>
>  Hi all,
>
>  I'm trying to port an app over to WAS CE (which we all know is geronimo 
with and ibm admin console).
>
> I have a JAAS component and I'm having trouble configuring it.
>
>  In tomcat it's as easy as opening the tomcat properties dialogue, going 
to the java tab and adding the following under java options:
>  -Djava.security.auth.login.config=C:\Tomcat 
5.5\conf\JAASConfig\thisSitesSecurity.config
>
>
>  How do I got about doing it in WAS CE? In the config.xml or the 
geromino-web.xml?
>
>  Any help would be appreciated,
>
> Eric
>
>
>
>
>


Re: JAAS configuration in geronimo

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
How are you planning to use this JAAS component?  For example, is it a
LoginModule that you want to use to validate logins to the web
container?

Thanks,
    Aaron

On 3/20/06, EricCho@kryos.com <Er...@kryos.com> wrote:
>
>
> Sorry... let's try that with a subject heading
> .....
>
>
>
>  Eric Cho/Kryos
>
> 20/03/2006 09:44 AM
>
> To user@geronimo.apache.org
>
> cc
>
>
> Subject
>
>
>
>
>
>
>
>
>
>
>
>
>
>  Hi all,
>
>  I'm trying to port an app over to WAS CE (which we all know is geronimo with and ibm admin console).
>
> I have a JAAS component and I'm having trouble configuring it.
>
>  In tomcat it's as easy as opening the tomcat properties dialogue, going to the java tab and adding the following under java options:
>  -Djava.security.auth.login.config=C:\Tomcat 5.5\conf\JAASConfig\thisSitesSecurity.config
>
>
>  How do I got about doing it in WAS CE? In the config.xml or the geromino-web.xml?
>
>  Any help would be appreciated,
>
> Eric
>
>
>
>
>