Beispiel #1
0
Datei: User.cs Projekt: yhhno/nfx
 public User(Credentials credentials,
     AuthenticationToken token,
     string name,
     Rights rights)
     : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
Beispiel #2
0
 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;
 }
Beispiel #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;
        }
Beispiel #4
0
 /// <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;
 }
Beispiel #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));
        }
Beispiel #6
0
Datei: User.cs Projekt: 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;
 }
            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); 
            }
Beispiel #8
0
 public User(Credentials credentials,
             AuthenticationToken token,
             string name,
             Rights rights) : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
Beispiel #9
0
 /// <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;
   }