Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
jep i have the same just for others: === === package nl.topticketline.topnet.util; import org.acegisecurity.Authentication; import org.acegisecurity.context.SecurityContext

Re: [appfuse-user] get logged in username

2007-05-15 Thread Sanjiv Jivan
See my response here : http://www.nabble.com/forum/ViewPost.jtp?post=5376367&framed=y&skin=2369 On 5/15/07, tibi <[EMAIL PROTECTED]> wrote: apart from this :( when i use my application this will work: public boolean loggedInUserHasRole(String roleName) { if (SecurityContextHolder

Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
apart from this :( when i use my application this will work: public boolean loggedInUserHasRole(String roleName) { if (SecurityContextHolder.getContext() != null) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) {

Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
used this: http://raibledesigns.com/downloads/appfuse/api/org/appfuse/service/UserSecurityAdviceTest.java.html worked perfect... tibi wrote: thanks tibi Michael Horwitz wrote: On 5/15/07, *tibi* <[EMAIL PROTECTED] > wrote: thanks. so i will use the last one

Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
thanks tibi Michael Horwitz wrote: On 5/15/07, *tibi* <[EMAIL PROTECTED] > wrote: thanks. so i will use the last one. can i test this method from a junit test? or an baseActionTest. and how can i login? Yes, as long as you set up the ACEGI security c

Re: [appfuse-user] get logged in username

2007-05-15 Thread Michael Horwitz
On 5/15/07, tibi <[EMAIL PROTECTED]> wrote: thanks. so i will use the last one. can i test this method from a junit test? or an baseActionTest. and how can i login? Yes, as long as you set up the ACEGI security context. See UserSecurityAdviceTest in the AppFuse source for an example of how t

Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
thanks. so i will use the last one. can i test this method from a junit test? or an baseActionTest. and how can i login? tibi Michael Horwitz wrote: The first version is only usefull where you have access to the request object. This is not always the case, particularly in the service layer. T

Re: [appfuse-user] get logged in username

2007-05-15 Thread Michael Horwitz
The first version is only usefull where you have access to the request object. This is not always the case, particularly in the service layer. The second version works throughout the call stack and returns the logged in user as per ACEGI. As far as I know they should always return the same value,

Re: [appfuse-user] get logged in username

2007-05-15 Thread tibi
what is the difference between: request.getRemoteUser() and this public String getLoggedInUserName() { if (SecurityContextHolder.getContext() != null) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) {