You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Ryan Rhodes <ry...@hotmail.com> on 2005/05/16 20:55:34 UTC

[MINA] Where do i store a Principal?

Hello All

I posted a lot of questions to the Netty list and Trustin was always very 
helpful.  I’m really excited about the directions mina is taking.

I extended the reverser example into a simple chat server.  This is just 
like echo server except all incoming input is echo to all connections.  I do 
this by maintaining a list of IoSession in the protocol handler.

First question:  Does Mina already have some internal list of IoSession that 
I can use to loop through for output?  Is my list redundant?

Second question:  Whats the best approach to adding authentication to a mina 
application?

Is there any examples in apache directory that I can look at for integrating 
principals with mina?  I found an LdapPrincipal, but I could not find where 
the authentication logic happens relative to Mina.

Should this be a part of my protocol handler or have others separated this 
into a filter?

In the Servlet model, you get the user from the HttpServletRequest with 
getUserPrincipal().  I think this might just be a wrapper for an underlying 
request attribute.

In Mina, should Principal be stored as an attribute on the low level 
IoSession or is their a better place?


Thanks for any help,

Ryan Rhodes



Re: [MINA] Where do i store a Principal?

Posted by Alex Karasulu <ao...@bellsouth.net>.
Trustin Lee wrote:

>AFAIK, LdapPricipal and other stuffs are stored in ThreadLocal not in
>MINA session attribute map.  It is because ApacheDS can run without
>MINA (embeded only mode).  We could let ApacheDS store its session
>data into MINA session attribute map using in-VM pipe.  WDYT, Alex?
>  
>
Don't have enough data cached at the moment on both MINA and ApacheDS to 
comment in depth.  However you do make a good point about needing the 
identity even when MINA is not being used ... in embedded mode where 
there is no LDAP access.  So I think we might want to leave it as is or 
find a neat way to bridge this part of the session info with that in MINA.

However as you said above (sorry may have snipped) where you manage your 
principal is really application dependent.  The best that can be done is 
to give the user the options as you did.

Cheers,
Alex
 

Re: [MINA] Where do i store a Principal?

Posted by Trustin Lee <tr...@gmail.com>.
Hell Ryan,

2005/5/17, Ryan Rhodes <ry...@hotmail.com>:
> Hello All
> 
> I posted a lot of questions to the Netty list and Trustin was always very
> helpful.  I'm really excited about the directions mina is taking.

It is good to see you again. :)

> I extended the reverser example into a simple chat server.  This is just
> like echo server except all incoming input is echo to all connections.  I do
> this by maintaining a list of IoSession in the protocol handler.
> 
> First question:  Does Mina already have some internal list of IoSession that
> I can use to loop through for output?  Is my list redundant?

No MINA doesn't manager list of sessions for now.  I'll add JIRA
issues for that.

> Second question:  Whats the best approach to adding authentication to a mina
> application?

You can implement it via filters or via handlers.  It is up to you. 
People often use filters when some functionality is considered
reusable.

> Is there any examples in apache directory that I can look at for integrating
> principals with mina?  I found an LdapPrincipal, but I could not find where
> the authentication logic happens relative to Mina.

AFAIK, LdapPricipal and other stuffs are stored in ThreadLocal not in
MINA session attribute map.  It is because ApacheDS can run without
MINA (embeded only mode).  We could let ApacheDS store its session
data into MINA session attribute map using in-VM pipe.  WDYT, Alex?

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/