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); } }
private AuthenticationToken credToAuthToken(IDPasswordCredentials cred) { return(new AuthenticationToken(this.GetType().FullName, "{0}\n{1}".Args(cred.ID, cred.Password))); }