using Hangfire;
using Hangfire.Dashboard;
using Hangfire.Dashboard.BasicAuthorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;

namespace IRaCIS.Core.API
{


    public static class HangfireConfig
    {

        public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env)
        {


            app.UseHangfireDashboard("/back/hangfire", new DashboardOptions()
            {



                Authorization = new IDashboardAuthorizationFilter[] { /*new hangfireAuthorizationFilter(),*/

                new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
                            SslRedirect=false,
                            RequireSsl=false,
                            Users=new BasicAuthAuthorizationUser[]{
                                  new BasicAuthAuthorizationUser(){
                                      Login="admin",
                                      PasswordClear="admin",

                                  }
                             }

                      })
                },

                DashboardTitle = "后台任务管理",


                //Authorization = new BasicAuthAuthorizationFilter[] {
                //      new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
                //            SslRedirect=false,
                //            RequireSsl=false,
                //            Users=new BasicAuthAuthorizationUser[]{
                //                  new BasicAuthAuthorizationUser(){
                //                      Login="admin",
                //                      PasswordClear="test",

                //                  }
                //             }

                //      })
                //}

            });



        }
    }
}