예제 #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;
   }