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(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);
        }
示例#3
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);
      }
示例#4
0
        protected ShippingSession(ShippingSystem shipSystem, ShippingConnectionParameters cParams)
        {
            if (shipSystem == null || cParams == null)
              throw new ShippingException(StringConsts.ARGUMENT_ERROR + this.GetType().Name + ".ctor(shipSystem != null and cParams != null)");

            m_ShippingSystem = shipSystem;
            m_Name = cParams.Name;
            m_User = cParams.User;

            lock (m_ShippingSystem.Sessions)
              m_ShippingSystem.Sessions.Add(this);
        }
    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);
    }
        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);
        }
    //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);
    }
示例#8
0
        protected PaySession(PaySystem paySystem, PayConnectionParameters cParams)
        {
            if (paySystem == null || cParams == null)
              throw new PaymentException(StringConsts.ARGUMENT_ERROR + this.GetType().Name + ".ctor(paySystem is not null and cParams is not null)");

            m_PaySystem = paySystem;

            m_Name = cParams.Name;

            m_User = cParams.User;

            lock (m_PaySystem.m_Sessions)
              m_PaySystem.m_Sessions.Add(this);
        }
示例#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);  
      }
    }
示例#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);
        }
        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var merchantId = node.AttrByName("merchant-id").ValueAsString();
              if (merchantId.IsNullOrWhiteSpace())
            User = User.Fake; //throw new PaymentException("Braintree: " + StringConsts.PAYMENT_BRAINTREE_MERCHANT_ID_REQUIRED.Args(this.GetType().FullName));

              var accessToken = node.AttrByName("access-token").ValueAsString();
              if (accessToken.IsNotNullOrWhiteSpace())
            User = new User(new BraintreeAuthCredentials(merchantId, accessToken), new AuthenticationToken(BRAINTREE_REALM, accessToken), merchantId, Rights.None);
              else
              {
            var publicKey = node.AttrByName("public-key").ValueAsString();
            var privateKey = node.AttrByName("private-key").ValueAsString();
            if (publicKey.IsNullOrWhiteSpace() || privateKey.IsNullOrWhiteSpace())
              User = User.Fake; //throw new PaymentException("Braintree: " + StringConsts.PAYMENT_BRAINTREE_CREDENTIALS_REQUIRED.Args(this.GetType().FullName));

            User = new User(new BraintreeCredentials(merchantId, publicKey, privateKey), new AuthenticationToken(BRAINTREE_REALM, publicKey), merchantId, Rights.None);
              }
        }
示例#12
0
 public AccessLevel Authorize(User user, Permission permission)
 {
     return new AccessLevel(user, permission, Rights.None.Root);
 }
示例#13
0
 public void Authenticate(User user)
 {
 }
示例#14
0
 public static AccessLevel DeniedFor(User user, Permission permission)
 {
     return new AccessLevel(user, permission, DENIED_CONF);
 }
示例#15
0
 /// <summary>
 /// Shortcut method that creates a temp/mock BaseSession object thus checking permission in mock BaseSession context
 /// </summary>
 public bool Check(User user)
 {
     if (user==null || !user.IsAuthenticated) return false;
       var session = new BaseSession(Guid.NewGuid());
       session.User = user;
       return this.Check(session);
 }
示例#16
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);
            }
        }
示例#17
0
            public AccessLevel Authorize(User user, Permission permission)
            {
                if (user==null || permission==null) 
                 throw new SecurityException(StringConsts.ARGUMENT_ERROR+GetType().Name+".Authorize(user==null|permission==null)");

                var node = user.Rights.Root.NavigateSection(permission.FullPath);

                return new AccessLevel(user, permission, node);
            }
示例#18
0
            public void Authenticate(User user)
            {
                if (user==null) return;
                var token = user.AuthToken;
                var reuser = Authenticate(token);

                user.___reset_data(reuser.Status, reuser.Name, reuser.Description, reuser.Rights);
            }
示例#19
0
 public AccessLevel(User user, Permission permission, IConfigSectionNode data)
 {
     m_User = user;
     m_Permission = permission;
     m_Data = data;
 }