Пример #1
0
 public AntiForgery([NotNull] IClaimUidExtractor claimUidExtractor,
                    [NotNull] IDataProtectionProvider dataProtectionProvider,
                    [NotNull] IAntiForgeryAdditionalDataProvider additionalDataProvider,
                    [NotNull] IOptionsAccessor<MvcOptions> mvcOptions)
 {
     var config = mvcOptions.Options.AntiForgeryOptions;
     var serializer = new AntiForgeryTokenSerializer(dataProtectionProvider.CreateProtector(_purpose));
     var tokenStore = new AntiForgeryTokenStore(config, serializer);
     var tokenProvider = new TokenProvider(config, claimUidExtractor, additionalDataProvider);
     _worker = new AntiForgeryWorker(serializer, config, tokenStore, tokenProvider, tokenProvider);
 }
Пример #2
0
        public AntiForgery([NotNull] IClaimUidExtractor claimUidExtractor,
                           [NotNull] IDataProtectionProvider dataProtectionProvider,
                           [NotNull] IAntiForgeryAdditionalDataProvider additionalDataProvider,
                           [NotNull] IOptionsAccessor <MvcOptions> mvcOptions)
        {
            var config        = mvcOptions.Options.AntiForgeryOptions;
            var serializer    = new AntiForgeryTokenSerializer(dataProtectionProvider.CreateProtector(_purpose));
            var tokenStore    = new AntiForgeryTokenStore(config, serializer);
            var tokenProvider = new TokenProvider(config, claimUidExtractor, additionalDataProvider);

            _worker = new AntiForgeryWorker(serializer, config, tokenStore, tokenProvider, tokenProvider);
        }
Пример #3
0
        public AntiForgery([NotNull] IClaimUidExtractor claimUidExtractor,
                           [NotNull] IDataProtectionProvider dataProtectionProvider,
                           [NotNull] IAntiForgeryAdditionalDataProvider additionalDataProvider,
                           [NotNull] IOptions<MvcOptions> mvcOptions,
                           [NotNull] IHtmlEncoder htmlEncoder,
                           [NotNull] IOptions<DataProtectionOptions> dataProtectionOptions)
        {
            var config = mvcOptions.Options.AntiForgeryOptions;
            var applicationId = dataProtectionOptions.Options.ApplicationDiscriminator ?? string.Empty;
            config.CookieName = config.CookieName ?? ComputeCookieName(applicationId);

            var serializer = new AntiForgeryTokenSerializer(dataProtectionProvider.CreateProtector(_purpose));
            var tokenStore = new AntiForgeryTokenStore(config, serializer);
            var tokenProvider = new AntiForgeryTokenProvider(config, claimUidExtractor, additionalDataProvider);
            _worker = new AntiForgeryWorker(serializer, config, tokenStore, tokenProvider, tokenProvider, htmlEncoder);
        }
Пример #4
0
        public AntiForgery([NotNull] IClaimUidExtractor claimUidExtractor,
                           [NotNull] IDataProtectionProvider dataProtectionProvider,
                           [NotNull] IAntiForgeryAdditionalDataProvider additionalDataProvider,
                           [NotNull] IOptions <MvcOptions> mvcOptions,
                           [NotNull] IHtmlEncoder htmlEncoder,
                           [NotNull] IOptions <DataProtectionOptions> dataProtectionOptions)
        {
            var config        = mvcOptions.Options.AntiForgeryOptions;
            var applicationId = dataProtectionOptions.Options.ApplicationDiscriminator ?? string.Empty;

            config.CookieName = config.CookieName ?? ComputeCookieName(applicationId);

            var serializer    = new AntiForgeryTokenSerializer(dataProtectionProvider.CreateProtector(_purpose));
            var tokenStore    = new AntiForgeryTokenStore(config, serializer);
            var tokenProvider = new TokenProvider(config, claimUidExtractor, additionalDataProvider);

            _worker = new AntiForgeryWorker(serializer, config, tokenStore, tokenProvider, tokenProvider, htmlEncoder);
        }