using a custom login module

View: New views
8 Messages — Rating Filter:   Alert me  

using a custom login module

by Ashwill, Steve (Facilities & Services) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,
 
I am trying to build and run a custom login module but I have been
unable to make it run. It compiles just fine using the
jetspeed-api-2.1.3.jar and jetspeed-security-2.1.3.jar as libraries but
when it runs it tells me that it can't find the
LoginModuleProxyImpl.class which is probably just the first thing it
can't find.  I have basically copied the DefaultLoginModule modifying
the callbackhandler in the way it supplies the username, and then I
would like it to do everything else the same way the DefaultLoginModule
works.
Can anyone point me to some examples showing the placement of the files
in Jetspeed and examples where this has been done with the Jetspeed
portal or perhaps give me a clue as to how and what and where things
should be located.Thanks  in advance for your help.
 
 
 
A friendly newbie,
Steven Ashwill
 

Re: using a custom login module

by David Sean Taylor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 22, 2008, at 7:16 AM, Ashwill, Steve (Facilities & Services)  
wrote:

> Hello everyone,
>
> I am trying to build and run a custom login module but I have been
> unable to make it run. It compiles just fine using the
> jetspeed-api-2.1.3.jar and jetspeed-security-2.1.3.jar as libraries  
> but
> when it runs it tells me that it can't find the
> LoginModuleProxyImpl.class which is probably just the first thing it
> can't find.  I have basically copied the DefaultLoginModule modifying
> the callbackhandler in the way it supplies the username, and then I
> would like it to do everything else the same way the  
> DefaultLoginModule
> works.
> Can anyone point me to some examples showing the placement of the  
> files
> in Jetspeed and examples where this has been done with the Jetspeed
> portal or perhaps give me a clue as to how and what and where things
> should be located.Thanks  in advance for your help.
>


LoginModuleProxyImpl is in jetspeed-security-2.1.3.jar
Are you running from within a Jetspeed installation under Tomcat, or  
some other configuration?
Is your custom login module placed under the jetspeed webapp?

Recommend building your login module as a jar, and dropping it into  
the jetspeed WEB-INF/lib directory
Then update your Spring configuration (security-atn.xml) to point to  
your login module proxy impl

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


Parent Message unknown RE: using a custom login module

by Ashwill, Steve (Facilities & Services) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm afraid your about 3 steps ahead of me.

1. Are you running from within a Jetspeed installation under Tomcat
Yes

2.Is your custom login module placed under the jetspeed webapp?
If you mean the portal that I'm using to call the loginContext, then yes
it is. Perhaps a problem lies in this part?

    private void doPortalLogin(final String name) {
        try {
            LoginContext lc = new LoginContext("fssoaAuth",
                new CallbackHandler() {
                    public void handle(Callback[] callbacks) {
                        for (int i = 0; i < callbacks.length; ++i) {
                            if (callbacks[i] instanceof NameCallback) {
                                NameCallback nc =
(NameCallback)callbacks[i];
                                nc.setName(name);
                            }
                        }
                    }
                });
               
            lc.login();
        }
       
        catch (Exception ex) {
            ex.printStackTrace();
        }
    }
               

3.Recommend building your login module as a jar...
Will this jar simply contain MyLoginModule.class?
Or do I need to add something to the manifest?

4.dropping it into the jetspeed WEB-INF/lib directory Is this the same
directory that contains jetspeed-security-2.1.3.jar?
As of right now it does not find it there. It will only find it if I
place MyLoginModule.class in common or shared.
I have placed my login.conf in the webapps\fsportal\WEB-INF\classes
folder

fssoaAuth {
   org.apache.jetspeed.security.impl.MyLoginModule required debug=true;
};


5.Then update your Spring configuration (security-atn.xml) to point to
your login module proxy impl Does this look right?

<bean id="org.apache.jetspeed.security.LoginModuleProxy"
    class="org.apache.jetspeed.security.impl.MyLoginModule">
       <!-- User Manager to construct JAAS subject/principals returned
to container -->
    <constructor-arg index="0"><ref
bean="org.apache.jetspeed.security.UserManager"/></constructor-arg>

       <!-- Portal user role name used to identify authenticated users
in web.xml security constraints -->
    <constructor-arg
index="1"><value>portal-user</value></constructor-arg>    
  </bean>


-----Original Message-----
From: David Sean Taylor [mailto:david@...]
Sent: Tuesday, July 22, 2008 11:44 AM
To: Jetspeed Users List
Subject: Re: using a custom login module


On Jul 22, 2008, at 7:16 AM, Ashwill, Steve (Facilities & Services)
wrote:

> Hello everyone,
>
> I am trying to build and run a custom login module but I have been
> unable to make it run. It compiles just fine using the
> jetspeed-api-2.1.3.jar and jetspeed-security-2.1.3.jar as libraries
> but when it runs it tells me that it can't find the
> LoginModuleProxyImpl.class which is probably just the first thing it
> can't find.  I have basically copied the DefaultLoginModule modifying
> the callbackhandler in the way it supplies the username, and then I
> would like it to do everything else the same way the
> DefaultLoginModule works.
> Can anyone point me to some examples showing the placement of the
> files in Jetspeed and examples where this has been done with the
> Jetspeed portal or perhaps give me a clue as to how and what and where

> things should be located.Thanks  in advance for your help.
>


LoginModuleProxyImpl is in jetspeed-security-2.1.3.jar
Are you running from within a Jetspeed installation under Tomcat, or  
some other configuration?
Is your custom login module placed under the jetspeed webapp?

Recommend building your login module as a jar, and dropping it into  
the jetspeed WEB-INF/lib directory
Then update your Spring configuration (security-atn.xml) to point to  
your login module proxy impl

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


Re: using a custom login module

by David Sean Taylor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 22, 2008, at 1:27 PM, Ashwill, Steve (Facilities & Services)  
wrote:

> I'm afraid your about 3 steps ahead of me.
>
> 1. Are you running from within a Jetspeed installation under Tomcat
> Yes
>
> 2.Is your custom login module placed under the jetspeed webapp?
> If you mean the portal that I'm using to call the loginContext, then  
> yes
> it is. Perhaps a problem lies in this part?

no, is the correct place
>
> 3.Recommend building your login module as a jar...
> Will this jar simply contain MyLoginModule.class?

yes, and any other support classes

>
> Or do I need to add something to the manifest?
>
shouldn't

> 4.dropping it into the jetspeed WEB-INF/lib directory Is this the same
> directory that contains jetspeed-security-2.1.3.jar?

yes

>
> As of right now it does not find it there. It will only find it if I
> place MyLoginModule.class in common or shared.

But then your LoginModule won't be able to find any Jetspeed classes

>
> I have placed my login.conf in the webapps\fsportal\WEB-INF\classes
> folder
>
> fssoaAuth {
>   org.apache.jetspeed.security.impl.MyLoginModule required debug=true;
> };
>
>
> 5.Then update your Spring configuration (security-atn.xml) to point to
> your login module proxy impl Does this look right?
>

Not sure. Does your "MyLoginModule" implement LoginModuleProxy like  
ours:

  public class LoginModuleProxyImpl implements LoginModuleProxy

Jetspeed is configured to use its own login module: DefaultLoginModule
(also found in the jetspeed-security jar)
It is configured in login.conf, which is packaged in the jetspeed-
security.jar:

Jetspeed {
    org.apache.jetspeed.security.impl.DefaultLoginModule required;
};




RE: using a custom login module

by Ashwill, Steve (Facilities & Services) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've placed my loginmodule.jar into the jetspeed WEB-INF/lib directory
however I get this error when I create a new login context in my
portal..
javax.security.auth.login.LoginException: unable to find LoginModule
class: edu.uiuc.fs.security.FsLoginModule
        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)
        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)


Trace continues for many more lines...

When jetspeed/tomcat starts it finds the login module just fine and
inits with the parameters specified in security-atn.xml.  

If I place the jar in the shared\lib directory along with the
jetspeed-security-2.1.3.jar, it gets found and runs to completion but my
user does not end up logged in.
What am I missing?

Steven Ashwill



-----Original Message-----
From: David Sean Taylor [mailto:david@...]
Sent: Tuesday, July 22, 2008 5:58 PM
To: Jetspeed Users List
Subject: Re: using a custom login module


On Jul 22, 2008, at 1:27 PM, Ashwill, Steve (Facilities & Services)
wrote:

> I'm afraid your about 3 steps ahead of me.
>
> 1. Are you running from within a Jetspeed installation under Tomcat
> Yes
>
> 2.Is your custom login module placed under the jetspeed webapp?
> If you mean the portal that I'm using to call the loginContext, then
> yes it is. Perhaps a problem lies in this part?

no, is the correct place
>
> 3.Recommend building your login module as a jar...
> Will this jar simply contain MyLoginModule.class?

yes, and any other support classes

>
> Or do I need to add something to the manifest?
>
shouldn't

> 4.dropping it into the jetspeed WEB-INF/lib directory Is this the same

> directory that contains jetspeed-security-2.1.3.jar?

yes

>
> As of right now it does not find it there. It will only find it if I
> place MyLoginModule.class in common or shared.

But then your LoginModule won't be able to find any Jetspeed classes

>
> I have placed my login.conf in the webapps\fsportal\WEB-INF\classes
> folder
>
> fssoaAuth {
>   org.apache.jetspeed.security.impl.MyLoginModule required debug=true;

> };
>
>
> 5.Then update your Spring configuration (security-atn.xml) to point to

> your login module proxy impl Does this look right?
>

Not sure. Does your "MyLoginModule" implement LoginModuleProxy like
ours:

  public class LoginModuleProxyImpl implements LoginModuleProxy

Jetspeed is configured to use its own login module: DefaultLoginModule
(also found in the jetspeed-security jar) It is configured in
login.conf, which is packaged in the jetspeed-
security.jar:

Jetspeed {
    org.apache.jetspeed.security.impl.DefaultLoginModule required; };




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


How do you build a custom login module

by Ashwill, Steve (Facilities & Services) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have Jetspeed 2.1.3 running under Tomcat. I am writing my own login,
but I can't get it work.

Can someone give me a checklist of everything that needs to be done?
 


Steven Ashwill

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


Re: How do you build a custom login module

by David Sean Taylor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 29, 2008, at 11:01 AM, Ashwill, Steve (Facilities & Services)  
wrote:

> I have Jetspeed 2.1.3 running under Tomcat. I am writing my own login,
> but I can't get it work.
>
> Can someone give me a checklist of everything that needs to be done?
>


I was guessing that you had it figured out, since writing your own  
login module should not be any different than using Jetspeed's.

First, here are the docs:

http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/login-module.html
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/atn.html

Notice that it states to place your login.conf in WEB-INF/classes,  
ahead of Jetspeed's
Here is an example of Jetspeed's:

Jetspeed {
    org.apache.jetspeed.security.impl.DefaultLoginModule required;
};

 From your emails, I believe you got that right.

I believe you are going to also need to look up your users with the  
User Manager into your database. This can be achieved by writing a  
user security provider and configuring it with Spring.
Docs:
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/arch.html
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/config.html

The user security provider is configured in security-spi-atn.xml

Sorry I let this drop off, but I could not come up with a reason as  
for why your login module would not be found, if placed in WEB-INF/lib  
just like Jetspeed's
Please post back your progress and I will try to help

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


RE: How do you build a custom login module

by Ashwill, Steve (Facilities & Services) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I never did figure out what was wrong, but we took a different approach
and it is working now.  Thanks for the help.


-----Original Message-----
From: David Sean Taylor [mailto:david@...]
Sent: Tuesday, July 29, 2008 2:10 PM
To: Jetspeed Users List
Subject: Re: How do you build a custom login module


On Jul 29, 2008, at 11:01 AM, Ashwill, Steve (Facilities & Services)
wrote:

> I have Jetspeed 2.1.3 running under Tomcat. I am writing my own login,

> but I can't get it work.
>
> Can someone give me a checklist of everything that needs to be done?
>


I was guessing that you had it figured out, since writing your own login
module should not be any different than using Jetspeed's.

First, here are the docs:

http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/logi
n-module.html
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/atn.
html

Notice that it states to place your login.conf in WEB-INF/classes, ahead
of Jetspeed's Here is an example of Jetspeed's:

Jetspeed {
    org.apache.jetspeed.security.impl.DefaultLoginModule required; };

 From your emails, I believe you got that right.

I believe you are going to also need to look up your users with the User
Manager into your database. This can be achieved by writing a user
security provider and configuring it with Spring.
Docs:
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/arch
.html
http://portals.apache.org/jetspeed-2/multiproject/jetspeed-security/conf
ig.html

The user security provider is configured in security-spi-atn.xml

Sorry I let this drop off, but I could not come up with a reason as for
why your login module would not be found, if placed in WEB-INF/lib just
like Jetspeed's Please post back your progress and I will try to help

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@...
For additional commands, e-mail: jetspeed-user-help@...

LightInTheBox - Buy quality products at wholesale price