示例#1
0
        public void ConfigureServices(IServiceCollection services)
        {
            // Add recaptcha and pass recaptcha configuration section
            //services.AddRecaptcha(Configuration.GetSection("RecaptchaSettings"));

            // Or configure recaptcha via options
            services.AddRecaptcha(options =>
            {
                options.SecretKey = "6Le47QAaAAAAANVFbJZLk2BGLNjis5kRm6FLxaPO";
                options.SiteKey   = "6Le47QAaAAAAAJckZZuGh38r2KeJXMHO4JmW2MjW";
            });
            JWT_SetupServices(services);
            //services.AddCors(options =>
            //{
            //    options.AddPolicy(name: MyAllowSpecificOrigins,
            //                      builder =>
            //                      {
            //                          builder.WithOrigins("https://slimlink.io",
            //                                              "http://localhost:4200");
            //                      });
            //});
            services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
            {
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader()
                ;
            }));

            services.AddControllers();

            services.AddDbContext <AppDbContext>(options =>
            {
                options.UseSqlServer(Configuration.GetConnectionString("sql"));
            });
            AppDBCalls.SetDBConnect();
            services.AddScoped <IUserService, UserService>();
            services.AddScoped <ITestingService, TestingServices>();
            services.AddScoped <ILoginService, LoginService>();
            services.AddScoped <IRegistrationService, RegistrationService>();
            services.AddScoped <IGenerateEVENTService, GenerateEVENTService>();
            services.AddScoped <IDocumentDownloadService, DocumentDownloadService>();
            services.AddScoped <IDocumentUploadService, DocumentUploadService>();
            services.AddScoped <IApproveEventService, ApproveEventService>();
            services.AddScoped <IEventListService, EventListService>();
            services.AddScoped <IListService, ListService>();

            services.AddScoped <IROMUploadService, ROMUploadService>();
            services.AddScoped <IFileUploadService, FileUploadService>();
            services.AddScoped <IPrivateListService, PrivateListService>();
            services.AddScoped <IListService, ListService>();
            services.AddScoped <IEventListService, EventListService>();
            services.AddScoped <IShareHolderService, ShareHolderService>();
            services.AddScoped <IReportsService, ReportsService>();
            services.AddScoped <IVote_InvestorService, Vote_InvestorService>();
            services.AddScoped <IRegisterSpeakerService, RegisterSpeakerService>();
            services.AddScoped <ICustodianROMUploadService, CustodianROMUploadService>();
            services.AddScoped <IAccountSearchService, AccountSearchService>();
            services.AddScoped <ILockEventService, LockEventService>();
            services.AddScoped <IVideoConfService, VideoConfService>();
            services.AddScoped <ISpeakerListService, SpeakerListService>();
            services.AddScoped <IPaneListService, PaneListService>();
            services.AddScoped <IIntimationService, IntimationService>();
            services.AddScoped <IFeedbackService, FeedbackService>();
            services.AddScoped <INoticeService, NoticeService>();
            services.AddScoped <IRequestBillService, RequestBillService>();

            services.AddAuthorization(options =>
            {
                options.AddPolicy(name: "MustWorkForBigshareOnline", configurePolicy: policy =>
                {
                    policy.AddRequirements(new Requirement(domainName: "bigshareonline.com"));
                });
            });

            services.AddSingleton <IAuthorizationHandler, Handler>();
        }