Ejemplo n.º 1
0
Archivo: User.cs Proyecto: yhhno/nfx
 public User(Credentials credentials,
     AuthenticationToken token,
     string name,
     Rights rights)
     : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
Ejemplo n.º 2
0
    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
      var cred = new NOPCredentials(email);
      var at = new AuthenticationToken(NOP_REALM, email);

      User = new User(cred, at, email, Rights.None);
    }
    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
      var apiKey = node.AttrByName(CONFIG_APIKEY_ATTR).Value;

      var cred = new TaxJarCredentials(email, apiKey);
      var at = new AuthenticationToken(TAXJAR_REALM, email);

      User = new User(cred, at, UserStatus.User, email, email, Rights.None);
    }
Ejemplo n.º 4
0
        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

            var email = node.AttrByName(CFG_EMAIL).Value;
            var clientID = node.AttrByName(CFG_CLIENT_ID).Value;
            var clientSecret = node.AttrByName(CFG_CLIENT_SECRET).Value;

            var credentials = new PayPalCredentials(email, clientID, clientSecret);
            var token = new AuthenticationToken(PayPalSystem.PAYPAL_REALM, null); // OAuth token is empty at start
            User = new User(credentials, token, email, Rights.None);
        }
Ejemplo n.º 5
0
      public override void Configure(IConfigSectionNode node)
      {
        base.Configure(node);
        
        var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
        
        var credentials = new GoogleDriveCredentials(email);

        var authToken = new AuthenticationToken();

        User = new User(credentials, authToken, UserStatus.User, name:null, descr:null, rights:Rights.None);
      }
Ejemplo n.º 6
0
    //private MockActualAccountData[] m_AccountActualDatas;

    //public IEnumerable<MockActualAccountData> AccountActualDatas { get { return m_AccountActualDatas; } }

    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
      var cred = new MockCredentials(email);
      var at = new AuthenticationToken(MOCK_REALM, email);

      User = new User(cred, at, email, Rights.None);

      //var nAccounts = node[CONFIG_ACCOUNTS_SECTION];
      //configureAccounts(nAccounts);
    }
Ejemplo n.º 7
0
        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
              var secretKey = node.AttrByName(CONFIG_SECRETKEY_ATTR).Value;
              var publishableKey = node.AttrByName(CONFIG_PUBLISHABLEKEY_ATTR).Value;

              var cred = new StripeCredentials(email, secretKey, publishableKey);
              var at = new AuthenticationToken(STRIPE_REALM, publishableKey);

              User = new User(cred, at, UserStatus.User, publishableKey, publishableKey, Rights.None);
        }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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);  
      }
    }
Ejemplo n.º 10
0
        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var privateToken = node.AttrByName("private-token").ValueAsString();
              if (privateToken.IsNullOrWhiteSpace())
            User = User.Fake;

              var publicToken = node.AttrByName("public-token").ValueAsString();
              if (publicToken.IsNullOrWhiteSpace())
            User = User.Fake;

              var carrierID = node.AttrByName("carrier-id").ValueAsString();
              if (carrierID.IsNotNullOrWhiteSpace())
            CarrierID = carrierID;

              var cred = new ShippoCredentials(privateToken, publicToken);
              var token = new AuthenticationToken(ShippoSystem.SHIPPO_REALM, null);
              User = new User(cred, token, null, Rights.None);
        }
Ejemplo n.º 11
0
 public User Authenticate(AuthenticationToken token)
 {
     return User.Fake;
 }
Ejemplo n.º 12
0
          private void refreshOAuthToken(PayPalConnectionParameters connectParameters)
          {   
              try
              {
                  Log(MessageType.Info, "refreshOAuthToken()", StringConsts.PAYPAL_REFRESH_TOKEN_MESSAGE);

                  var user = connectParameters.User;
                  
                  var request = new WebClient.RequestParams
                  { 
                      Caller = this,
                      Uri = new Uri(m_ApiUri + URI_GET_OAUTH_TOKEN),
                      Method = HTTPRequestMethod.POST,
                      ContentType = ContentType.FORM_URL_ENCODED,
                      Headers = new Dictionary<string, string> 
                          { 
                              { HDR_AUTHORIZATION, HDR_AUTHORIZATION_BASIC.Args(getBaseAuthString(user.Credentials)) } 
                          },
                      BodyParameters = new Dictionary<string, string> 
                          { 
                              { PRM_GRANT_TYPE, PRM_CLIENT_CREDENTIALS } 
                          }
                  };
                  
                  var response = WebClient.GetJson(request);
                  Log(MessageType.Info, "refreshOAuthToken()", response.ToJSON());
                  
                  var oauthToken = new PayPalOAuthToken(response, m_OAuthTokenExpirationMargin);
                  var token = new AuthenticationToken(PAYPAL_REALM, oauthToken);
                  connectParameters.User = new User(user.Credentials, token, user.Name, user.Rights);

                  Log(MessageType.Info, "refreshOAuthToken()", StringConsts.PAYPAL_TOKEN_REFRESHED_MESSAGE);
              }
              catch (Exception ex)
              {   
                  var message = StringConsts.PAYPAL_REFRESH_TOKEN_ERROR.Args(ex.ToMessageWithType());
                  var error = PayPalPaymentException.ComposeError(message, ex);
                  Log(MessageType.Error, "refreshOAuthToken()", error.Message, ex);
                  
                  throw error;
              }
          } 
Ejemplo n.º 13
0
        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);
              var accessKey = node.AttrByName(CONFIG_ACCESSKEY_ATTR).Value;
              var secretKey = node.AttrByName(CONFIG_SECRETKEY_ATTR).Value;

              if (accessKey.IsNotNullOrWhiteSpace())
            {
            var cred = new S3Credentials(accessKey, secretKey);
            var at = new AuthenticationToken(Bucket, accessKey);
            User = new User(cred, at, UserStatus.User, accessKey, accessKey, Rights.None);
            }
        }
Ejemplo n.º 14
0
        public User Authenticate(AuthenticationToken token)
        {
            var idpass = authTokenToCred(token);

            return(Authenticate(idpass));
        }
Ejemplo n.º 15
0
            private IDPasswordCredentials authTokenToCred(AuthenticationToken token)
            {
                if (token.Data==null)
                    return new IDPasswordCredentials(string.Empty, string.Empty);

                var seg = token.Data.ToString().Split('\n');

                if (seg.Length<2)
                    return new IDPasswordCredentials(string.Empty, string.Empty);
               
                return new IDPasswordCredentials(seg[0], seg[1]);
            }
Ejemplo n.º 16
0
 public User Authenticate(AuthenticationToken token)
 {
     var idpass = authTokenToCred(token);
     return Authenticate(idpass);
 }
Ejemplo n.º 17
0
 public User(Credentials credentials,
             AuthenticationToken token,
             string name,
             Rights rights) : this(credentials, token, UserStatus.User, name, null, rights)
 {
 }
Ejemplo n.º 18
0
 public AuthenticationHeader(AuthenticationToken token)
 {
     m_Token = token; 
 }
Ejemplo n.º 19
0
 public User Authenticate(AuthenticationToken token)
 {
     return(User.Fake);
 }