You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tremal Naik <tr...@gmail.com> on 2006/03/16 18:16:58 UTC

How to retrieve an user Principal?

Hello,
how can i retrieve an user principal?

I don't want to get it from the request, but directly from the
underlying security framework.

My application, when developed in Jboss, uses an instruction like the following:

org.jboss.security.SecurityAssociation.getPrincipal();

Is there something similar in Tomcat? May you please point me to the
correct resource (documentation, web page)?

Thanks
--
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Tremal Naik <tr...@gmail.com>.
2006/3/17, Mladen Turk <ml...@jboss.com>:
> Go and troll somewhere else.

sorry, I thought you where pissing on me. I didn't understand your
real intentions.
I will manage the request to get what I'm looking for.

Thanks,

--
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Mladen Turk <ml...@jboss.com>.
Tremal Naik wrote:
> 2006/3/16, Mladen Turk <ml...@jboss.com>:
>> Yes. Servlet spec 2.4
> 
> Thank you very much. Persons like you make me loosing faith in the
> Open Source. I think I'll call the guys at IBM...
> 

Go and troll somewhere else.

I told you that JBoss uses thread local storage.
1. Request comes in.
2. According to the Servlet spec the request is
    parsed and user determined.
3. It is added to the thread local.
4. getPrincipal() ... return (Principal) threadPrincipal.get();

So it does all that for you. Without J2EE container,
you'll need to use the the Servlet spec.



--
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Tremal Naik <tr...@gmail.com>.
2006/3/16, Mladen Turk <ml...@jboss.com>:
> Yes. Servlet spec 2.4

Thank you very much. Persons like you make me loosing faith in the
Open Source. I think I'll call the guys at IBM...

--
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Mladen Turk <ml...@jboss.com>.
Tremal Naik wrote:
> 2006/3/16, Mladen Turk <ml...@jboss.com>:
>> JBoss getPrincipal() figures that from the request,
> 
> Maybe, but it doesn't require I pass the request as an argument,

It uses thread local storage.
> 
> So my question follows: is there anything similar in Tomcat?
>

Yes. Servlet spec 2.4

Regards,
Mladen.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Tremal Naik <tr...@gmail.com>.
2006/3/16, Mladen Turk <ml...@jboss.com>:
> JBoss getPrincipal() figures that from the request,

Maybe, but it doesn't require I pass the request as an argument, ir
returns the principal from whenever I call it in the code, simply,
even in those classes which doesn't have a request variabile.

It allows me writing security helpers, for instance, which can be used
from within pluggable JAAS Login Modules, where the request is not
available at all.

So my question follows: is there anything similar in Tomcat?

cheers

--
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to retrieve an user Principal?

Posted by Mladen Turk <ml...@jboss.com>.
Tremal Naik wrote:
> Hello,
> how can i retrieve an user principal?
> 
> I don't want to get it from the request, but directly from the
> underlying security framework.
> 
> My application, when developed in Jboss, uses an instruction like the following:
> 
> org.jboss.security.SecurityAssociation.getPrincipal();
> 
> Is there something similar in Tomcat? May you please point me to the
> correct resource (documentation, web page)?
>

JBoss getPrincipal() figures that from the request,
so where the problem?

Regards,
Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org