Example #1
0
        private UserAuthInfo UserLoginRequest(User user)
        {
            user.Username      = "******";
            user.Password      = "******";
            user.TokenDuration = 1;

            var createdTask = new UserAuthInfo();

            string controllerurl = "/v1/Identity";

            string url     = _apiBasestring + controllerurl;
            var    content = JsonConvert.SerializeObject(user);

            using (var client = _clientFactory.CreateClient())
            {
                var httpResponse = client.PostAsync(url, new StringContent(content, Encoding.Default, "application/json")).Result;

                if (!httpResponse.IsSuccessStatusCode)
                {
                    throw new Exception("Cannot add a todo task");
                }
                createdTask        = JsonConvert.DeserializeObject <UserAuthInfo>(httpResponse.Content.ReadAsStringAsync().Result);
                Constants.ApiToken = createdTask.authInfo.Token;
            }


            return(createdTask);
        }
        private void ResetUserPasswordCommand(List <string> args, Common.CmdIO.TTY io, UUID limitedToScene)
        {
            UserAccount account;

            if (args[0] == "help" || args.Count < 5 || args[2] != "password")
            {
                io.Write("reset user password <firstname> <lastname>");
            }
            else if (limitedToScene != UUID.Zero)
            {
                io.Write("reset user password not allowed on limited console");
            }
            else if (m_UserAccountService.TryGetValue(args[3], args[4], out account))
            {
                var authInfo = new UserAuthInfo
                {
                    ID       = account.Principal.ID,
                    Password = io.GetPass("New password")
                };
                m_AuthInfoService.Store(authInfo);
            }
            else
            {
                io.WriteFormatted("User \"{0}\" \"{1}\" not found", args[2], args[3]);
            }
        }
Example #3
0
        /// <summary>
        /// 指定されたユーザー情報で認証を行います。
        /// </summary>
        /// <param name="info">ユーザー認証情報</param>
        /// <returns>認証に成功したかどうか</returns>
        public static async Task <bool> AuthenticateAsync(UserAuthInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            ApiClient.ClearAccessToken();
            var requestToken = await This.GetRequestTokenAsync().ConfigureAwait(false);

            if (requestToken == null)
            {
                return(false);
            }

            var accessToken = await This.GetAccessTokenAsync(info, requestToken).ConfigureAwait(false);

            if (accessToken == null)
            {
                return(false);
            }

            ApiClient.SetAccessToken(accessToken.Value);
            return(true);
        }
Example #4
0
        public virtual void SetPassword(UUID principalId, string password)
        {
            UserAuthInfo uai = this[principalId];

            uai.Password = password;
            Store(uai);
        }
Example #5
0
        public string GetXMLMap(string webconfigloc, UserAuthInfo userinfo)
        {
            string _xmlmapJSON            = "";
            JavaScriptSerializer js       = new JavaScriptSerializer();
            TreeBuilder          _builder = new TreeBuilder();

            try
            {
                nodes       = _builder.BuildXmlString(webconfigloc);
                _xmlmapJSON = js.Serialize(nodes);
            }
            catch
            {
                try
                {
                    nodes       = _builder.Build(webconfigloc);
                    _xmlmapJSON = js.Serialize(nodes);
                }
                catch (Exception appexp)
                {
                    throw (appexp);
                }
            }

            return(_xmlmapJSON);
        }
Example #6
0
            WhenCheckAuthorizeResourceOwnerCredentialGrantForUserAccountWithValidCredentialsAndScope_ThenReturnsTrue
                ()
            {
                var userAccount = new UserAuthInfo
                {
                    Roles = new[]
                    {
                        AuthorizationRoles.NormalUser
                    },
                    PasswordHash = @"sha1:1000:eVtc5YWo+HlEziLNmLoMDrdY8tNr71CG:iZN6EMU5uX1aF70dfFgTGA+wNToqUsnG",
                };

                userStore.Setup(us => us.GetUserAuthInfo(It.IsAny <string>()))
                .Returns(userAccount);
                var request = new Mock <IAccessTokenRequest>();

                request.Setup(r => r.Scope).Returns(new HashSet <string>(new[]
                {
                    AccessScope.Profile
                }));
                request.Setup(r => r.ClientIdentifier).Returns("foo");
                clientStore.Setup(cs => cs.GetClient(It.IsAny <string>()))
                .Returns(new Mock <IClientDescription>().Object);

                AutomatedUserAuthorizationCheckResponse result =
                    server.CheckAuthorizeResourceOwnerCredentialGrant("username", "password",
                                                                      request.Object);

                Assert.True(result.IsApproved);
            }
Example #7
0
        public static AuthenticationProfile Login(string emailAddress, string password)
        {
            var userAuthInfo = new UserAuthInfo {
                EmailAddress = emailAddress, Password = password
            };
            var userInfo = UserAuthenticator.Authenticate(userAuthInfo, AuthenticationScope.Tenant);

            return(userInfo);
        }
Example #8
0
 public WebAddressApiService(IConfiguration configuration, HttpClient client, IHttpClientFactory clientFactory)
 {
     _apiBasestring = configuration["AddressApiUrl"];
     _client        = client;
     _sqlConnString = configuration["ConnString"];
     _clientFactory = clientFactory;
     reportRequest  = new ReportRequest();
     AuthInfo       = new UserAuthInfo();
     User1          = new User();
 }
        private void CreateUserCommand(List <string> args, Common.CmdIO.TTY io, UUID limitedToScene)
        {
            if (args[0] == "help" || args.Count != 4)
            {
                io.Write("create user <firstname> <lastname>");
            }
            else if (limitedToScene != UUID.Zero)
            {
                io.Write("create user not allowed on limited console");
            }
            else if (!IsNameValid(args[1]) || !IsNameValid(args[2]))
            {
                io.Write("name can only contains letters or digits");
            }
            else if (m_UserAccountService.ContainsKey(args[1], args[2]))
            {
                io.Write("user already created");
            }
            else
            {
                var account = new UserAccount
                {
                    IsLocalToGrid = true
                };
                account.Principal.ID        = UUID.Random;
                account.Principal.FirstName = args[2];
                account.Principal.LastName  = args[3];
                account.UserLevel           = 0;

                var authInfo = new UserAuthInfo
                {
                    ID       = account.Principal.ID,
                    Password = io.GetPass("Password")
                };
                try
                {
                    m_UserAccountService.Add(account);
                }
                catch
                {
                    io.WriteFormatted("Could not add user account");
                }

                try
                {
                    m_AuthInfoService.Store(authInfo);
                }
                catch
                {
                    m_UserAccountService.Remove(account.Principal.ID);
                    io.WriteFormatted("Could not add user account");
                }
            }
        }
Example #10
0
        public async Task <IActionResult> GetUserInfo()
        {
            string       currentUserName = User.Identity.Name;
            UserAuthInfo userInfo        = await _authorizationService.GetUserInfoAsync(currentUserName);

            if (userInfo == null)
            {
                return(NotFound());
            }

            return(Ok(userInfo));
        }
Example #11
0
        public ActionResult <UserAuthInfo> Login([FromBody] IdentityRequest request)
        {
            UserAuthInfo _UserAuthInfo = _identityService.LoginAsync(request.Username, request.Password, request.TokenDuration);

            if (!_UserAuthInfo.authInfo.Success)
            {
                //return BadRequest(_UserAuthInfo.authInfo);
                return(NotFound(_UserAuthInfo));
            }

            return(Ok(_UserAuthInfo));
        }
Example #12
0
        private async void btnAuthenticate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtApplicationID.Text.Length > 20 &&
                    txtSharedSecret.Text.Length > 20)
                {
                    btnAuthenticate.Text = "Authenticating...";
                    var appAuthInfo = new AppAuthInfo
                    {
                        ApplicationId = txtApplicationID.Text,
                        SharedSecret  = txtSharedSecret.Text
                    };
                    if (txtEmail.Text.Contains("@") &&
                        txtEmail.Text.Contains(".") &&
                        txtPassword.Text.Length > 5)
                    {
                        await AppAuthenticator.InitializeAsync(appAuthInfo);

                        btnAuthenticate.Text = "Loading Scopes...";
                        panelAPI.Visible     = true;
                        panelTenant.Visible  = true;
                        var userAuthInfo = new UserAuthInfo {
                            EmailAddress = txtEmail.Text, Password = txtPassword.Text
                        };
                        _userInfo = await UserAuthenticator.AuthenticateAsync(userAuthInfo, AuthenticationScope.Tenant);

                        panelTenant.Visible = true;
                        _userInfo.AuthorizedScopes.Insert(0, new Scope {
                            Id = -1, Name = "[Select Tenant]"
                        });
                        cbTenant.DataSource = _userInfo.AuthorizedScopes;

                        btnAuthenticate.Text = "Renew Authentication";
                    }
                    else
                    {
                        btnAuthenticate.Text = "Authenticate";
                        LogError(new Exception("Not enough User data entered for User Scope Authentication"));
                    }
                }
                else
                {
                    LogError(new Exception("Not enough Application data entered for Authentication"));
                }
            }
            catch (ApiException exc)
            {
                LogError(exc);
                btnAuthenticate.Text = "Authenticate";
            }
        }
Example #13
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public async Task <UserAuthInfo> SignInAsync(string email, string password)
        {
            var user = await _repo.GetUserByEmailAsync(email);

            if (UserInfo.IsNullOrEmpty(user))
            {
                return(null);
            }

            var auth = new UserAuthInfo(user.UserId, GenerateJSONWebToken(user));

            return(auth);
        }
        public override void Store(UserAuthInfo info)
        {
            var vals = new Dictionary <string, object>
            {
                ["UserID"]       = info.ID,
                ["PasswordHash"] = info.PasswordHash,
                ["PasswordSalt"] = info.PasswordSalt
            };

            using (var connection = new NpgsqlConnection(m_ConnectionString))
            {
                connection.Open();
                connection.ReplaceInto("auth", vals, new string[] { "UserID" }, m_EnableOnConflict);
            }
        }
Example #15
0
        /// <summary>
        /// 認証処理を行います。
        /// </summary>
        /// <param name="info">ユーザー認証情報</param>
        /// <returns>認証されたかどうか</returns>
        public async Task <bool> AuthenticateAsync(UserAuthInfo info)
        {
            using (var connection = DbConnector.CreateDbConnection())
            {
                connection.Open();
                var sql       = PrimitiveSql.CreateSelectSql <M_USER>();
                var parameter = new { ID = info.Id };
                var users     = await connection.QueryAsync <M_USER>(sql, parameter).ConfigureAwait(false);

                var user = users.FirstOrDefault();
                return(user != null &&
                       Convert.ToBoolean(user.ACTIVE_FLG) &&
                       user.PASSWORD == info.Password);
            }
        }
Example #16
0
        public async Task <WrapperStaffListVM> Add(StaffVM ViewModel)
        {
            var itemToAdd = _utilService.GetMapper().Map <StaffVM, Staff>(ViewModel);

            itemToAdd = _repositoryWrapper.Staff.Create(itemToAdd);
            Task <int> t1 = _repositoryWrapper.Staff.SaveChangesAsync();


            if (ViewModel.IsManager)
            {
                UserAuthInfo infoToAdd = new UserAuthInfo()
                {
                    FactoryId = ViewModel.FactoryId,
                    Password  = ViewModel.Password,
                    UserId    = itemToAdd.Id,
                    UserName  = ViewModel.UserName,
                };
                infoToAdd = _repositoryWrapper.UserAuthInfo.Create(infoToAdd);

                UserRole userRoleToAdd = new UserRole()
                {
                    FactoryId = ViewModel.FactoryId,
                    RoleId    = ViewModel.RoleId,
                    UserId    = infoToAdd.Id
                };
                userRoleToAdd = _repositoryWrapper.UserRole.Create(userRoleToAdd);
                Task <int> t2 = _repositoryWrapper.UserAuthInfo.SaveChangesAsync();
                Task <int> t3 = _repositoryWrapper.UserRole.SaveChangesAsync();
                await Task.WhenAll(t2, t3);
            }



            await Task.WhenAll(t1);

            this._utilService.Log("Successful In Adding Data");

            var dataParam = new GetDataListVM()
            {
                FactoryId  = itemToAdd.FactoryId,
                PageNumber = 1,
                PageSize   = 10,
                TotalRows  = 0
            };
            WrapperStaffListVM data = await GetListPaged(dataParam, true);

            return(data);
        }
Example #17
0
 public void Initialize()
 {
     CDbDeploy.ConnectDataBase();
     _userInfoGateway = new CUserInfoGateway();
     _usrLoginGateway = new CUserLoginGateway();
     _user            = new UserInfo()
     {
         Email = "*****@*****.**",
         Name  = "TestName"
     };
     _login = new UserAuthInfo()
     {
         Login    = "******",
         Password = "******"
     };
 }
        public override void SetPassword(UUID principalId, string password)
        {
            /* we use UserAuthInfo to calculate a new password */
            var ai = new UserAuthInfo
            {
                Password = password
            };
            var vals = new Dictionary <string, object>
            {
                ["PasswordHash"] = ai.PasswordHash,
                ["PasswordSalt"] = ai.PasswordSalt
            };

            using (var connection = new NpgsqlConnection(m_ConnectionString))
            {
                connection.Open();
                connection.UpdateSet("auth", vals, "\"UserID\" = '" + principalId.ToString() + "'");
            }
        }
Example #19
0
        public async override Task <UserAuthInfo> GetUserInfoAsync(string userName)
        {
            AppUser user = await _userManager.FindByNameAsync(userName);

            UserAuthInfo info = new UserAuthInfo
            {
                Role      = user.Role,
                UserId    = user.Id,
                UserName  = user.UserName,
                CompanyId = user.CompanyId,
            };

            if (user.CompanyId.HasValue)
            {
                CompanyDTO company = _companyService.GetById(user.CompanyId.Value);
                info.CompanyName = company.Name;
            }

            return(info);
        }
Example #20
0
        /// <summary>
        /// アクセストークンを取得します。
        /// </summary>
        /// <param name="info">ユーザー認証情報</param>
        /// <param name="requestToken">リクエストトークン</param>
        /// <returns>アクセストークン</returns>
        private static async Task <AccessToken> GetAccessTokenAsync(UserAuthInfo info, RequestToken requestToken)
        {
            var json      = JsonConvert.SerializeObject(info);
            var service   = new CryptoService(requestToken.Value);
            var encrypted = service.Encrypt(json);
            var content   = new ByteArrayContent(encrypted);

            content.Headers.Add("RequestToken", requestToken.Value);
            var response = await ApiClient.CreateDefault().PostAsync("Auth", content).ConfigureAwait(false);

            if (response.StatusCode == HttpStatusCode.Unauthorized)
            {
                return(null);
            }

            response.ThrowIfError();
            var body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <AccessToken>(body));
        }
Example #21
0
        public static async Task <AuthenticationProfile> AuthenticateAsync(UserAuthInfo authInfo, AuthenticationScope scope, int?id = null)
        {
            var resourceUrl = GetResourceUrl(scope, id);

            var client = new HttpClient {
                BaseAddress = new Uri(AppAuthenticator.Instance.BaseUrl)
            };


            var stringContent = JsonConvert.SerializeObject(authInfo);

            AppAuthenticator.AddHeader(client);

            var response = await client.PostAsync(resourceUrl, new StringContent(stringContent, Encoding.UTF8, "application/json"));

            ResponseHelper.EnsureSuccess(response);


            return(SetUserAuth(response.Content.ReadAsStringAsync().Result, scope, null));
        }
Example #22
0
        public UserAuthInfo LoginAsync(string username, string password, int tokenDuration)
        {
            UserAuthInfo _UserAuthInfo = new UserAuthInfo();



            _UserAuthInfo.UserId = _webaddressService.FindUser(username, password);

            if (_UserAuthInfo.UserId == 0)
            {
                _UserAuthInfo.authInfo.Success      = false;
                _UserAuthInfo.authInfo.AuthErrDescr = "User not found";


                return(_UserAuthInfo);
            }


            var tokenHandler    = new JwtSecurityTokenHandler();
            var key             = Encoding.ASCII.GetBytes(_jwtSettings);
            var tokenDescriptor = new SecurityTokenDescriptor
            {
                Subject = new ClaimsIdentity(new[]
                {
                    new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                    new Claim(JwtRegisteredClaimNames.Email, username),
                    new Claim("userid", _UserAuthInfo.UserId.ToString())
                }),
                Expires            = DateTime.UtcNow.AddHours(tokenDuration),
                SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
            };

            var token = tokenHandler.CreateToken(tokenDescriptor);

            _UserAuthInfo.authInfo.Success = true;
            _UserAuthInfo.authInfo.Token   = tokenHandler.WriteToken(token);



            return(_UserAuthInfo);
        }
Example #23
0
            WhenCheckAuthorizeResourceOwnerCredentialGrantWithForUserAccountWithInvalidPassword_ThenReturnsFalse()
            {
                var userAccount = new UserAuthInfo
                {
                    PasswordHash = "",
                };

                userStore.Setup(us => us.GetUserAuthInfo(It.IsAny <string>()))
                .Returns(userAccount);
                var request = new Mock <IAccessTokenRequest>();

                request.Setup(r => r.Scope).Returns(new HashSet <string>(new[]
                {
                    "ascope"
                }));

                AutomatedUserAuthorizationCheckResponse result =
                    server.CheckAuthorizeResourceOwnerCredentialGrant("username", "password",
                                                                      request.Object);

                Assert.False(result.IsApproved);
            }
Example #24
0
            public void WhenCheckAuthorizeResourceOwnerCredentialGrantWithNullClientIdentifier_ThenReturnsFalse()
            {
                var userAccount = new UserAuthInfo
                {
                    PasswordHash = @"sha1:1000:eVtc5YWo+HlEziLNmLoMDrdY8tNr71CG:iZN6EMU5uX1aF70dfFgTGA+wNToqUsnG",
                };

                userStore.Setup(us => us.GetUserAuthInfo(It.IsAny <string>()))
                .Returns(userAccount);
                var request = new Mock <IAccessTokenRequest>();

                request.Setup(r => r.Scope).Returns(new HashSet <string>(new[]
                {
                    "ascope"
                }));

                AutomatedUserAuthorizationCheckResponse result =
                    server.CheckAuthorizeResourceOwnerCredentialGrant("username", "password",
                                                                      request.Object);

                Assert.False(result.IsApproved);
            }
Example #25
0
        public void SimpleAuthLoginTest()
        {
            var emailAddress = Mozu.Api.Test.Helpers.Environment.GetConfigValueByEnvironment("devOwnerEmail");
            var password     = Mozu.Api.Test.Helpers.Environment.GetConfigValueByEnvironment("devOwnerPassword");

            var userAuthInfo = new UserAuthInfo {
                EmailAddress = emailAddress, Password = password
            };

            var userInfo = UserAuthenticator.Authenticate(userAuthInfo, AuthenticationScope.Developer);

            Assert.IsNotNull(userInfo);
            Assert.IsNotNull(userInfo.AuthTicket);
            Assert.IsNotNull(userInfo.AuthTicket.AccessToken);

            if (userInfo.ActiveScope == null)
            {
                userInfo = UserAuthenticator.SetActiveScope(userInfo.AuthTicket, userInfo.AuthorizedScopes.First());

                Assert.IsNotNull(userInfo);
                Assert.IsNotNull(userInfo.ActiveScope);
            }
        }
Example #26
0
        public Task <HttpResponseMessage> Get()
        {
            UserInfo     userInfo     = null;
            UserAuthInfo userAuthInfo = null;
            var          cookie       = Request.Headers.GetCookies(TwitterSignInController.UserAccessCookieName).FirstOrDefault();

            if (cookie != null)
            {
                TwitterOauthUtils.ParseUserAccessCookie(cookie[TwitterSignInController.UserAccessCookieName].Value, out userInfo, out userAuthInfo);
            }

            var response = Request.CreateResponse(HttpStatusCode.OK);

            if (userInfo != null)
            {
                response.Content = new StringContent(
                    JsonConvert.SerializeObject(userInfo),
                    Encoding.UTF8,
                    "application/json");
            }

            return(Task.FromResult(response));
        }
Example #27
0
        public async Task <JWTTokenStatusResult> GenerateTokenAsync(AuthSignInModel model)
        {
            bool status = await VerifyUserAsync(model);

            if (!status)
            {
                return(new JWTTokenStatusResult()
                {
                    Token = null, IsAuthorized = false
                });
            }

            IEnumerable <Claim> claims = await GetUserClaimsAsync(model);

            JwtSecurityToken token = _tokenFactory.CreateToken(model.UserName.ToString(), claims);
            UserAuthInfo     info  = await GetUserInfoAsync(model.UserName);

            return(new JWTTokenStatusResult()
            {
                Token = new JwtSecurityTokenHandler().WriteToken(token),
                IsAuthorized = true,
                UserInfo = info,
            });
        }
Example #28
0
        public Int32 Create(UserInfo entity, UserAuthInfo login)
        {
            Int32             userId       = 0;
            CUserLoginGateway loginGateway = new CUserLoginGateway();

            using (SqlConnection connection = CDbConnection.GetConnection())
            {
                SqlTransaction transaction = connection.BeginTransaction();

                SqlCommand command = connection.CreateCommand();
                command.Transaction = transaction;
                command.CommandType = CommandType.StoredProcedure;

                try
                {
                    command.CommandText = "sp_InsertUserLogin";
                    SqlParameter loginParam = new SqlParameter
                    {
                        ParameterName = "@login",
                        Value         = login.Login
                    };
                    command.Parameters.Add(loginParam);
                    SqlParameter passParam = new SqlParameter
                    {
                        ParameterName = "@password",
                        Value         = login.Password
                    };
                    command.Parameters.Add(passParam);
                    var result = command.ExecuteScalar();
                    Int32.TryParse(result.ToString(), out Int32 loginId);
                    command.CommandText = "sp_InsertUser";
                    command.Parameters.Clear();
                    SqlParameter name = new SqlParameter
                    {
                        ParameterName = "@name",
                        Value         = entity.Name
                    };
                    command.Parameters.Add(name);
                    SqlParameter emailParam = new SqlParameter
                    {
                        ParameterName = "@email",
                        Value         = entity.Email
                    };
                    command.Parameters.Add(emailParam);
                    SqlParameter loginIdParam = new SqlParameter
                    {
                        ParameterName = "@loginId",
                        Value         = loginId
                    };
                    command.Parameters.Add(loginIdParam);

                    result = command.ExecuteScalar();
                    Int32.TryParse(result.ToString(), out userId);

                    transaction.Commit();
                    Console.WriteLine($"Id добавленного объекта: {loginId}");
                    Console.WriteLine($"Id добавленного объекта: {userId} ");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    transaction.Rollback();
                }

                return(userId);
            }
        }
Example #29
0
        //-------------------------------------------------------------------------------
        //
        private bool OAuth_Authenticate(out UserAuthInfo userdata)
        {
            try {
                string req_token, req_token_secret;

                req_token = Twitter.oauth_request_token(out req_token_secret);

                string authURL = Twitter.oauth_authorize_URL(req_token);

                string pin = null;
                // フォーム表示
                using (FrmAuthWebBrowser frmweb = new FrmAuthWebBrowser()) {
                    frmweb.SetURL(authURL);
                    if (frmweb.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                        pin = frmweb.PIN;
                    }
                }
                if (pin == null) { userdata = new UserAuthInfo(); return false; }

                userdata = Twitter.oauth_access_token(pin, req_token, req_token_secret);
            }
            catch (TwitterAPIException ex) {
                Log.DebugLog(ex);
                userdata = new UserAuthInfo();
                return false;
            }
            return true;
        }
Example #30
0
        //-------------------------------------------------------------------------------
        /// <summary>
        /// 最終認証を行います。正式なoauth_tokenが返ります。
        /// </summary>
        /// <param name="pin">ユーザーが貰ったキー</param>
        /// <param name="reqToken">request_token</param>
        /// <param name="reqTokenSecret">request_token_secret</param>
        /// <param name="access_token_secret">正式なoauth_token_secret</param>
        public UserAuthInfo oauth_access_token(string pin, string reqToken, string reqTokenSecret)
        {
            string url = URLapiSSLnoVer + "oauth/access_token";

            SortedDictionary<string, string> parameters = GenerateParameters(reqToken);
            parameters.Add("oauth_verifier", pin);
            string signature = GenerateSignature(reqTokenSecret, GET, url, parameters);
            parameters.Add("oauth_signature", Utilization.UrlEncode(signature));
            string response = HttpGet(url, parameters);
            Dictionary<string, string> dic = ParseResponse(response);

            UserAuthInfo userdata = new UserAuthInfo() {
                AccessToken = dic["oauth_token"],
                AccessTokenSecret = dic["oauth_token_secret"],
                ID = long.Parse(dic["user_id"]),
                ScreenName = dic["screen_name"]
            };
            return userdata;
        }
Example #31
0
        public string SaveChanges(List <XMLWebpad.TreeNode> tree1, List <XMLWebpad.TreeNode> tree2, string xmlfileloc, UserAuthInfo userinfo)
        {
            TreeBuilder tb = new TreeBuilder();

            return(tb.SaveChanges(tree1, tree2, xmlfileloc, userinfo));
        }
Example #32
0
 public abstract void Store(UserAuthInfo info);