Example #1
0
        public TService GetService <TService>() where TService : class
        {
            var moduleKey = typeof(TService).Name;
            var key       = GetWorkContextService().GetBusinessLogicKeyName(moduleKey);

            return(Invoke <TService> .Call(GenerateKey <TService>(key)));
        }
Example #2
0
        public ConfigService()
        {
            this._repositories = Invoke <IRepositoryFactory> .Call();

            _userSession = Invoke <IServiceFactory>
                           .Call()
                           .GetWorkContextService()
                           .GetCurrentUserSession();
        }
Example #3
0
        public WorkContextService()
        {
            _repository = Invoke <IKernelRepository> .Call();

            _sessionManager = Invoke <ISessionManager> .Call();

            userSession = _sessionManager.GetCurrentSession();

            if (userSession == null)
            {
                throw new BusinessException(Constants.Message.Exception.KeySentNotFound);
            }
        }
Example #4
0
 public TokenController()
 {
     service = Invoke <IUserService> .Call();
 }
Example #5
0
 protected BaseRepository()
 {
     this.repository = Invoke <IRepository <T> > .Call();
 }
Example #6
0
 protected BaseApiController()
     : base(Invoke <TServiceFactory> .Call().GetService <TService>())
 {
 }
Example #7
0
 public BaseSystemService()
 {
     repositories = Invoke <IRepositoryFactory> .Call();
 }
Example #8
0
 public IUserRepository GetUserRepository()
 {
     return(Invoke <IUserRepository> .Call());
 }
Example #9
0
 public ITemplateRepository GetTemplateRepository()
 {
     return(Invoke <ITemplateRepository> .Call());
 }
Example #10
0
 public IWorkContextService GetWorkContextService()
 {
     return(Invoke <IWorkContextService> .Call());
 }
Example #11
0
 public IUserService GetUserService()
 {
     return(Invoke <IUserService> .Call());
 }
Example #12
0
 public IShiftService GetSihftService()
 {
     return(Invoke <IShiftService> .Call());
 }
Example #13
0
 public INurseService GetNurseService()
 {
     return(Invoke <INurseService> .Call());
 }
Example #14
0
 public MobilController()
 {
     services = Invoke <IServiceFactory> .Call();
 }
 protected internal BaseCommonRepository()
 {
     this._repository = Invoke <TRepositoryProvider> .Call();
 }
Example #16
0
 public IRoleRepository GetRoleRepository()
 {
     return(Invoke <IRoleRepository> .Call());
 }
Example #17
0
 public IMenuRepository GetMenuRepository()
 {
     return(Invoke <IMenuRepository> .Call());
 }
Example #18
0
 public CompanyService()
 {
     repositories = Invoke <IRepositoryFactory> .Call();
 }
Example #19
0
 public ILanguageRepository GetLanguageRepository()
 {
     return(Invoke <ILanguageRepository> .Call());
 }
Example #20
0
 public IApplicationRepository GetApplicationRepository()
 {
     return(Invoke <IApplicationRepository> .Call());
 }
Example #21
0
 public IConfigRepository GetConfigRepository()
 {
     return(Invoke <IConfigRepository> .Call());
 }
Example #22
0
 public ICompanyRepository GetCompanyRepository()
 {
     return(Invoke <ICompanyRepository> .Call());
 }
Example #23
0
 public ExportController()
 {
     service = Invoke <IExcelService> .Call();
 }
Example #24
0
 public IMicroserviceRepository GetMicroserviceRepository()
 {
     return(Invoke <IMicroserviceRepository> .Call());
 }
Example #25
0
        public static void SetSessionAsManager(IServiceCollection services)
        {
            services.AddCors(config =>
            {
                var policy = new CorsPolicy();
                policy.Headers.Add("*");
                policy.Methods.Add("*");
                policy.Origins.Add("*");
                policy.SupportsCredentials = true;
                config.AddPolicy("policy", policy);
            });

            services.AddAuthorization(auth =>
            {
                auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder()
                               .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme‌​)
                               .RequireAuthenticatedUser().Build());
            });


            services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })

            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    //IssuerSigningKey = new RsaSecurityKey(new RSACryptoServiceProvider(2048).ExportParameters(true)),
                    ValidateAudience = false,
                    //ValidAudience = "lemoras.com",
                    ValidateIssuer = false,
                    //ValidIssuer = "onuryasar.org",
                    //ValidateLifetime = true,
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(
                        Encoding.UTF8.GetBytes("xxx"))
                };

                options.Events = new JwtBearerEvents
                {
                    OnTokenValidated = ctx =>
                    {
                        var mngr = Invoke <ISessionManager> .Call();

                        StringValues a;

                        if (!ctx.Request.Headers.TryGetValue("Authorization", out a))
                        {
                            ctx.Response.StatusCode = 401;

                            return(Task.FromCanceled(new System.Threading.CancellationToken(true)));
                        }
                        var token = a[0].Replace("Bearer ", "");

                        var handler = new JwtSecurityTokenHandler();
                        var tokenS  = handler.ReadToken(token) as JwtSecurityToken;

                        var userSession = new UserSession();

                        foreach (var item in tokenS.Claims)
                        {
                            switch (item.Type.ToLower().Trim())
                            {
                            case "username":
                                userSession.UserName = item.Value;
                                break;

                            case "userid":
                                userSession.UserId = item.Value;
                                break;

                            case "applicationinstanceid":
                                userSession.ApplicationInsId = Convert.ToInt32(item.Value);
                                break;

                            case "roleid":
                                userSession.RoleId = Convert.ToInt32(item.Value);
                                break;

                            case "applicationid":
                                userSession.ApplicationId = Convert.ToInt32(item.Value);
                                break;

                            default:
                                break;
                            }
                        }

                        if (string.IsNullOrEmpty(userSession.UserName))
                        {
                            ctx.Response.StatusCode = 401;
                            return(Task.FromCanceled(new System.Threading.CancellationToken(true)));
                        }

                        UserSession = userSession;

                        return(Task.CompletedTask);
                    },
                    OnAuthenticationFailed = ctx =>
                    {
                        Console.WriteLine("Exception:{0}", ctx.Exception.Message);
                        return(Task.CompletedTask);
                    }
                };
            });
        }
Example #26
0
 public IModuleRepository GetModuleRepository()
 {
     return(Invoke <IModuleRepository> .Call());
 }
Example #27
0
 public MappingSettings()
 {
     this.mapper = Invoke <IMapper> .Call();
 }
Example #28
0
 public IPageRepository GetPageRepository()
 {
     return(Invoke <IPageRepository> .Call());
 }
Example #29
0
        public RoleSetAttribute(string roleSetCommandName)
        {
            this.service = Invoke <IWorkContextService> .Call();

            this.roleSetCommandName = roleSetCommandName;
        }
 public LimitedApplicationService() : base()
 {
     appInsId = Invoke <IWorkContextService> .Call().GetCurrentUserSession().ApplicationInsId;
 }