Currently logged in user

May 11, 2010 at 7:10 PM

Hi!

Is there a way to find out the Credentials with which the client calls a service on the server-side?

e.g. if I have a LoginService like this

    [XcoSecurityPermission("RegisteredUsers")]
    public class LoginService : LoginContract

in the method

        [XcoConcurrent]
        void Login(bool login)

I would like to know the username.

Thread.CurrentPrincipal.Identity.Name doesn't seem to work.

Thanks a lot

Andi

May 12, 2010 at 4:56 PM
Edited May 12, 2010 at 4:59 PM

Hi, Andi!

I just added some functionality that might be what you are looking for. When you add the NameSpace XcoAppSpaces.Core.Communication, you can use the class MessageContext to get the current user name, like this:

[XcoConcurrent]
void Login(bool login)
{
    var currentUser = MessageContext.Current.Username;
    ...
}

You can also use MessageContext.Current to get information if the message that is currently being processed is coming from a remote space, and what the address of this space is.

Since there is not yet an official release containing this feature, you will need to compile the appspace from source code. An official release version will probably be coming in the next few weeks.

Thomas