public WebApplicationLoginManager(ISecurityProviderClient securityProviderClient, CookiesManager cookiesManager, IReCaptchaClient reCaptchaClient, ReCaptchaConfiguration reCaptchaConfiguration) { this.securityProviderClient = securityProviderClient ?? throw new ArgumentNullException(nameof(securityProviderClient)); this.cookiesManager = cookiesManager ?? throw new ArgumentNullException(nameof(cookiesManager)); this.reCaptchaClient = reCaptchaClient ?? throw new ArgumentNullException(nameof(reCaptchaClient)); this.reCaptchaConfiguration = reCaptchaConfiguration ?? throw new ArgumentNullException(nameof(reCaptchaConfiguration)); }
public ReCaptchaTokenVerification(HttpClient httpClient, ReCaptchaConfiguration configuration) { _httpClient = httpClient; _configuration = configuration; }
public ValidateReCaptchaAttribute(IGateway gateway, IOptions <ReCaptchaConfiguration> configuration, ILogger <DocumentController> logger) { _configuration = configuration.Value; _gateway = gateway; _logger = logger; }
public AccountController(IAccountService accountService, IOptions <ReCaptchaConfiguration> options) { this.accountService = accountService; this.options = options.Value; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddSingleton(_configuration); services.AddSingleton(_hostingEnvironment); services.AddApplicationInsightsTelemetry(_configuration); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDatabaseDeveloperPageExceptionFilter(); services.AddDbContext <RepoContext>(); services.AddControllersWithViews() .AddRazorRuntimeCompilation() .AddXmlSerializerFormatters(); services.AddLogging(); services.AddScoped <IRepoRepository, RepoRepository>(); services.AddScoped <IArticleRepository, ArticleRepository>(); var blogRepo = new BlogRepository(_configuration["BlogUrl"]); services.AddSingleton <IBlogRepository>(blogRepo); services.AddSingleton <IRedirectRepository>(new RedirectRepository(new System.Collections.Generic.List <IRedirectRepository> { blogRepo })); var activityRepo = new ActivityRepository(_configuration["ActivityUrl"], _configuration["ActivityCode"]); services.AddSingleton <IActivityRepository>(activityRepo); var siteMapRepo = new SiteMapRepository(_hostingEnvironment); siteMapRepo.AddRepository(blogRepo); services.AddSingleton <ISiteMapRepository>(siteMapRepo); services.AddTransient <RepoContextSeedData>(); var sendGridConfiguration = new SendGridConfiguration { ApiKey = _configuration["SendGridApiKey"], From = _configuration["SendGridFromEmailAddress"] }; services.AddSingleton(sendGridConfiguration); services.AddTransient <IEmail, SendGridEmail>(); services.AddSingleton(new HttpClient()); services.AddSingleton <IPodcastRespository, PodcastRespository>(); var reCaptchaConfiguration = new ReCaptchaConfiguration { SecretKey = _configuration["ReCaptchaSecretKey"] }; services.AddSingleton(reCaptchaConfiguration); services.AddTransient <ITokenVerification, ReCaptchaTokenVerification>(); }