예제 #1
0
        public override void SetAuthenticateParameters(IAuthSchemeClient client,
                                                       Dictionary <byte, object> requestParameters, Dictionary <byte, object> authParameter = null)
        {
            if (authParameter == null)
            {
                authParameter = new Dictionary <byte, object>();
            }

            if (!string.IsNullOrEmpty(client.Token))
            {
                // we already have a token (from nameserver / master) - just use that
                if (!authParameter.ContainsKey(ParameterCode.Secret))
                {
                    authParameter[ParameterCode.Secret] = client.Token;
                }
            }
            else
            {
                // no token yet - pass UserId into authentication:
                if (!authParameter.ContainsKey(ParameterCode.UserId))
                {
                    authParameter[ParameterCode.UserId] = client.UserId;
                }
            }

            base.SetAuthenticateParameters(client, requestParameters, authParameter);
        }
        public override void SetAuthenticateParameters(IAuthSchemeClient client, 
            Dictionary<byte, object> requestParameters, Dictionary<byte, object> authParameter = null)
        {
            if (authParameter == null)
            {
                authParameter = new Dictionary<byte, object>();
            }

            if (!string.IsNullOrEmpty(client.Token))
            {
                // we already have a token (from nameserver / master) - just use that
                if (!authParameter.ContainsKey(ParameterCode.Secret))
                {
                    authParameter[ParameterCode.Secret] = client.Token;
                }
            }
            else
            {
                // no token yet - pass UserId into authentication:
                if (!authParameter.ContainsKey(ParameterCode.UserId))
                {
                    authParameter[ParameterCode.UserId] = client.UserId;
                }
            }

            base.SetAuthenticateParameters(client, requestParameters, authParameter);
        }
예제 #3
0
 public override void HandleAuthenticateResponse(IAuthSchemeClient client, Dictionary <byte, object> response)
 {
     // Master: returns a secret - store and re-use it!
     // GS: does not return a secret.
     if (response.ContainsKey(ParameterCode.Secret))
     {
         client.Token = (string)response[ParameterCode.Secret];
     }
 }
 public override void HandleAuthenticateResponse(IAuthSchemeClient client, Dictionary<byte, object> response)
 {
     // Master: returns a secret - store and re-use it!
     // GS: does not return a secret.
     if (response.ContainsKey(ParameterCode.Secret))
     {
         client.Token = (string)response[ParameterCode.Secret];
     }
 }
 public virtual void SetAuthenticateParameters(IAuthSchemeClient client, Dictionary <byte, object> requestParameters, Dictionary <byte, object> authParameter = null)
 {
     if (authParameter != null)
     {
         foreach (var p in authParameter)
         {
             requestParameters[p.Key] = p.Value;
         }
     }
 }
 public virtual void SetAuthenticateParameters(IAuthSchemeClient client, Dictionary<byte, object> requestParameters, Dictionary<byte, object> authParameter = null)
 {
     if (authParameter != null)
     {
         foreach (var p in authParameter)
         {
             requestParameters[p.Key] = p.Value;
         }
     }
 }
예제 #7
0
        public override void SetAuthenticateParameters(IAuthSchemeClient client,
                                                       Dictionary <byte, object> requestParameters, Dictionary <byte, object> authParameter = null)
        {
            if (authParameter == null)
            {
                authParameter = new Dictionary <byte, object>();
            }

            if (client.Token != null)
            {
                var asStr = client.Token as string;
                if (!string.IsNullOrEmpty(asStr))
                {
                    // we already have a token (from nameserver / master) - just use that
                    if (!authParameter.ContainsKey(ParameterCode.Secret))
                    {
                        authParameter[ParameterCode.Secret] = client.Token;
                    }
                }
                else
                {
                    var asByteArray = client.Token as byte[];
                    if (asByteArray != null && asByteArray.Length > 0 && !authParameter.ContainsKey(ParameterCode.Secret))
                    {
                        authParameter[ParameterCode.Secret] = client.Token;
                    }
                }
            }
            else
            {
                // no token yet - pass UserId into authentication:
                if (!authParameter.ContainsKey(ParameterCode.UserId))
                {
                    authParameter[ParameterCode.UserId] = client.UserId;
                }

                if (!authParameter.ContainsKey(ParameterCode.ApplicationId))
                {
                    authParameter[ParameterCode.ApplicationId] = "AppId";
                    authParameter[ParameterCode.AppVersion]    = "1.0";
                }
            }

            base.SetAuthenticateParameters(client, requestParameters, authParameter);
        }
 public virtual void HandleAuthenticateResponse(IAuthSchemeClient nunitClient, Dictionary <byte, object> response)
 {
     // do nothing with return values
 }
 public virtual void HandleAuthenticateResponse(IAuthSchemeClient nunitClient, Dictionary<byte, object> response)
 {
     // do nothing with return values
 }