Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KinveyXamarin.KinveyAuthRequest+Builder"/> class.
 /// </summary>
 /// <param name="transport">Transport.</param>
 /// <param name="baseUrl">Base URL.</param>
 /// <param name="appKey">App key.</param>
 /// <param name="appSecret">App secret.</param>
 /// <param name="user">User.</param>
 public Builder(AbstractKinveyClient transport, string appKey, string appSecret, User user = null)
 {
     this.client = transport;
     this.appKeyAuthentication = new HttpBasicAuthenticator(appKey, appSecret);
     this.appKey = appKey;
     this.user   = user;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KinveyXamarin.KinveyAuthRequest"/> class.
        /// </summary>
        /// <param name="client">Client.</param>
        /// <param name="baseUrl">Base URL.</param>
        /// <param name="auth">authenticator to use.</param>
        /// <param name="appKey">App key.</param>
        /// <param name="identity">The third party identity.</param>
        /// <param name="user">User.</param>
        /// <param name="create">If set to <c>true</c> create.</param>
        public KinveyAuthRequest(AbstractKinveyClient client, IAuthenticator auth, string appKey, ThirdPartyIdentity identity, User user, bool create)

        {
            this.client = client;
            this.appKeyAuthentication = auth;
            this.identity             = identity;
            this.create = create;
            this.uriTemplateParameters = new Dictionary <string, string>();
            this.uriTemplateParameters.Add("appKey", appKey);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KinveyXamarin.KinveyAuthRequest+Builder"/> class.
 /// </summary>
 /// <param name="transport">Transport.</param>
 /// <param name="baseUrl">Base URL.</param>
 /// <param name="appKey">App key.</param>
 /// <param name="appSecret">App secret.</param>
 /// <param name="username">Username.</param>
 /// <param name="password">Password.</param>
 /// <param name="user">User.</param>
 public Builder(AbstractKinveyClient transport, string appKey, string appSecret, string username, string password, Dictionary <string, JToken> customFieldsAndValues = null, User user = null)
     : this(transport, appKey, appSecret, user)
 {
     this.client = transport;
     this.appKeyAuthentication = new HttpBasicAuthenticator(appKey, appSecret);
     this.appKey   = appKey;
     this.username = username;
     this.password = password;
     this.customFieldsAndValues = customFieldsAndValues;
     this.user = user;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KinveyXamarin.KinveyAuthRequest"/> class.
        /// </summary>
        /// <param name="client">Client.</param>
        /// <param name="auth">authenticator to use.</param>
        /// <param name="appKey">App key.</param>
        /// <param name="username">Username.</param>
        /// <param name="password">Password.</param>
        /// <param name="user">User.</param>
        /// <param name="create">If set to <c>true</c> create.</param>
        public KinveyAuthRequest(AbstractKinveyClient client, IAuthenticator auth, string appKey, string username, string password, Dictionary <string, JToken> customFieldsAndValues, User user, bool create)

        {
            this.client = client;
            this.appKeyAuthentication = auth;
            if (username != null && password != null)
            {
                this.requestPayload = new JObject();
                this.requestPayload ["username"] = username;
                this.requestPayload ["password"] = password;
            }
            if (user != null)
            {
                if (this.requestPayload == null)
                {
                    this.requestPayload = new JObject();
                }
                var keys = user.Properties().Select(p => p.Name).ToList();
                foreach (string key in keys)
                {
                    this.requestPayload.Add(key, user [key]);
                }

                foreach (KeyValuePair <string, JToken> entry in user.Attributes)
                {
                    this.requestPayload.Add(entry.Key, entry.Value);
                }
            }

            if (customFieldsAndValues != null)
            {
                foreach (KeyValuePair <string, JToken> entry in customFieldsAndValues)
                {
                    this.requestPayload.Add(entry.Key, entry.Value);
                }
            }

            this.create = create;
            this.uriTemplateParameters = new Dictionary <string, string>();
            this.uriTemplateParameters.Add("appKey", appKey);
        }
Ejemplo n.º 5
0
 public Builder(AbstractKinveyClient transport, string appKey, string appSecret, ThirdPartyIdentity identity, User user = null)
     : this(transport, appKey, appSecret, user)
 {
     this.identity = identity;
 }