コード例 #1
0
 /// <summary>
 /// Handler für Authentifizierung über IP Adresse des Schalters
 /// </summary>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 /// <param name="encoder"></param>
 /// <param name="clock"></param>
 /// <param name="ctx"></param>
 /// <param name="ctxDOA"></param>
 public ApiKeyAuthenticationHandler(IOptionsMonitor <ApiKeyAuthenticationHandlerOptions> options,
                                    ILoggerFactory logger,
                                    UrlEncoder encoder,
                                    ISystemClock clock,
                                    IGenericDataStore data)
     : base(options, logger, encoder, clock)
 {
     log   = logger.CreateLogger <ApiKeyAuthenticationHandler>();
     _data = data;
 }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGenericDataStore dataStore)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Emergency Data API V1");
            });

            app.UseHttpsRedirection();
            app.UseMvc();

            app.UseWebSockets();

            app.Use(async(context, next) =>
            {
                if (context.Request.Path.StartsWithSegments("/ws"))
                {
                    if (context.WebSockets.IsWebSocketRequest)
                    {
                        WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync();
                        // Websocket-Request received
                        var websocketManager = context.RequestServices.GetService <IWebsocketManager>();
                        await websocketManager.OnWebsocketConnected(context, webSocket);
                    }
                    else
                    {
                        context.Response.StatusCode = 400;
                    }
                }
                else
                {
                    await next();
                }
            });

            OnApplicationStarted(dataStore);
        }
コード例 #3
0
 /// <summary>
 /// Controller to Access the Documents
 /// </summary>
 /// <param name="db"></param>
 public ObjectService(IGenericDataStore db)
 {
     this.db = db;
 }
コード例 #4
0
 public WebsocketManager(IGenericDataStore data, ObjectService os)
 {
     db            = data;
     objectService = os;
 }
コード例 #5
0
 public void OnApplicationStarted(IGenericDataStore dataStore)
 {
     dataStore.InitIdentity();
 }
コード例 #6
0
 /// <summary>
 /// Controller to Access the Documents
 /// </summary>
 /// <param name="db"></param>
 public ObjectController(IGenericDataStore db, ObjectChangeTracker ct)
 {
     this.db            = db;
     this.changeTracker = ct;
 }
コード例 #7
0
 /// <summary>
 /// Controller to Access the Documents
 /// </summary>
 /// <param name="db"></param>
 public AccountController(IGenericDataStore db)
 {
     this.db = db;
 }