public IValidate Validation; //yeni bir işlem ekleyince buraya da yazıyoruz

        public CrossCuttingConcernFacade()
        {
            Logging    = new Logging();
            Caching    = new Caching();
            Authorize  = new Authorize();
            Validation = new Validation(); //yeni bir işlem ekleyince buraya da yazıyoruz
        }
Exemple #2
0
 /// <summary>
 /// Обработчик запуска службы
 /// Этот метод считать точкой входа а-ля main()
 /// </summary>
 /// <param name="args"></param>
 protected override void OnStart(string[] args)
 {
     _instance = new AuthorizationService();
     _service  = new ServiceHost(_instance);
     _service.Open();
     _logger.Info("OnStart");
 }
Exemple #3
0
 public static IAuthorize GetAuthorizer()
 {
     if (!s_HasSetAuthorizerType)
     {
         lock (s_SyncObj)
         {
             if (!s_HasSetAuthorizerType)
             {
                 string path = GetConfigPath();
                 if (File.Exists(path))
                 {
                     XmlDocument x = new XmlDocument();
                     x.Load(path);
                     XmlNode node = x.SelectSingleNode(@"//serviceList");
                     if (node != null)
                     {
                         string name = GetNodeAttribute(node, "authorizerType");
                         if (name != null && name.Trim().Length > 0)
                         {
                             Type type = Type.GetType(name, false);
                             s_Authorizer = (IAuthorize)Activator.CreateInstance(type);
                         }
                     }
                 }
                 s_HasSetAuthorizerType = true;
             }
         }
     }
     return(s_Authorizer);
 }
Exemple #4
0
        public static IAuthorize GetAuthorizeInterface()
        {
            string className, profilePath;

            string dataBaseType = ConfigurationManager.AppSettings["DataBaseType"] as string;

            switch (dataBaseType)
            {
            case "ORACLE":
                className   = "SinoSZAuthorizeDC.OraAuthorizeFactroy";
                profilePath = "SinoSZAuthorizeDC";
                return((IAuthorize)Assembly.Load(profilePath).CreateInstance(className));


            case "SQLSERVER":
                return(null);

            case "REMOTING":
                IServiceFactory _serviceFactory = (IServiceFactory)RemotingClientSvc.GetAppSvrObj(typeof(IServiceFactory));
                RemotingClientSvc.BindTicketToCallContext(SessionClass.CurrentTicket);
                IAuthorize _ret = _serviceFactory.GetInterFace("AuthorizeServerPlugin") as IAuthorize;
                return(_ret);
            }

            return(null);
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthorizeAttribute"/> class.
        /// </summary>
        /// <param name="authorizer">The authorization framework integration interface</param>
        public AuthorizeAttribute(IAuthorize authorizer)
        {
            WhiteList = new string[0];
            Blacklist = new string[0];

            _authorizer = authorizer;
        }
Exemple #6
0
 public CrossCuttingConcernsFacade()
 {
     Caching   = new Caching();
     Logging   = new Logging();
     Authorize = new Authorize();
     Validate  = new Validate();
 }
Exemple #7
0
 public Facade()
 {
     logging   = new Logging();
     caching   = new Caching();
     authorize = new Authorize();
     validate  = new Validation();
 }
Exemple #8
0
 public IValidation Validation;                                                                //
 public CrossFacade()                                                                          //
 {                                                                                             //
     Logging    = new Logging();                                                               //
     Cachig     = new Caching();                                                               //
     Authorize  = new Authorize();                                                             //
     Validation = new Validation();                                                            //
 }                                                                                             //
Exemple #9
0
 public CCCFacade()
 {
     Logging    = new Logging();
     Caching    = new Caching();
     Authorize  = new Authorize();
     Validation = new Validation();
 }
Exemple #10
0
        //private ILogging _logging;
        //private ICaching _caching;
        //private IAuthorize _authorize;

        public CustomerManager(ILogging logging, ICaching caching, IAuthorize authorize)
        {
            _concerns = new CCCFacade();
            //_logging = logging;
            //_caching = caching;
            //_authorize = authorize;
        }
Exemple #11
0
        public T Authorize <T>(IAuthorize authorize) where T : IPayment
        {
            var url = _context.Url + "/quickbooks/v4/payments/charges";

            var payment = new Model.Gateway.Payment();

            payment.Amount   = authorize.Amount;
            payment.Currency = _context.Currency;

            var address = new Model.Gateway.Address();

            address.City          = authorize.Customer.City;
            address.Country       = authorize.Customer.Country;
            address.PostalCode    = authorize.Customer.Zipcode;
            address.Region        = authorize.Customer.StateOrProvince;
            address.StreetAddress = authorize.Customer.Address;

            var creditCard = new Model.Gateway.CreditCard();

            creditCard.Name     = authorize.Customer.FirstName + " " + authorize.Customer.LastName;
            creditCard.Address  = address;
            creditCard.Number   = authorize.CreditCard.CardNumber;
            creditCard.ExpMonth = authorize.CreditCard.ExpirationMonth;
            creditCard.ExpYear  = authorize.CreditCard.ExpirationYear;
            creditCard.CVC      = authorize.CreditCard.CVV;

            payment.Card    = creditCard;
            payment.Capture = "false";

            var body = JsonConvert.SerializeObject(payment);

            var response = _context.SendRequest(url, "POST", body, new Dictionary <string, string>(), null);

            return(JsonConvert.DeserializeObject <T>(response.Body.ToString()));
        }
 public CrossCuttingConcernsFacade()
 {
     Logging    = new Logging();
     Caching    = new Caching();
     Authorize  = new Authorize();
     Validation = new Validator();
 }
Exemple #13
0
 /// <summary>
 /// 实例化授权注册窗口
 /// </summary>
 /// <param name="aboutCode">提示关于怎么获取注册码的信息</param>
 /// <param name="encrypt">加密的方法</param>
 public FormAuthorize(string aboutCode, IAuthorize authorize)
 {
     InitializeComponent();
     Authorize               = authorize;
     machineCode             = Authorize.GetMachineCodeString();
     this.lblMachineCode.Tag = machineCode;
 }
Exemple #14
0
 public CrossCuttingConcernsFacade()
 {
     _logging   = new Logging();
     _cache     = new Caching();
     _authorize = new Authorize();
     _validate  = new Validate();
 }
 public CrossCuttongConcernsFacede()
 {
     Logging    = new Logging();
     Cahcing    = new Caching();
     Authorize  = new Authorize();
     Validation = new Validation();
 }
 public static IAuthorize GetAuthorizer()
 {
     if (!s_HasSetAuthorizerType)
     {
         lock (s_SyncObj)
         {
             if(!s_HasSetAuthorizerType)
             {
                 string path = GetConfigPath();
                 if (File.Exists(path))
                 {
                     XmlDocument x = new XmlDocument();
                     x.Load(path);
                     XmlNode node = x.SelectSingleNode(@"//serviceList");
                     if (node != null)
                     {
                         string name = GetNodeAttribute(node, "authorizerType");
                         if (name != null && name.Trim().Length > 0)
                         {
                             Type type = Type.GetType(name, false);
                             s_Authorizer = (IAuthorize)Activator.CreateInstance(type);
                         }
                     }
                 }
                 s_HasSetAuthorizerType = true;
             }
         }
     }
     return s_Authorizer;
 }
Exemple #17
0
 /// <summary>
 /// Authorizes a charge for the specified amount on the given credit card.
 /// </summary>
 /// <param name="cardNumber">The card number.</param>
 /// <param name="expirationMonthAndYear">The expiration month and year.</param>
 /// <param name="cvv">The CVV.</param>
 /// <param name="amount">The amount.</param>
 /// <returns></returns>
 public override void Authorize(IAuthorize authorize)
 {
     SetApiAction(RequestAction.Authorize);
     Queue(AuthorizeDotNetApi.CreditCardNumber, authorize.CreditCard.CardNumber);
     Queue(AuthorizeDotNetApi.CreditCardExpiration, authorize.CreditCard.ExpirationMonth + authorize.CreditCard.ExpirationYear);
     Queue(AuthorizeDotNetApi.CreditCardCode, authorize.CreditCard.CVV);
     Queue(AuthorizeDotNetApi.Amount, authorize.Amount.ToString());
 }
 public UsersApi(IUsersTable usersTable, IMapper mapper, JsonSerializerOptions jsonOptions,
                 JsonObjectSerializer jsonSerializer, IAuthorize authorize)
     : base(jsonOptions, jsonSerializer)
 {
     this.usersTable = usersTable;
     this.mapper     = mapper;
     this.authorize  = authorize;
 }
Exemple #19
0
        public Utilities(IConfiguration configuration, IAuthorize authorize)
        {
            _authorize = authorize;

            Root = (configuration["magic:io:root-folder"] ?? "~/files/")
                   .Replace("~", Directory.GetCurrentDirectory())
                   .TrimEnd('/') + "/";
        }
Exemple #20
0
 public APISecurityProvider(IOperationSecurityConfigProvider securityConfigProvider, ISemanticLog logger, ISessionManager sessionManager, IAuthorize authorize, IExecutionContextProvider executionContextProvider)
 {
     this.logger = logger;
     this.securityConfigProvider = securityConfigProvider;
     this.sessionManager         = sessionManager;
     this.authorize = authorize;
     this.executionContextProvider = executionContextProvider;
 }
Exemple #21
0
 public PlayersApi(IPlayerTable playerTable, IMapper mapper, JsonSerializerOptions jsonOptions,
                   JsonObjectSerializer jsonSerializer, IAuthorize authorize,
                   IPlayerLogTable playerLogTable, IPlayerResultTable playerResultTable)
     : base(playerTable, jsonOptions, jsonSerializer)
 {
     this.mapper            = mapper;
     this.authorize         = authorize;
     this.playerLogTable    = playerLogTable;
     this.playerResultTable = playerResultTable;
 }
            public FacadeCrossCuttingConcerns()
            {
                Logging   = new Logging();
                Caching   = new Caching();
                Authorize = new Authorize();

                /*Yeni özellikler ve metodlar bu kısma eklenir, CustomManager adlı ana sınıfta
                 * her yeni özellik için dependency injection yapma işlemine gerek kalmaz. Bu açıdan
                 * Facade deseni oldukça faydalıdır. Bir nevi sadeleştirme işi görür. */
            }
        public T Authorize <T>(IAuthorize authorize) where T : IPayment
        {
            var request = _context.Create();

            request.ApiAction = RequestAction.Authorize;
            request.AddCustomer(authorize.Customer);
            request.AddShipping(authorize.Shipping);
            request.AddCurrency(_context.Currency);
            request.Authorize(authorize);
            return((T)_context.Send(request));
        }
Exemple #24
0
        static void Main(string[] args)
        {
            IKernel kernel = new StandardKernel();

            kernel.Bind <IAuthorize>().To <FacebookAuthenticationProvider>();
            kernel.Bind <IDbConnection>().To <DbConnection>();

            IAuthorize authorize = kernel.Get <IAuthorize>();

            var isAuthorized = authorize.Authorize("mojLogin", "mojeHaslo");
        }
Exemple #25
0
        public static bool Export(BaseView _view)
        {
            SaveFileDialog _sf = new SaveFileDialog();

            _sf.Filter      = "Excle文件|*.xls|HTML文件|*.mht|文本文件|*.TXT";
            _sf.FilterIndex = 1;
            string _fname = "";

            while (_fname == "")
            {
                if (_sf.ShowDialog() == DialogResult.OK)
                {
                    _fname = _sf.FileName;
                    if (_fname != "")
                    {
                        switch (_sf.FilterIndex)
                        {
                        case 1:
                            _view.ExportToXls(_fname, true);
                            break;

                        case 2:
                            _view.ExportToMht(_fname, "UTF-8", "", true);
                            break;

                        case 3:
                            _view.ExportToText(_fname, "\t");
                            break;

                        case 4:
                            _view.ExportToPdf(_fname);
                            break;
                        }
                        IAuthorize ics_Auth        = LoginConfig.GetAuthorizeInterface();
                        int        _exportRowCount = _view.RowCount;
                        ics_Auth.WriteExportLog(_exportRowCount, (_view.Tag != null) ? _view.Tag.ToString() : "");
                        if (XtraMessageBox.Show("导出文件已成功,是否立即打开?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start(_fname);
                        }
                        return(true);
                    }
                    else
                    {
                        XtraMessageBox.Show("请输入导出文件名!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Exemple #26
0
        protected virtual bool Authorize()
        {
            if (IsPostBack)
            {
                return(true);
            }
            bool hasAccess = false;
            bool hasAttr   = false;

            foreach (object at in GetType().GetCustomAttributes(true))
            {
                IAuthorize auth = at as IAuthorize;
                if (auth != null)
                {
                    hasAttr = true;
                    if (auth.Authorize(this.Context))
                    {
                        hasAccess = true;
                    }
                }
            }

            if (hasAccess)
            {
                return(true);
            }

            if (!hasAttr)
            {
                string sitmap = HttpContext.Current.Server.MapPath("~/Web.sitemap");
                if (File.Exists(sitmap))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(sitmap);

                    foreach (XmlNode childNode in doc.DocumentElement.FirstChild.ChildNodes)
                    {
                        if (childNode.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }
                        if (FindNodeAndCheckAccess(childNode, "Menu", false))
                        {
                            return(true);
                        }
                    }
                }
            }
            FormsAuthentication.RedirectToLoginPage();
            return(false);
        }
Exemple #27
0
 public AuthorizableDiscountCalculator(
     IAuthorize authorizer,
     IDiscountQuery baseQuery)
 {
     if (authorizer == null)
     {
         throw new
               ArgumentNullException(nameof(authorizer));
     }
     if (baseQuery == null)
     {
         throw new
               ArgumentNullException(nameof(baseQuery));
     }
     _authorizer = authorizer;
     _baseQuery  = baseQuery;
 }
Exemple #28
0
        public PlayersPlayApi(IPlayerTable playerTable, JsonSerializerOptions jsonOptions,
                              JsonObjectSerializer jsonSerializer, IAuthorize authorize, IGameClient gameClient,
                              IPlayerLogTable playerLogTable, IPlayerResultTable playerResultTable,
                              IPlayerGameLeaseManager playerGameLease, IConfiguration configuration,
                              IMessageSender messageSender)
            : base(playerTable, jsonOptions, jsonSerializer)
        {
            this.authorize         = authorize;
            this.gameClient        = gameClient;
            this.playerLogTable    = playerLogTable;
            this.playerResultTable = playerResultTable;
            this.playerGameLease   = playerGameLease;
            this.messageSender     = messageSender;

            if (serviceBusConnectionString == null)
            {
                serviceBusConnectionString = configuration["AzureWebJobsServiceBus"];
            }
        }
Exemple #29
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (ValidNewPass())
            {
                string _oldPass = this.te_oldPass.EditValue.ToString();
                string _newPass = this.te_newPass.EditValue.ToString();

                IAuthorize _authService = LoginConfig.GetAuthorizeInterface();
                if (_authService.ChangePassWord(SessionClass.CurrentSinoUser.LoginName, _oldPass, _newPass, ""))
                {
                    XtraMessageBox.Show("修改口令成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    XtraMessageBox.Show("修改口令失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
Exemple #30
0
 public Member(IAuthorize authorize)
 {
     this.authorized = authorize.CheckAuthorize("ifew", "1234");
 }
Exemple #31
0
 private IAuthorize _authorize;                                                                //
                                                                                               //
 public CustomerManager(ILogging logging, ICaching caching, IAuthorize authorize)              //
 {                                                                                             //
     _logging   = logging;                                                                     // bu normal yöntem
     _caching   = caching;                                                                     //
     _authorize = authorize;                                                                   //
 }                                                                                             //