protected override void ServerInit() { base.ServerInit(); Instance = this; var psClientMgr = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Program.Configuration.GetSection("Data:MessagePubSubServer")); BahamutPubSubService = new BahamutPubSubService(psClientMgr); var tokenServerClientManager = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Program.Configuration.GetSection("Data:TokenServer")); TokenService = new TokenService(tokenServerClientManager); }
public TokenAuthentication(RequestDelegate next, string appkey, TokenService tokenService, IEnumerable<string> openRoutes = null) { NoAuthenticationRoutes = new Dictionary<string, bool>(); if(openRoutes != null && openRoutes.Count() > 0) { foreach (var route in openRoutes) { NoAuthenticationRoutes[route] = true; } } Appkey = appkey; _next = next; TokenService = tokenService; }
protected override void ServerDispose() { BahamutPubSubService = null; TokenService = null; base.ServerDispose(); }
// This method gets called by a runtime. // Use this method to add services to the container public void ConfigureServices(IServiceCollection services) { services.AddMvc(config => { config.Filters.Add(new LogExceptionFilter()); }).AddJsonOptions(x => { x.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); x.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; x.SerializerSettings.Formatting = Formatting.None; }); services.AddScoped<LogExceptionFilter>(); services.AddSingleton(new FireService(DBClientManagerBuilder.GeneratePoolMongodbClient(Configuration.GetSection("Data:BahamutFireDBServer")))); var TokenServerClientManager = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Configuration.GetSection("Data:TokenServer")); var tokenService = new TokenService(TokenServerClientManager); services.AddSingleton(tokenService); var ControlServerServiceClientManager = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Configuration.GetSection("Data:ControlServiceServer")); var serverControlMgrService = new ServerControlManagementService(ControlServerServiceClientManager); services.AddSingleton(serverControlMgrService); }