Another way if you need more low-level information is to have your command
implement SessionAware.
In that case, it will receive the ServerSession object which you can use
for various purposes, including retrieving the user name using
    ((ServerSession) session).getUsername()

But you can't have access to those information in the CommandFactory itself.

2011/11/22 Frédéric Menou <frederic.me...@gmail.com>

> Hi,
>
> You simply get the user from Environment parameter :
> public void start(Environment env) throws IOException {
>  env.getEnv().get(Environment.ENV_USER);
>  ...
> }
>
> When the command is executed, you're sure the user has been authenticated
> (thru filters).
>
> Regards,
> Frederic
>
> On Tue, Nov 22, 2011 at 09:28, Tomek Koprowski <to...@koprowski.org>
> wrote:
>
> > Hi,
> > I'm developing a multi-user application based around MINA SSHD using
> > CommandFactory (I don't need a shell). The problem is as follows:
> commands
> > should behave differently depending on logged on user (somewhat like
> > executing on the user's behalf). To do that I need to know _who_ is my
> > command serving but I can't figure out a way to do that.
> >
> > Is there a way to pass the username into a Command created by the
> > CommandFactory?
> >
> > Regards,
> > Tomek
> >
> > --
> > [ mailto:to...@koprowski.org  gg#:2348134 ]
> > [       http://koprowski.org/photo        ]
> > [    Life is as bad as you make it be     ]
> >
> >
>
>
> --
> Frédéric Menou
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to