This project has moved and is read-only. For the latest updates, please go here.

[en] about the authenticate method (solved)

Topics: Technical Support
Oct 14, 2013 at 8:24 AM
I have Implement of IAuthenticationProvider , how can I get to the remote client ip address ?
Oct 15, 2013 at 9:12 PM
Edited Oct 15, 2013 at 9:51 PM

ServerSession class has a property of client's IP address. You can use it on the server-side as follows:
var address = ServerSession.CurrentSession.ClientAddress;
But, when authentication provider is executed, server session is not yet initialized.
If you need to get client IP address during the Authenticate method call, use AuthRequestMessage.ClientAddress property:
public class MyAuthenticationProvider : IAuthenticationProvider
    public AuthResponseMessage Authenticate(AuthRequestMessage authRequest)
        IIdentity identity = WindowsIdentity.GetAnonymous();
        Console.WriteLine("Authenticating... IP address: {0}", authRequest.ClientAddress);
        return new AuthResponseMessage()
            ErrorMessage = string.Empty,
            Success = true,
            AuthenticatedIdentity = identity
Please note that this feature is not in production yet.
You need to build Zyan from the latest sources to get ClientAddress property.

Let me know if it helps.
Marked as answer by yallie on 10/18/2013 at 2:12 PM
Oct 16, 2013 at 8:54 AM
thanks , Zyan is a great Communication Framework.