[Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Charles Harvey III
Hello.
I'm quite new to Acegi but I think I am getting the hang of it fairly 
quickly.
There is one thing though that I am struggling with.

How do I get things like "username" to be displayed on a web page?

I thought the UserDetails was stored in the Session.  But it is really 
stored
in an Authentication object, which is stored in a SecurityContext, which is
stored in a SecurityContextHolder.  Which is all fine.  But, how do I access
the SecurityContextHolder from the page level after a successful login?

Is it available as a Session variable?  If so, what is the name of the 
Session
attribute?  If not, how do I access the SecurityContextHolder from say, a
Velocity page?  I'm sure this is done quite regularly so I am hoping someone
can point me in the right direction.

Thanks for the help.


Charlie


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Scott Battaglia
Charlie,

If you only want the username you can add the filter that exposes the 
username as the request.getRemoteUser().

-Scott

Scott Battaglia
Application Developer, Architecture & Engineering Team
Enterprise Systems and Services, Rutgers University
v: 732.445.0097 | f: 732.445.5493 | [EMAIL PROTECTED] 



Charles Harvey III wrote:
> Hello.
> I'm quite new to Acegi but I think I am getting the hang of it fairly 
> quickly.
> There is one thing though that I am struggling with.
>
> How do I get things like "username" to be displayed on a web page?
>
> I thought the UserDetails was stored in the Session.  But it is really 
> stored
> in an Authentication object, which is stored in a SecurityContext, which is
> stored in a SecurityContextHolder.  Which is all fine.  But, how do I access
> the SecurityContextHolder from the page level after a successful login?
>
> Is it available as a Session variable?  If so, what is the name of the 
> Session
> attribute?  If not, how do I access the SecurityContextHolder from say, a
> Velocity page?  I'm sure this is done quite regularly so I am hoping someone
> can point me in the right direction.
>
> Thanks for the help.
>
>
> Charlie
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>   

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Matt Raible
Here's what I use:



Matt

On 8/31/06, Charles Harvey III <[EMAIL PROTECTED]> wrote:
> Hello.
> I'm quite new to Acegi but I think I am getting the hang of it fairly
> quickly.
> There is one thing though that I am struggling with.
>
> How do I get things like "username" to be displayed on a web page?
>
> I thought the UserDetails was stored in the Session.  But it is really
> stored
> in an Authentication object, which is stored in a SecurityContext, which is
> stored in a SecurityContextHolder.  Which is all fine.  But, how do I access
> the SecurityContextHolder from the page level after a successful login?
>
> Is it available as a Session variable?  If so, what is the name of the
> Session
> attribute?  If not, how do I access the SecurityContextHolder from say, a
> Velocity page?  I'm sure this is done quite regularly so I am hoping someone
> can point me in the right direction.
>
> Thanks for the help.
>
>
> Charlie
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Ray Krueger
>From a velocity page?
I'm not sure how you get access to the request itself, but start with that...

request.remoteUser
request.userPrincipal.principal.username

You need to add the ContextHolderAwareRequestFilter to your
filterChainProxy for those to work, like Scott had mentioned.


On 8/31/06, Matt Raible <[EMAIL PROTECTED]> wrote:
> Here's what I use:
>
> 
>
> Matt
>
> On 8/31/06, Charles Harvey III <[EMAIL PROTECTED]> wrote:
> > Hello.
> > I'm quite new to Acegi but I think I am getting the hang of it fairly
> > quickly.
> > There is one thing though that I am struggling with.
> >
> > How do I get things like "username" to be displayed on a web page?
> >
> > I thought the UserDetails was stored in the Session.  But it is really
> > stored
> > in an Authentication object, which is stored in a SecurityContext, which is
> > stored in a SecurityContextHolder.  Which is all fine.  But, how do I access
> > the SecurityContextHolder from the page level after a successful login?
> >
> > Is it available as a Session variable?  If so, what is the name of the
> > Session
> > attribute?  If not, how do I access the SecurityContextHolder from say, a
> > Velocity page?  I'm sure this is done quite regularly so I am hoping someone
> > can point me in the right direction.
> >
> > Thanks for the help.
> >
> >
> > Charlie
> >
> >
> > -
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > ___
> > Home: http://acegisecurity.org
> > Acegisecurity-developer mailing list
> > Acegisecurity-developer@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
> >
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Charles Harvey III
When using VelocityViewServlet all request, response and session values
are put into the velocityContext.  So I should be able to do:

$request.userPrincipal.principal.username

But there is no "getPrincipal()" method attached to java.security.Principal.
The only useful methods available are getName() and toString().

So I'll just try $request.userPrincipal.name and see what happens.

I added things like email and zipcode to my AuthUser (which extends User).
How do I get those values?  Are they also somehow in the userPrincipal?

Thanks a lot


Charlie


Ray Krueger said the following on 8/31/2006 1:28 PM:
> >From a velocity page?
> I'm not sure how you get access to the request itself, but start with that...
>
> request.remoteUser
> request.userPrincipal.principal.username
>
> You need to add the ContextHolderAwareRequestFilter to your
> filterChainProxy for those to work, like Scott had mentioned.
>
>
> On 8/31/06, Matt Raible <[EMAIL PROTECTED]> wrote:
>   
>> Here's what I use:
>>
>> 
>>
>> Matt
>>
>> On 8/31/06, Charles Harvey III <[EMAIL PROTECTED]> wrote:
>> 
>>> Hello.
>>> I'm quite new to Acegi but I think I am getting the hang of it fairly
>>> quickly.
>>> There is one thing though that I am struggling with.
>>>
>>> How do I get things like "username" to be displayed on a web page?
>>>
>>> I thought the UserDetails was stored in the Session.  But it is really
>>> stored
>>> in an Authentication object, which is stored in a SecurityContext, which is
>>> stored in a SecurityContextHolder.  Which is all fine.  But, how do I access
>>> the SecurityContextHolder from the page level after a successful login?
>>>
>>> Is it available as a Session variable?  If so, what is the name of the
>>> Session
>>> attribute?  If not, how do I access the SecurityContextHolder from say, a
>>> Velocity page?  I'm sure this is done quite regularly so I am hoping someone
>>> can point me in the right direction.
>>>
>>> Thanks for the help.
>>>
>>>
>>> Charlie
>>>
>>>
>>> -
>>> Using Tomcat but need to do more? Need to support web services, security?
>>> Get stuff done quickly with pre-integrated technology to make your job 
>>> easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>> ___
>>> Home: http://acegisecurity.org
>>> Acegisecurity-developer mailing list
>>> Acegisecurity-developer@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>>>
>>>   
>> -
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> ___
>> Home: http://acegisecurity.org
>> Acegisecurity-developer mailing list
>> Acegisecurity-developer@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>>
>> 
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>
>   

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] getting user information at the page level

2006-08-31 Thread Ray Krueger
When using the filter, the UserPrincipal is an instance of the Acegi
token ( forgot the classname for some reason).
It depends on what classes you're using I suppose.
Does $request.remoteUser work for you?

On 8/31/06, Charles Harvey III <[EMAIL PROTECTED]> wrote:
> When using VelocityViewServlet all request, response and session values
> are put into the velocityContext.  So I should be able to do:
>
> $request.userPrincipal.principal.username
>
> But there is no "getPrincipal()" method attached to java.security.Principal.
> The only useful methods available are getName() and toString().
>
> So I'll just try $request.userPrincipal.name and see what happens.
>
> I added things like email and zipcode to my AuthUser (which extends User).
> How do I get those values?  Are they also somehow in the userPrincipal?
>
> Thanks a lot
>
>
> Charlie
>
>
> Ray Krueger said the following on 8/31/2006 1:28 PM:
> > >From a velocity page?
> > I'm not sure how you get access to the request itself, but start with 
> > that...
> >
> > request.remoteUser
> > request.userPrincipal.principal.username
> >
> > You need to add the ContextHolderAwareRequestFilter to your
> > filterChainProxy for those to work, like Scott had mentioned.
> >
> >
> > On 8/31/06, Matt Raible <[EMAIL PROTECTED]> wrote:
> >
> >> Here's what I use:
> >>
> >> 
> >>
> >> Matt
> >>
> >> On 8/31/06, Charles Harvey III <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hello.
> >>> I'm quite new to Acegi but I think I am getting the hang of it fairly
> >>> quickly.
> >>> There is one thing though that I am struggling with.
> >>>
> >>> How do I get things like "username" to be displayed on a web page?
> >>>
> >>> I thought the UserDetails was stored in the Session.  But it is really
> >>> stored
> >>> in an Authentication object, which is stored in a SecurityContext, which 
> >>> is
> >>> stored in a SecurityContextHolder.  Which is all fine.  But, how do I 
> >>> access
> >>> the SecurityContextHolder from the page level after a successful login?
> >>>
> >>> Is it available as a Session variable?  If so, what is the name of the
> >>> Session
> >>> attribute?  If not, how do I access the SecurityContextHolder from say, a
> >>> Velocity page?  I'm sure this is done quite regularly so I am hoping 
> >>> someone
> >>> can point me in the right direction.
> >>>
> >>> Thanks for the help.
> >>>
> >>>
> >>> Charlie
> >>>
> >>>
> >>> -
> >>> Using Tomcat but need to do more? Need to support web services, security?
> >>> Get stuff done quickly with pre-integrated technology to make your job 
> >>> easier
> >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >>> ___
> >>> Home: http://acegisecurity.org
> >>> Acegisecurity-developer mailing list
> >>> Acegisecurity-developer@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
> >>>
> >>>
> >> -
> >> Using Tomcat but need to do more? Need to support web services, security?
> >> Get stuff done quickly with pre-integrated technology to make your job 
> >> easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >> ___
> >> Home: http://acegisecurity.org
> >> Acegisecurity-developer mailing list
> >> Acegisecurity-developer@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
> >>
> >>
> >
> > -
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > ___
> > Home: http://acegisecurity.org
> > Acegisecurity-developer mailing list
> > Acegisecurity-developer@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
> >
> >
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Home: http://acegisecurity.org
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.ne