示例#1
0
文件: User.cs 项目: yhhno/nfx
 public User(Credentials credentials,
     AuthenticationToken token,
     string name,
     Rights rights)
     : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
示例#2
0
文件: User.cs 项目: vlapchenko/nfx
 public User(Credentials credentials, 
             AuthenticationToken token,
             UserStatus status, 
             string name,
             string descr,
             Rights rights)
 {
     m_Credentials = credentials;
     m_AuthenticationToken = token;
     m_Status = status;
     m_Name = name;
     m_Description = descr;
     m_Rights = rights;
 }
示例#3
0
        }                    //for quicker serialization

        public User(Credentials credentials,
                    AuthenticationToken token,
                    UserStatus status,
                    string name,
                    string descr,
                    Rights rights)
        {
            m_Credentials         = credentials;
            m_AuthenticationToken = token;
            m_Status             = status;
            m_Name               = name;
            m_Description        = descr;
            m_Rights             = rights;
            m_StatusTimeStampUTC = App.TimeSource.UTCNow;
        }
示例#4
0
文件: User.cs 项目: dotnetchris/nfx
 /// <summary>
 /// Framework-internal. Do not call
 /// </summary>
 public void ___update_status(
     UserStatus status,
     string name,
     string descr,
     Rights rights)
 {
     if (object.ReferenceEquals(this, s_FakeUserInstance))
     {
         return;                                                      //Fake user is immutable
     }
     m_Status             = status;
     m_Name               = name;
     m_Description        = descr;
     m_Rights             = rights;
     m_StatusTimeStampUTC = App.TimeSource.UTCNow;
 }
示例#5
0
        public User Authenticate(Credentials credentials)
        {
            var sect = m_Config ?? App.ConfigRoot[CommonApplicationLogic.CONFIG_SECURITY_SECTION];

            if (sect.Exists && credentials is IDPasswordCredentials)
            {
                var idpass = (IDPasswordCredentials)credentials;

                var usern = findUserNode(sect, idpass);

                if (usern.Exists)
                {
                    var name   = usern.AttrByName(CONFIG_NAME_ATTR).ValueAsString(string.Empty);
                    var descr  = usern.AttrByName(CONFIG_DESCRIPTION_ATTR).ValueAsString(string.Empty);
                    var status = usern.AttrByName(CONFIG_STATUS_ATTR).ValueAsEnum <UserStatus>(UserStatus.Invalid);

                    var rights = Rights.None;

                    var rightsn = usern[CONFIG_RIGHTS_SECTION];

                    if (rightsn.Exists)
                    {
                        var data = new MemoryConfiguration();
                        data.CreateFromNode(rightsn);
                        rights = new Rights(data);
                    }

                    return(new User(credentials,
                                    credToAuthToken(idpass),
                                    status,
                                    name,
                                    descr,
                                    rights));
                }
            }

            return(new User(credentials,
                            new AuthenticationToken(),
                            UserStatus.Invalid,
                            StringConsts.SECURITY_NON_AUTHENTICATED,
                            StringConsts.SECURITY_NON_AUTHENTICATED,
                            Rights.None));
        }
示例#6
0
文件: User.cs 项目: yhhno/nfx
 /// <summary>
 /// Framework-internal. Do not call
 /// </summary>
 public void ___update_status(
     UserStatus status,
     string name,
     string descr,
     Rights rights)
 {
     if (object.ReferenceEquals(this, s_FakeUserInstance)) return;//Fake user is immutable
         m_Status = status;
         m_Name = name;
         m_Description = descr;
         m_Rights = rights;
         m_StatusTimeStampUTC = App.TimeSource.UTCNow;
 }
示例#7
0
            public User Authenticate(Credentials credentials)
            {
              var sect = m_Config ?? App.ConfigRoot[CommonApplicationLogic.CONFIG_SECURITY_SECTION];
              if (sect.Exists && credentials is IDPasswordCredentials)
              { 
                  var idpass = (IDPasswordCredentials)credentials;
                  
                  var usern = findUserNode(sect, idpass);

                  if (usern.Exists)
                  {
                      var name = usern.AttrByName(CONFIG_NAME_ATTR).ValueAsString(string.Empty);
                      var descr = usern.AttrByName(CONFIG_DESCRIPTION_ATTR).ValueAsString(string.Empty);
                      var status = usern.AttrByName(CONFIG_STATUS_ATTR).ValueAsEnum<UserStatus>(UserStatus.Invalid);
                      
                      var rights = Rights.None;
                      
                      var rightsn = usern[CONFIG_RIGHTS_SECTION];
                      
                      if (rightsn.Exists)
                      {
                        var data = new MemoryConfiguration();
                        data.CreateFromNode(rightsn);
                        rights = new Rights(data);
                      } 
                      
                      return new User(credentials,
                                      credToAuthToken(idpass),
                                      status,
                                      name,
                                      descr,
                                      rights);
                  }
              }
                
              return new User(credentials, 
                              new AuthenticationToken(),
                              UserStatus.Invalid, 
                              StringConsts.SECURITY_NON_AUTHENTICATED,
                              StringConsts.SECURITY_NON_AUTHENTICATED,
                              Rights.None); 
            }
示例#8
0
文件: User.cs 项目: dotnetchris/nfx
 public User(Credentials credentials,
             AuthenticationToken token,
             string name,
             Rights rights) : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
示例#9
0
文件: User.cs 项目: vlapchenko/nfx
 /// <summary>
 /// Framework-internal. Do not call
 /// </summary>
 public void ___reset_data(
               UserStatus status, 
               string name,
               string descr,
               Rights rights)
   {
       m_Status = status;
       m_Name = name;
       m_Description = descr;
       m_Rights = rights;
   }