Пример #1
0
 private void Initialize(WebApiLoginResult loginResult)
 {
     Success          = loginResult.Success;
     Error            = loginResult.Error;
     ErrorDescription = loginResult.ErrorDescription;
     ErrorUri         = loginResult.ErrorUri;
     TokenResult      = loginResult.TokenResult;
 }
Пример #2
0
        /// <summary>
        /// Tries to log the user in on the WebApi in an asynchronous manner.
        /// </summary>
        /// <param name="username">The username</param>
        /// <param name="password">The password</param>
        /// <returns></returns>
        public async Task <WebApiLoginResult> LoginAsync(string username, string password)
        {
            var request = new RestRequest("/token", Method.POST);

            request.AddHeader("Content-Type", "application/x-www-form-urlencoded")
            .AddParameter("grant_type", "password")
            .AddParameter("username", username)
            .AddParameter("password", password);

            var response = await Client.ExecuteTaskAsync <Dictionary <string, string> >(request);

            var loginResult = new WebApiLoginResult(response.Data);

            return(loginResult);
        }
Пример #3
0
 public WebApiLoginIdentityResult(WebApiLoginResult loginResult)
     : base(loginResult)
 {
 }
Пример #4
0
 public WebApiLoginResult(WebApiLoginResult loginResult)
 {
     Initialize(loginResult);
 }