On 7/31/07, Pavel Katsev <[EMAIL PROTECTED]> wrote: > Hello, > > I'm writing a persistence test (ProjectDaoTest) and I need to get > current user's id into a @ManyToOne Author field. > > I was wondering what the correct way to do the following would be: > > 1. get current user during test
Probably the easiest way to do this is to set an authentication on the security context using mocks. See below for more details: both SecurityContext and Authentication are interfaces. > 2. get current user during runtime (this one i'm sure can be figured > out from appfuse), but still ... You need to get hold of the ACEGI security context: SecurityContextHolder.getSecurityContext(). From there you can can get the Authentication object which holds the user. Mike. > Much obliged !!! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
