public void Configure(IApplicationBuilder app, IHostingEnvironment env, IOauthMIddleware oauth) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSession(); app.Use(async(context, next) => { byte[] temp; string userId = context.Session.TryGetValue("userId", out temp) ? System.Text.Encoding.UTF8.GetString(temp) : ""; Console.WriteLine(userId + "userID"); if (userId == "") { userId = await oauth.Auth(); context.Session.Set("userId", System.Text.Encoding.UTF8.GetBytes(userId)); } await next.Invoke(); }); app.UseMvc(); }
public ValuesController(IDownloadMIddleware download, IOauthMIddleware oauth) { this.download = download; this.oauth = oauth; }
public DowloadScryptMIddleware(IOauthMIddleware oauth) { this.oauth = oauth; }