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