示例#1
0
        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();
        }
示例#2
0
 public ValuesController(IDownloadMIddleware download, IOauthMIddleware oauth)
 {
     this.download = download;
     this.oauth    = oauth;
 }
示例#3
0
 public DowloadScryptMIddleware(IOauthMIddleware oauth)
 {
     this.oauth = oauth;
 }