Пример #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
 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
 public User Authenticate(Credentials credentials)
 {
     return User.Fake;
 }
Пример #4
0
 private static string getBaseAuthString(Credentials credentials)
 {
     var payPalCredentials = credentials as PayPalCredentials;
     var bytes = Encoding.UTF8.GetBytes(BASIC_AUTH_FORMAT.Args(payPalCredentials.ClientID, payPalCredentials.ClientSecret));
     return Convert.ToBase64String(bytes);
 }
Пример #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
 private string getAuthHeader(Credentials credentials)
 {
     if (credentials is BraintreeCredentials)
     return HDR_AUTHORIZATION_BASIC.Args(getBasicAuthString((credentials as BraintreeCredentials)));
       if (credentials is BraintreeAuthCredentials)
     return HDR_AUTHORIZATION_OAUTH.Args((credentials as BraintreeAuthCredentials).AccessToken);
       throw new NFXException("{0}.getAuthHeader({1})".Args(GetType().Name, credentials.GetType().Name));
 }
Пример #7
0
 /// <summary>
 /// Inits header with Credentials instance. 
 /// Note: passing IDPasswordCredentials over public wire is not a good practice,
 /// pass AuthenticationToken instead 
 /// </summary>
 public AuthenticationHeader(Credentials credentials)
 {
     m_Credentials = credentials; 
 }
Пример #8
0
 public User(Credentials credentials,
             AuthenticationToken token,
             string name,
             Rights rights) : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
Пример #9
0
 public User Authenticate(Credentials credentials)
 {
     return(User.Fake);
 }