private void ApplicationSetup() { var kernel = NinjectWebCommon.GetKernel(); var setup = kernel.Get <ISetup>(); setup.Start(); }
public void Configuration(IAppBuilder app) { Kernel = NinjectWebCommon.GetKernel(); ConfigureAuth(app); app.MapSignalR(); ApplicationSetup(); }
private bool CheckAuthentication() { // TODO: Swap out the service locator with something else var kernel = NinjectWebCommon.GetKernel(); var authHelper = new AuthenticationHelper(kernel.Get <ISettingsService <NzbDashSettingsDto> >()); return(authHelper.IsAuthenticated()); }
protected void Application_PostAuthenticateRequest() { if (Request.IsAuthenticated) { string login = Context.User.Identity.Name; var userRepository = NinjectWebCommon.GetKernel().GetService(typeof(IUserRepository)) as IUserRepository; Context.User = userRepository.FindByLogin(login); } }
public UserTests() { var kernel = NinjectWebCommon.GetKernel(); this.logic = kernel.Get <IUserLogic>(); this.pageInfo = new PageInfo { PageNumber = 0, PageSize = Int32.MaxValue / 2, }; }
public AlbumTests() { var kernel = NinjectWebCommon.GetKernel(); this.logic = kernel.Get <IAlbumLogic>(); this.pageInfo = new PageInfo { PageNumber = 0, PageSize = int.MaxValue / 2, }; }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { // TODO: Swap out the service locator with something else var kernel = NinjectWebCommon.GetKernel(); var authHelper = new AuthenticationHelper(kernel.Get <ISettingsService <NzbDashSettingsDto> >()); var shouldBeAuth = authHelper.IsAuthenticated(); if (!User.Identity.IsAuthenticated && shouldBeAuth) { filterContext.Result = RedirectToAction("Login", "Account"); return; } base.OnActionExecuting(filterContext); }
public static void Register(HttpConfiguration config) { var kernel = NinjectWebCommon.GetKernel(); // Web API configuration and services config.Filters.Add(kernel.Get <UnhandledExceptionFilterAttribute>()); config.MessageHandlers.Add(kernel.Get <TracingHandler>()); config.Formatters.Clear(); var jsonFormatter = new JsonMediaTypeFormatter(); jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); config.Formatters.Add(jsonFormatter); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }