Esempio n. 1
0
        public static void Init(IAppHost appHost, Func <IAuthSession> sessionFactory, params IAuthProvider[] authProviders)
        {
            if (authProviders.Length == 0)
            {
                throw new ArgumentNullException("authProviders");
            }

            DefaultOAuthProvider = authProviders[0].Provider;
            DefaultOAuthRealm    = authProviders[0].AuthRealm;

            AuthProviders = authProviders;
            if (sessionFactory != null)
            {
                CurrentSessionFactory = sessionFactory;
            }

            var test = appHost != null;

            if (test)
            {
                appHost.RegisterService <AuthService>();
                appHost.RegisterService <AssignRolesService>();
                appHost.RegisterService <UnAssignRolesService>();
                SessionFeature.Init(appHost);
            }
        }
Esempio n. 2
0
        public void Register(IAppHost appHost)
        {
            var broker = new MemoryServerEvents
            {
                IdleTimeout   = IdleTimeout,
                OnSubscribe   = OnSubscribe,
                OnUnsubscribe = OnUnsubscribe,
                NotifyChannelOfSubscriptions = NotifyChannelOfSubscriptions,
            };
            var container = appHost.GetContainer();

            if (container.TryResolve <IServerEvents>() == null)
            {
                container.Register <IServerEvents>(broker);
            }

            appHost.RawHttpHandlers.Add(httpReq =>
                                        httpReq.PathInfo.EndsWith(StreamPath)
                    ? (IHttpHandler) new ServerEventsHandler()
                    : httpReq.PathInfo.EndsWith(HeartbeatPath)
                      ? new ServerEventsHeartbeatHandler()
                      : null);

            if (UnRegisterPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsUnRegisterService), UnRegisterPath);
            }

            if (SubscribersPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsSubscribersService), SubscribersPath);
            }
        }
Esempio n. 3
0
 public void Register(IAppHost appHost)
 {
     if (ResourceFilterPattern != null)
         SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
     appHost.RegisterService(typeof (SwaggerResourcesService), new string[] {"/resources"});
     appHost.RegisterService(typeof(SwaggerApiService), new string[] { "/resource/{Name*}" });
 }
Esempio n. 4
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Campaign.Service>();
            appHost.RegisterService <Campaign.Entities.Rule.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Campaign.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Campaign.Entities.Rule.Service));
        }
Esempio n. 5
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <User.Service>();
            appHost.RegisterService <Role.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(User.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Role.Service));
        }
Esempio n. 6
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Basket.Service>();
            appHost.RegisterService <Basket.Entities.Item.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Basket.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Basket.Entities.Item.Service));
        }
Esempio n. 7
0
 public void Register(IAppHost appHost)
 {
     if (ResourceFilterPattern != null)
     {
         SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
     }
     appHost.RegisterService(typeof(SwaggerResourcesService), new string[] { "/resources" });
     appHost.RegisterService(typeof(SwaggerApiService), new string[] { "/resource/{Name*}" });
 }
Esempio n. 8
0
        public void Register(IAppHost appHost)
        {
            appHost.GetContainer().RegisterAutoWiredType(typeof(Items.Serials.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Items.Service));
            appHost.RegisterService <Items.Serials.Service>("/items/{ItemId}/serials");
            appHost.RegisterService <Items.Service>("/items");

            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Esempio n. 9
0
 }                                              //User-defined configuration
 public void Register(IAppHost appHost)
 {
     //Register Services exposed by this module
     appHost.RegisterService <AuthService>("/auth", "/auth/{provider}");
     appHost.RegisterService <AssignRolesService>("/assignroles");
     appHost.RegisterService <UnAssignRolesService>("/unassignroles");
     //Load dependent plugins
     appHost.LoadPlugin(new SessionFeature());
 }
Esempio n. 10
0
        public void Register(IAppHost appHost)
        {
            if (ResourceFilterPattern != null)
                SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);

            SwaggerApiService.UseCamelCaseModelPropertyNames = UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;
            SwaggerApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam;
            SwaggerApiService.ModelFilter = ModelFilter;
            SwaggerApiService.ModelPropertyFilter = ModelPropertyFilter;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
            appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });

            var swaggerUrl = UseBootstrapTheme
                ? "swagger-ui-bootstrap/"
                : "swagger-ui/";

            appHost.GetPlugin<MetadataFeature>()
                .AddPluginLink(swaggerUrl, "Swagger UI");

            appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
            {
                IVirtualFile indexFile;
                switch (pathInfo)
                {
                    case "/swagger-ui":
                    case "/swagger-ui/":
                    case "/swagger-ui/default.html":
                        indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui/index.html");
                        break;
                    case "/swagger-ui-bootstrap":
                    case "/swagger-ui-bootstrap/":
                    case "/swagger-ui-bootstrap/index.html":
                        indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui-bootstrap/index.html");
                        break;
                    default:
                        indexFile = null;
                        break;
                }
                if (indexFile != null)
                {
                    var html = indexFile.ReadAllText();

                    return new CustomResponseHandler((req, res) =>
                    {
                        res.ContentType = MimeTypes.Html;
                        var resourcesUrl = req.ResolveAbsoluteUrl("~/resources");
                        html = html.Replace("http://petstore.swagger.wordnik.com/api/api-docs", resourcesUrl)
                            .Replace("ApiDocs", HostContext.ServiceName)
                            .Replace("{LogoUrl}", LogoUrl);
                        return html;
                    });
                }
                return pathInfo.StartsWith("/swagger-ui") ? new StaticFileHandler() : null;
            });
        }
Esempio n. 11
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<AccountType.Service>();
            appHost.RegisterService<Country.Service>();

            //appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Esempio n. 12
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <CatalogBrand.Service>();
            appHost.RegisterService <CatalogType.Service>();
            appHost.RegisterService <Product.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(CatalogBrand.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(CatalogType.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Product.Service));
        }
Esempio n. 13
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Location.Service>();
            appHost.RegisterService <Location.Entities.Point.Service>();
            appHost.RegisterService <User.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Location.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Location.Entities.Point.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(User.Service));
        }
Esempio n. 14
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <AccountType.Service>();
            appHost.RegisterService <Country.Service>();

            //appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Esempio n. 15
0
        public void Register(IAppHost appHost)
        {
            if (ResourceFilterPattern != null)
                SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);

            SwaggerApiService.UseCamelCaseModelPropertyNames = UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
            appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });
        }
Esempio n. 16
0
        public void Register(IAppHost appHost)
        {
            if (ResourceFilterPattern != null)
            {
                SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
            }

            SwaggerApiService.UseCamelCaseModelPropertyNames           = UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
            appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });
        }
Esempio n. 17
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<Account.Service>();
            appHost.RegisterService<Currency.Service>();

            //appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //var container = appHost.GetContainer().Resolve<SimpleInjector.Container>();
            //container.RegisterManyForOpenGeneric(typeof(IQueryHandler<,>), typeof(Plugin).Assembly);
            //container.RegisterManyForOpenGeneric(typeof(IPagingQueryHandler<,>), typeof(Plugin).Assembly);

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Esempio n. 18
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Buyer.Service>();
            appHost.RegisterService <Buyer.Entities.Address.Service>();
            appHost.RegisterService <Buyer.Entities.PaymentMethod.Service>();
            appHost.RegisterService <Order.Service>();
            appHost.RegisterService <Order.Entities.Item.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Entities.Address.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Entities.PaymentMethod.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Order.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Order.Entities.Item.Service));
        }
Esempio n. 19
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Account.Service>();
            appHost.RegisterService <Currency.Service>();

            //appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //var container = appHost.GetContainer().Resolve<SimpleInjector.Container>();
            //container.RegisterManyForOpenGeneric(typeof(IQueryHandler<,>), typeof(Plugin).Assembly);
            //container.RegisterManyForOpenGeneric(typeof(IPagingQueryHandler<,>), typeof(Plugin).Assembly);

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Esempio n. 20
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <RequestLogsService>(AtRestPath);

            var requestLogger = RequestLogger ?? new InMemoryRollingRequestLogger(Capacity);

            requestLogger.EnableSessionTracking     = EnableSessionTracking;
            requestLogger.EnableResponseTracking    = EnableResponseTracking;
            requestLogger.EnableRequestBodyTracking = EnableRequestBodyTracking;
            requestLogger.SkipLogging                       = SkipLogging;
            requestLogger.RequiredRoles                     = RequiredRoles;
            requestLogger.EnableErrorTracking               = EnableErrorTracking;
            requestLogger.ExcludeRequestDtoTypes            = ExcludeRequestDtoTypes;
            requestLogger.HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes;

            appHost.Register(requestLogger);

            if (EnableRequestBodyTracking)
            {
                appHost.PreRequestFilters.Insert(0, (httpReq, httpRes) =>
                {
                    httpReq.UseBufferedStream = EnableRequestBodyTracking;
                });
            }

            appHost.GetPlugin <MetadataFeature>()
            .AddDebugLink(AtRestPath, "Request Logs");
        }
Esempio n. 21
0
        public void Register(IAppHost appHost)
        {
            hasRegistered = true;
            AuthenticateService.Init(sessionFactory, AuthProviders);

            var unitTest = appHost == null;

            if (unitTest)
            {
                return;
            }

            if (HostContext.StrictMode)
            {
                var sessionInstance = sessionFactory();
                if (TypeSerializer.HasCircularReferences(sessionInstance))
                {
                    throw new StrictModeException($"User Session {sessionInstance.GetType().Name} cannot have circular dependencies", "sessionFactory",
                                                  StrictModeCodes.CyclicalUserSession);
                }
            }

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            var sessionFeature = RegisterPlugins.OfType <SessionFeature>().First();

            sessionFeature.SessionExpiry          = SessionExpiry;
            sessionFeature.PermanentSessionExpiry = PermanentSessionExpiry;

            appHost.LoadPlugin(RegisterPlugins.ToArray());

            if (IncludeAuthMetadataProvider && appHost.TryResolve <IAuthMetadataProvider>() == null)
            {
                appHost.Register <IAuthMetadataProvider>(new AuthMetadataProvider());
            }

            AuthProviders.OfType <IAuthPlugin>().Each(x => x.Register(appHost, this));

            AuthenticateService.HtmlRedirect               = HtmlRedirect;
            AuthenticateService.HtmlRedirectAccessDenied   = HtmlRedirectAccessDenied;
            AuthenticateService.HtmlRedirectReturnParam    = HtmlRedirectReturnParam;
            AuthenticateService.HtmlRedirectReturnPathOnly = HtmlRedirectReturnPathOnly;
            AuthenticateService.AuthResponseDecorator      = AuthResponseDecorator;
            if (ValidateFn != null)
            {
                AuthenticateService.ValidateFn = ValidateFn;
            }

            var authNavItems = AuthProviders.Select(x => (x as AuthProvider)?.NavItem).Where(x => x != null);

            if (!ViewUtils.NavItemsMap.TryGetValue("auth", out var navItems))
            {
                ViewUtils.NavItemsMap["auth"] = navItems = new List <NavItem>();
            }

            navItems.AddRange(authNavItems);
        }
Esempio n. 22
0
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var scannedTypes = new List <Type>();

            foreach (var assembly in LoadFromAssemblies)
            {
                try
                {
                    scannedTypes.AddRange(assembly.GetTypes());
                }
                catch (Exception ex)
                {
                    appHost.NotifyStartupException(ex);
                }
            }

            var misingRequestTypes = scannedTypes
                                     .Where(x => x.HasInterface(typeof(IQueryDb)))
                                     .Where(x => !appHost.Metadata.OperationsMap.ContainsKey(x))
                                     .ToList();

            if (misingRequestTypes.Count == 0)
            {
                return;
            }

            var serviceType = GenerateMissingServices(misingRequestTypes);

            appHost.RegisterService(serviceType);
        }
Esempio n. 23
0
        public void Register(IAppHost appHost)
        {
            appHost.Routes.Add(typeof(GetAssetClassRequest), "/rest/assetclasses", "GET");
            appHost.Routes.Add(typeof(GetAssetClassRequest), "/rest/assetclasses/{AssetClass}", "GET");

            appHost.RegisterService(typeof(AssetClassService), "");
        }
        public void Register(IAppHost appHost, AuthFeature feature)
        {
            var authRepo = HostContext.AppHost.GetAuthRepository();

            if (authRepo == null)
            {
                throw new NotSupportedException("ApiKeyAuthProvider requires a registered IAuthRepository");
            }

            if (!(authRepo is IManageApiKeys apiRepo))
            {
                throw new NotSupportedException(authRepo.GetType().Name + " does not implement IManageApiKeys");
            }

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            feature.AuthEvents.Add(new ApiKeyAuthEvents(this));

            if (InitSchema)
            {
                using (apiRepo as IDisposable)
                {
                    apiRepo.InitApiKeySchema();
                }
            }
        }
Esempio n. 25
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService(typeof(CancellableRequestService), AtPath);

            appHost.GetPlugin <MetadataFeature>()
            ?.AddLink(MetadataFeature.AvailableFeatures, "http://docs.servicestack.net/cancellable-requests", "Cancellable Requests");
        }
 public void Register(IAppHost appHost)
 {
     // Get all of the services in this assembly that inherit from ServiceStackService
     GetType().Assembly.GetTypes().Where(a => a.BaseType == typeof(Service)).ToList()
         // Register the Service
         .Each(service => appHost.RegisterService(service));
 }
Esempio n. 27
0
        public void Register(IAppHost appHost, AuthFeature feature)
        {
            var isHmac = HmacAlgorithms.ContainsKey(HashAlgorithm);
            var isRsa  = RsaSignAlgorithms.ContainsKey(HashAlgorithm);

            if (!isHmac && !isRsa)
            {
                throw new NotSupportedException("Invalid algoritm: " + HashAlgorithm);
            }

            if (isHmac && AuthKey == null)
            {
                throw new ArgumentNullException("AuthKey", "An AuthKey is Required to use JWT, e.g: new JwtAuthProvider { AuthKey = AesUtils.CreateKey() }");
            }
            else if (isRsa && PrivateKey == null && PublicKey == null)
            {
                throw new ArgumentNullException("PrivateKey", "PrivateKey is Required to use JWT with " + HashAlgorithm);
            }

            if (KeyId == null)
            {
                KeyId = GetKeyId();
            }

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            feature.AuthResponseDecorator = AuthenticateResponseDecorator;
        }
Esempio n. 28
0
        public void Register(IAppHost appHost)
        {
            AuthenticateService.Init(sessionFactory, authProviders);
            AuthenticateService.HtmlRedirect = HtmlRedirect;

            var unitTest = appHost == null;

            if (unitTest)
            {
                return;
            }

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            var sessionFeature = RegisterPlugins.OfType <SessionFeature>().First();

            sessionFeature.SessionExpiry          = SessionExpiry;
            sessionFeature.PermanentSessionExpiry = PermanentSessionExpiry;

            appHost.LoadPlugin(RegisterPlugins.ToArray());

            if (IncludeAuthMetadataProvider && appHost.TryResolve <IAuthMetadataProvider>() == null)
            {
                appHost.Register <IAuthMetadataProvider>(new AuthMetadataProvider());
            }

            authProviders.OfType <IAuthPlugin>().Each(x => x.Register(appHost, this));
        }
Esempio n. 29
0
        public void Register(IAppHost appHost)
        {
            appHost.Register<INativeTypesMetadata>(
                new NativeTypesMetadata(appHost.Metadata, MetadataTypesConfig));

            appHost.RegisterService<NativeTypesService>();
        }
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<RequestLogsService>(AtRestPath);

            var requestLogger = RequestLogger ?? new InMemoryRollingRequestLogger(Capacity);
            requestLogger.EnableSessionTracking = EnableSessionTracking;
            requestLogger.EnableResponseTracking = EnableResponseTracking;
            requestLogger.EnableRequestBodyTracking = EnableRequestBodyTracking;
            requestLogger.EnableErrorTracking = EnableErrorTracking;
            requestLogger.RequiredRoles = RequiredRoles;
            requestLogger.ExcludeRequestDtoTypes = ExcludeRequestDtoTypes;
            requestLogger.HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes;

            appHost.Register(requestLogger);

            if (EnableRequestBodyTracking)
            {
                appHost.PreRequestFilters.Insert(0, (httpReq, httpRes) => {
                    httpReq.UseBufferedStream = EnableRequestBodyTracking;
                });
            }

            appHost.GetPlugin<MetadataFeature>()
                .AddDebugLink(AtRestPath, "Request Logs");
        }
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <RequestLogsService>(AtRestPath);

            var requestLogger = RequestLogger ?? new InMemoryRollingRequestLogger(Capacity);

            requestLogger.EnableSessionTracking     = EnableSessionTracking;
            requestLogger.EnableResponseTracking    = EnableResponseTracking;
            requestLogger.EnableRequestBodyTracking = EnableRequestBodyTracking;
            requestLogger.LimitToServiceRequests    = LimitToServiceRequests;
            requestLogger.SkipLogging                       = SkipLogging;
            requestLogger.RequiredRoles                     = RequiredRoles;
            requestLogger.EnableErrorTracking               = EnableErrorTracking;
            requestLogger.ExcludeRequestDtoTypes            = ExcludeRequestDtoTypes;
            requestLogger.HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes;

            appHost.Register(requestLogger);

            if (EnableRequestBodyTracking)
            {
                appHost.PreRequestFilters.Insert(0, (httpReq, httpRes) =>
                {
                    httpReq.UseBufferedStream = EnableRequestBodyTracking;
                });
            }

            appHost.GetPlugin <MetadataFeature>()
            ?.AddLink(MetadataFeature.DebugInfo, AtRestPath.TrimStart('/'), "Request Logs");
            appHost.GetPlugin <MetadataFeature>()
            ?.AddLink(MetadataFeature.AvailableFeatures, "http://docs.servicestack.net/request-logger", "Request Logger");
        }
Esempio n. 32
0
        public void Register(IAppHost appHost)
        {
            appHost.Register <INativeTypesMetadata>(
                new NativeTypesMetadata(appHost.Metadata, MetadataTypesConfig));

            appHost.RegisterService <NativeTypesService>();
        }
Esempio n. 33
0
        /// <summary>
        /// Activate the validation mechanism, so every request DTO with an existing validator
        /// will be validated.
        /// </summary>
        /// <param name="appHost">The app host</param>
        public void Register(IAppHost appHost)
        {
            if (TreatInfoAndWarningsAsErrors)
            {
                if (!appHost.GlobalRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsync))
                {
                    appHost.GlobalRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsync);
                }

                if (!appHost.GlobalMessageRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsync))
                {
                    appHost.GlobalMessageRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsync);
                }
            }
            else
            {
                if (!appHost.GlobalRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo))
                {
                    appHost.GlobalRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo);
                }

                if (!appHost.GlobalMessageRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo))
                {
                    appHost.GlobalMessageRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo);
                }

                if (!appHost.GlobalResponseFiltersAsync.Contains(ValidationFilters.ResponseFilterAsync))
                {
                    appHost.GlobalResponseFiltersAsync.Add(ValidationFilters.ResponseFilterAsync);
                }

                if (!appHost.GlobalMessageResponseFiltersAsync.Contains(ValidationFilters.ResponseFilterAsync))
                {
                    appHost.GlobalMessageResponseFiltersAsync.Add(ValidationFilters.ResponseFilterAsync);
                }
            }

            if (ValidationSource != null)
            {
                appHost.Register(ValidationSource);
                ValidationSource.InitSchema();
            }

            var container           = appHost.GetContainer();
            var hasValidationSource = ValidationSource != null || container.Exists <IValidationSource>();

            if (hasValidationSource && AccessRole != null)
            {
                foreach (var registerService in ServiceRoutes)
                {
                    appHost.RegisterService(registerService.Key, registerService.Value);
                }
            }

            if (ScanAppHostAssemblies)
            {
                container.RegisterValidators(((ServiceStackHost)appHost).ServiceAssemblies.ToArray());
            }
        }
Esempio n. 34
0
 public void Register(IAppHost appHost)
 {
     appHost.RegisterService<RequestLogsService>(AtRestPath);
     appHost.Register(RequestLogger
         ?? new InMemoryRollingRequestLogger(Capacity) {
             HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes
         });
 }
        /// <summary>
        /// Adding the files service routes
        /// </summary>
        /// <param name="appHost">The service stack appHost</param>
        public void Register(IAppHost appHost)
        {
            if (appHost == null)
                throw new ArgumentNullException("appHost");

            appHost.RegisterService<FilesWebService>();
            appHost.Routes.Add<FilesGetRequest>("/files-api", ApplyTo.Get);
        }
        public void Register(IAppHost appHost)
        {
            // HACK: not great but unsure how to improve
            // throws exception if WebHostUrl isn't set as this is how we get endpoint url:port
            if (appHost.Config?.WebHostUrl == null)
                throw new ApplicationException("appHost.Config.WebHostUrl must be set to use the Consul plugin, this is so consul will know the full external http://url:port for the service");

            // register callbacks
            appHost.AfterInitCallbacks.Add(RegisterService);
            appHost.OnDisposeCallbacks.Add(UnRegisterService);

            appHost.RegisterService<HealthCheckService>();
            appHost.RegisterService<DiscoveryService>();

            // register plugin link
            appHost.GetPlugin<MetadataFeature>()?.AddPluginLink(ConsulUris.LocalAgent.CombineWith("ui"), "Consul Agent WebUI");
        }
Esempio n. 37
0
 /// <summary>
 /// Register this plugin with the appHost
 /// </summary>
 /// <param name="appHost">The ServiceStack Host</param>
 public void Register(IAppHost appHost)
 {
     if (null == appHost)
     {
         throw new ArgumentNullException(nameof(appHost));
     }
     appHost.RegisterService <GUIServices>();
 }
        /// <inheritdoc/>
        public void Register(IAppHost appHost)
        {
            if (string.IsNullOrEmpty(this.SwaggerRoute))
            {
                this.SwaggerRoute = DefaultSwaggerRouteUrl;
            }

            if (string.IsNullOrEmpty(this.SwaggerUiRoute))
            {
                this.SwaggerUiRoute = DefaultSwaggerUiRouteUrl;
            }

            if (!string.IsNullOrEmpty(this.ResourceFilterPattern))
            {
                SwaggerResourcesService.ResourceFilterRegex = new Regex(
                    this.ResourceFilterPattern,
                    RegexOptions.Compiled);
            }

            if (!string.IsNullOrEmpty(this.ResourcePathFilterPattern))
            {
                SwaggerResourcesService.ResourcePathFilterRegex = new Regex(
                    this.ResourcePathFilterPattern,
                    RegexOptions.Compiled);
            }

            SwaggerResourcesService.ApiVersion   = this.ApiVersion;
            SwaggerResourcesService.ResourcePath = this.SwaggerRoute;

            SwaggerApiService.UseCamelCaseModelPropertyNames           = this.UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames =
                this.UseLowercaseUnderscoreModelPropertyNames;
            SwaggerApiService.DisableAutoDtoInBodyParam = this.DisableAutoDtoInBodyParam;
            SwaggerApiService.ApiVersion = this.ApiVersion;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { this.SwaggerRoute });
            appHost.RegisterService(
                typeof(SwaggerApiService),
                new[] { this.SwaggerRoute + "/{Name*}" });

            if (this.SwaggerUiEnabled)
            {
                appHost.RegisterService(typeof(SwaggerUiService), new[] { this.SwaggerUiRoute });
            }
        }
Esempio n. 39
0
    public void Register(IAppHost appHost)
    {
        var settings = new AppSettings();
        var enableSpecialService1 = settings.Get <bool>("enableSpecialService1", false);

        if (enableSpecialService1)
        {
            appHost.RegisterService(typeof(SpecialService1), new[] { "/special/service-1" });
        }
Esempio n. 40
0
        public void Register(IAppHost appHost)
        {
            if (MaxLimit != null)
            {
                AutoQueryViewerConfig.MaxLimit = MaxLimit;
            }

            appHost.RegisterService <AutoQueryMetadataService>();
        }
Esempio n. 41
0
        public void Register(IAppHost appHost)
        {
            appHost.CatchAllHandlers.Add(ProcessRequest);

            if (EnableNav)
            {
                appHost.RegisterService <MetadataNavService>();
            }
        }
        /// <summary>
        /// Adding the comments reviews routes
        /// </summary>
        /// <param name="appHost">The service stack appHost</param>
        public void Register(IAppHost appHost)
        {
            if (appHost == null)
                throw new ArgumentNullException("appHost");

            appHost.RegisterService<ReviewsWebService>();
            appHost.Routes.Add<AuthorReviewedGetRequest>(ReviewsServiceStackPlugin.ReviewsServiceUrl, ApplyTo.Get);
            appHost.Routes.Add<ReviewCreateRequest>(ReviewsServiceStackPlugin.ReviewsServiceUrl, ApplyTo.Post);
        }
Esempio n. 43
0
        public void Register(IAppHost appHost)
        {
            if (ResourceFilterPattern != null)
            {
                SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);
            }

            SwaggerApiService.UseCamelCaseModelPropertyNames           = UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;
            SwaggerApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam;
            SwaggerApiService.ModelFilter         = ModelFilter;
            SwaggerApiService.ModelPropertyFilter = ModelPropertyFilter;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
            appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });

            var metadata = appHost.GetPlugin <MetadataFeature>();

            if (metadata != null)
            {
                metadata.PluginLinks["swagger-ui/"] = "Swagger UI";
            }

            appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
            {
                if (pathInfo == "/swagger-ui" || pathInfo == "/swagger-ui/" || pathInfo == "/swagger-ui/default.html")
                {
                    var indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui/index.html");
                    if (indexFile != null)
                    {
                        var html = indexFile.ReadAllText();

                        return(new CustomResponseHandler((req, res) =>
                        {
                            res.ContentType = MimeTypes.Html;
                            var resourcesUrl = req.ResolveAbsoluteUrl("~/resources");
                            html = html.Replace("http://petstore.swagger.wordnik.com/api/api-docs", resourcesUrl);
                            return html;
                        }));
                    }
                }
                return(null);
            });
        }
Esempio n. 44
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<PostmanService>(AtRestPath);

            appHost.GetPlugin<MetadataFeature>()
                   .AddPluginLink(AtRestPath.TrimStart('/'), "Postman Metadata");

            if (EnableSessionExport == null)
                EnableSessionExport = appHost.Config.DebugMode;
        }
        /// <summary>
        /// Adding the SendGrid web hook service routes
        /// </summary>
        /// <param name="appHost">The service stack appHost</param>
        public void Register(IAppHost appHost)
        {
            if (appHost == null)
                throw new ArgumentNullException("appHost");

            appHost.RegisterService(typeof(SendGridEventsInboundService));

            // TODO: A unique string should be added to the URL for security reasons.
            appHost.Routes.Add<SendGridEvent[]>(string.Concat(SendGridWebHookPlugin.SendGridServiceRoute, "/events"), "POST");
        }
Esempio n. 46
0
        public void Register(IAppHost appHost)
        {
            if (ResourceFilterPattern != null)
                SwaggerResourcesService.resourceFilterRegex = new Regex(ResourceFilterPattern, RegexOptions.Compiled);

            SwaggerApiService.UseCamelCaseModelPropertyNames = UseCamelCaseModelPropertyNames;
            SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = UseLowercaseUnderscoreModelPropertyNames;
            SwaggerApiService.DisableAutoDtoInBodyParam = DisableAutoDtoInBodyParam;
            SwaggerApiService.ModelFilter = ModelFilter;
            SwaggerApiService.ModelPropertyFilter = ModelPropertyFilter;

            appHost.RegisterService(typeof(SwaggerResourcesService), new[] { "/resources" });
            appHost.RegisterService(typeof(SwaggerApiService), new[] { SwaggerResourcesService.RESOURCE_PATH + "/{Name*}" });

            var metadata = appHost.GetPlugin<MetadataFeature>();
            if (metadata != null)
            {
                metadata.PluginLinks["swagger-ui/"] = "Swagger UI";
            }

            appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
            {
                if (pathInfo == "/swagger-ui" || pathInfo == "/swagger-ui/" || pathInfo == "/swagger-ui/default.html")
                {
                    var indexFile = appHost.VirtualPathProvider.GetFile("/swagger-ui/index.html");
                    if (indexFile != null)
                    {
                        var html = indexFile.ReadAllText();

                        return new CustomResponseHandler((req, res) =>
                        {
                            res.ContentType = MimeTypes.Html;
                            var resourcesUrl = req.ResolveAbsoluteUrl("~/resources");
                            html = html.Replace("http://petstore.swagger.wordnik.com/api/api-docs", resourcesUrl);
                            return html;
                        });
                    }
                }
                return null;
            });
        }
Esempio n. 47
0
        public void Register(IAppHost appHost)
        {
            AuthenticateService.Init(sessionFactory, authProviders);
            AuthenticateService.HtmlRedirect = HtmlRedirect;

            var unitTest = appHost == null;
            if (unitTest) return;

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            RegisterPlugins.ForEach(x => appHost.LoadPlugin(x));
        }
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<MigrationService>();

            appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) =>
            {
                if (pathInfo.StartsWith(PathPrefix))
                {                    
                    var path = pathInfo.Substring(PathPrefix.Length).TrimStart('/');

                    if (path.Length == 0)
                    {
                        path = "content/index.html";
                    }

                    return new EmbeddedFileHandler(path);
                }
                return null;
            });
        }
        public void Register(IAppHost appHost)
        {
            if (PrivateKey == null)
                PrivateKey = RsaUtils.CreatePrivateKeyParams();

            appHost.RegisterService(typeof(EncryptedMessagesService), PublicKeyPath);

            appHost.RequestConverters.Add((req, requestDto) =>
            {
                var encRequest = requestDto as EncryptedMessage;
                if (encRequest == null)
                    return null;

                byte[] aesKey = null;
                byte[] iv = null;
                try
                {
                    var rsaEncAesKeyBytes = RsaUtils.Decrypt(Convert.FromBase64String(encRequest.SymmetricKeyEncrypted), PrivateKey.Value);

                    aesKey = new byte[AesUtils.KeySize / 8];
                    iv = new byte[AesUtils.IvSize / 8];

                    Buffer.BlockCopy(rsaEncAesKeyBytes, 0, aesKey, 0, aesKey.Length);
                    Buffer.BlockCopy(rsaEncAesKeyBytes, aesKey.Length, iv, 0, iv.Length);

                    var requestBodyBytes = AesUtils.Decrypt(Convert.FromBase64String(encRequest.EncryptedBody), aesKey, iv);
                    var requestBody = requestBodyBytes.FromUtf8Bytes();

                    if (string.IsNullOrEmpty(requestBody))
                        throw new ArgumentNullException("EncryptedBody");

                    var parts = requestBody.SplitOnFirst(' ');
                    var operationName = parts[0];
                    var requestJson = parts[1];

                    var requestType = appHost.Metadata.GetOperationType(operationName);
                    var request = JsonSerializer.DeserializeFromString(requestJson, requestType);

                    req.Items[RequestItemsAesKey] = aesKey;
                    req.Items[RequestItemsIv] = iv;

                    return request;
                }
                catch (Exception ex)
                {
                    WriteEncryptedError(req, aesKey, iv, ex, "Invalid EncryptedMessage");
                    return null;
                }
            });

            appHost.ResponseConverters.Add((req, response) =>
            {
                //Clear all Cookies returned to EncryptedServiceClient
                if (req.Dto is GetPublicKey)
                {
                    req.Response.ClearCookies(); 
                    return null;
                }

                object oAesKey;
                object oIv;
                if (!req.Items.TryGetValue(RequestItemsAesKey, out oAesKey) ||
                    !req.Items.TryGetValue(RequestItemsIv, out oIv))
                    return null;

                req.Response.ClearCookies();

                var ex = response as Exception;
                if (ex != null)
                {
                    WriteEncryptedError(req, (byte[])oAesKey, (byte[])oIv, ex);
                    return null;
                }

                var responseBody = response.ToJson();
                var encryptedBody = AesUtils.Encrypt(responseBody, (byte[])oAesKey, (byte[])oIv);
                return new EncryptedMessageResponse
                {
                    EncryptedBody = encryptedBody
                };
            });
        }
 public override void Register(IAppHost appHost)
 {
     appHost.Routes.Add<Service2Request>("/service2/{Operation}/{Num1}/{Num2}", "GET");
       appHost.Routes.Add<Service2Request>("/service2", "POST");
       appHost.RegisterService(typeof(Service2), "/service2");
 }
Esempio n. 51
0
        public void Register(IAppHost appHost)
        {
            AuthenticateService.Init(sessionFactory, authProviders);
            AuthenticateService.HtmlRedirect = HtmlRedirect;

            var unitTest = appHost == null;
            if (unitTest) return;

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            RegisterPlugins.ForEach(x => appHost.LoadPlugin(x));

            if (IncludeAuthMetadataProvider && appHost.TryResolve<IAuthMetadataProvider>() == null)
                appHost.Register<IAuthMetadataProvider>(new AuthMetadataProvider());
        }
Esempio n. 52
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<RequestLogsService>(AtRestPath);

            var requestLogger = RequestLogger ?? new InMemoryRollingRequestLogger(Capacity);
            requestLogger.EnableSessionTracking = EnableSessionTracking;
            requestLogger.EnableResponseTracking = EnableResponseTracking;
            requestLogger.EnableErrorTracking = EnableErrorTracking;
            requestLogger.RequiresRole = RequiresRole;
            requestLogger.ExcludeRequestDtoTypes = ExcludeRequestDtoTypes;
            requestLogger.HideRequestBodyForRequestDtoTypes = HideRequestBodyForRequestDtoTypes;

            appHost.Register(requestLogger);
        }
Esempio n. 53
0
 public void Register(IAppHost appHost)
 {
     appHost.Routes.Add(typeof(GetTestRequest), "/rest/Test", "GET");
     appHost.RegisterService(typeof(TestService), "");
 }
        public void Register(IAppHost appHost)
        {
            if (PrivateKey == null)
                PrivateKey = RsaUtils.CreatePrivateKeyParams();

            appHost.RegisterService(typeof(EncryptedMessagesService), PublicKeyPath);

            PrivateKeyModulusMap = new Dictionary<string, RSAParameters>
            {
                { Convert.ToBase64String(PrivateKey.Value.Modulus), PrivateKey.Value },
            };
            foreach (var fallbackKey in FallbackPrivateKeys)
            {
                PrivateKeyModulusMap[Convert.ToBase64String(fallbackKey.Modulus)] = fallbackKey;
            }

            appHost.RequestConverters.Add((req, requestDto) =>
            {
                var encRequest = requestDto as EncryptedMessage;
                if (encRequest == null)
                    return null;

                var cryptKey = new byte[AesUtils.KeySizeBytes];
                var authKey = new byte[AesUtils.KeySizeBytes];
                var iv = new byte[AesUtils.BlockSizeBytes];
                const int tagLength = HmacUtils.KeySizeBytes;
                try
                {
                    var authRsaEncCryptKey = Convert.FromBase64String(encRequest.EncryptedSymmetricKey);

                    var rsaEncCryptAuthKeys = new byte[authRsaEncCryptKey.Length - iv.Length - tagLength];

                    Buffer.BlockCopy(authRsaEncCryptKey, 0, iv, 0, iv.Length);
                    Buffer.BlockCopy(authRsaEncCryptKey, iv.Length, rsaEncCryptAuthKeys, 0, rsaEncCryptAuthKeys.Length);

                    var privateKey = GetPrivateKey(encRequest.KeyId);
                    if (Equals(privateKey, default(RSAParameters)))
                    {
                        WriteUnencryptedError(req, HttpError.NotFound(ErrorKeyNotFound.Fmt(encRequest.KeyId, PublicKeyPath)), "KeyNotFoundException");
                        return null;
                    }

                    var cryptAuthKeys = RsaUtils.Decrypt(rsaEncCryptAuthKeys, privateKey);

                    Buffer.BlockCopy(cryptAuthKeys, 0, cryptKey, 0, cryptKey.Length);
                    Buffer.BlockCopy(cryptAuthKeys, cryptKey.Length, authKey, 0, authKey.Length);

                    //Needs to be after cryptKey,authKey populated
                    if (nonceCache.ContainsKey(iv))
                        throw HttpError.Forbidden(ErrorNonceSeen);

                    var now = DateTime.UtcNow;
                    nonceCache.TryAdd(iv, now.Add(MaxRequestAge));

                    if (!HmacUtils.Verify(authRsaEncCryptKey, authKey))
                        throw new Exception("EncryptedSymmetricKey is Invalid");

                    var authEncryptedBytes = Convert.FromBase64String(encRequest.EncryptedBody);

                    if (!HmacUtils.Verify(authEncryptedBytes, authKey))
                        throw new Exception("EncryptedBody is Invalid");

                    var requestBodyBytes = HmacUtils.DecryptAuthenticated(authEncryptedBytes, cryptKey);
                    var requestBody = requestBodyBytes.FromUtf8Bytes();

                    if (string.IsNullOrEmpty(requestBody))
                        throw new ArgumentNullException("EncryptedBody");

                    var parts = requestBody.SplitOnFirst(' ');
                    var unixTime = int.Parse(parts[0]);

                    var minRequestDate = now.Subtract(MaxRequestAge);
                    if (unixTime.FromUnixTime() < minRequestDate)
                        throw HttpError.Forbidden(ErrorRequestTooOld);

                    DateTime expiredEntry;
                    nonceCache.Where(x => now > x.Value).ToList()
                        .Each(entry => nonceCache.TryRemove(entry.Key, out expiredEntry));

                    parts = parts[1].SplitOnFirst(' ');
                    req.Items[Keywords.InvokeVerb] = parts[0];

                    parts = parts[1].SplitOnFirst(' ');
                    var operationName = parts[0];
                    var requestJson = parts[1];

                    var requestType = appHost.Metadata.GetOperationType(operationName);
                    var request = JsonSerializer.DeserializeFromString(requestJson, requestType);

                    req.Items[RequestItemsCryptKey] = cryptKey;
                    req.Items[RequestItemsAuthKey] = authKey;
                    req.Items[RequestItemsIv] = iv;

                    return request;
                }
                catch (Exception ex)
                {
                    WriteEncryptedError(req, cryptKey, authKey, iv, ex, ErrorInvalidMessage);
                    return null;
                }
            });

            appHost.ResponseConverters.Add((req, response) =>
            {
                object oCryptKey, oAuthKey, oIv;
                if (!req.Items.TryGetValue(RequestItemsCryptKey, out oCryptKey) ||
                    !req.Items.TryGetValue(RequestItemsAuthKey, out oAuthKey) ||
                    !req.Items.TryGetValue(RequestItemsIv, out oIv))
                    return null;

                req.Response.ClearCookies();

                var ex = response as Exception;
                if (ex != null)
                {
                    WriteEncryptedError(req, (byte[])oCryptKey, (byte[])oAuthKey, (byte[])oIv, ex);
                    return null;
                }

                var responseBodyBytes = response.ToJson().ToUtf8Bytes();
                var encryptedBytes = AesUtils.Encrypt(responseBodyBytes, (byte[])oCryptKey, (byte[])oIv);
                var authEncryptedBytes = HmacUtils.Authenticate(encryptedBytes, (byte[])oAuthKey, (byte[])oIv);

                var encResponse = new EncryptedMessageResponse
                {
                    EncryptedBody = Convert.ToBase64String(authEncryptedBytes)
                };
                return encResponse;
            });
        }
 public void Register(IAppHost appHost)
 {
     appHost.RegisterService<RegistrationService>(AtRestPath);
     appHost.RegisterAs<RegistrationValidator, IValidator<Registration>>();
 }
 public override void Register(IAppHost appHost)
 {
     appHost.Routes.Add<Service1Request>("/service1/{Text}", "GET");
       appHost.Routes.Add<Service1Request>("/service1", "POST");
       appHost.RegisterService(typeof(Service1), "/service1");
 }
Esempio n. 57
0
 public void Register(IAppHost appHost)
 {
     appHost.RegisterService(typeof (SwaggerResourcesService), new string[] {"/resources"});
     appHost.RegisterService(typeof(SwaggerApiService), new string[] { "/resource/{Name*}" });
 }
        public void Register(IAppHost appHost)
        {
            AuthenticateService.Init(sessionFactory, authProviders);
            AuthenticateService.HtmlRedirect = HtmlRedirect;

            var unitTest = appHost == null;
            if (unitTest) return;

            foreach (var registerService in ServiceRoutes)
            {
                appHost.RegisterService(registerService.Key, registerService.Value);
            }

            var sessionFeature = RegisterPlugins.OfType<SessionFeature>().First();
            sessionFeature.SessionExpiry = SessionExpiry;
            sessionFeature.PermanentSessionExpiry = PermanentSessionExpiry;

            appHost.LoadPlugin(RegisterPlugins.ToArray());

            if (IncludeAuthMetadataProvider && appHost.TryResolve<IAuthMetadataProvider>() == null)
                appHost.Register<IAuthMetadataProvider>(new AuthMetadataProvider());
        }
 public void Register(IAppHost appHost)
 {
     appHost.RegisterService(typeof(CancellableRequestService), AtPath);
 }
Esempio n. 60
0
 public void Register(IAppHost appHost)
 {
     appHost.Routes.Add(typeof(GetListOfPluginsRequest), "/rest/listplugins", "GET");
     appHost.RegisterService(typeof(ListOfPluginsService), "");
 }