private IConfigSectionNode findUserNode(IConfigSectionNode securityRootNode, IDPasswordCredentials cred) { var users = securityRootNode[CONFIG_USERS_SECTION]; return(users.Children.FirstOrDefault(cn => cn.IsSameName(CONFIG_USER_SECTION) && string.Equals(cn.AttrByName(CONFIG_ID_ATTR).Value, cred.ID, StringComparison.InvariantCulture) && string.Equals(cn.AttrByName(CONFIG_PASSWORD_ATTR).Value, cred.Password.ToMD5String(), StringComparison.InvariantCultureIgnoreCase) ) ?? users.Configuration.EmptySection); }
private IConfigSectionNode findUserNode(IConfigSectionNode securityRootNode, IDPasswordCredentials cred) { var users = securityRootNode[CONFIG_USERS_SECTION]; using (var password = cred.SecurePassword) { bool needRehash = false; return(users.Children.FirstOrDefault(cn => cn.IsSameName(CONFIG_USER_SECTION) && string.Equals(cn.AttrByName(CONFIG_ID_ATTR).Value, cred.ID, StringComparison.InvariantCulture) && m_PasswordManager.Verify(password, HashedPassword.FromString(cn.AttrByName(CONFIG_PASSWORD_ATTR).Value), out needRehash) ) ?? users.Configuration.EmptySection); } }
public override void Configure(IConfigSectionNode node) { base.Configure(node); var unm = node.AttrByName(CONFIG_UNAME_ATTR).Value; var upwd = node.AttrByName(CONFIG_UPWD_ATTR).Value; if (unm.IsNotNullOrWhiteSpace()) { var cred = new IDPasswordCredentials(unm, upwd); var at = new AuthenticationToken(ServerURL, unm); User = new User(cred, at, UserStatus.User, unm, unm, Rights.None); } }
private AuthenticationToken credToAuthToken(IDPasswordCredentials cred) { return(new AuthenticationToken(this.GetType().FullName, "{0}\n{1}".Args(cred.ID, cred.Password))); }
private AuthenticationToken credToAuthToken(IDPasswordCredentials cred) { return new AuthenticationToken(this.GetType().FullName, "{0}\n{1}".Args(cred.ID, cred.Password)); }
private IConfigSectionNode findUserNode(IConfigSectionNode securityRootNode, IDPasswordCredentials cred) { var users = securityRootNode[CONFIG_USERS_SECTION]; return users.Children.FirstOrDefault( cn => cn.IsSameName(CONFIG_USER_SECTION) && string.Equals(cn.AttrByName(CONFIG_ID_ATTR).Value, cred.ID, StringComparison.InvariantCulture) && string.Equals(cn.AttrByName(CONFIG_PASSWORD_ATTR).Value, cred.Password.ToMD5String(), StringComparison.InvariantCultureIgnoreCase) ) ?? users.Configuration.EmptySection; }