示例#1
0
        public WsFedMiddleware(RequestDelegate next,
                               ILogger <WsFedMiddleware> logger,
                               IRelyingPartyStore relyingPartyStore,
                               SignInResponseGenerator responseGenerator,
                               WsTrustSerializer serializer,
                               IOptions <FederationGatewayOptions> options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            if (relyingPartyStore == null)
            {
                throw new ArgumentNullException(nameof(relyingPartyStore));
            }
            if (responseGenerator == null)
            {
                throw new ArgumentNullException(nameof(responseGenerator));
            }
            if (serializer == null)
            {
                throw new ArgumentNullException(nameof(serializer));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _next              = next;
            _logger            = logger;
            _relyingPartyStore = relyingPartyStore;
            _responseGenerator = responseGenerator;
            _serializer        = serializer;
            _options           = options.Value;
        }
示例#2
0
        public MetadataMiddleware(RequestDelegate next,
                                  ILogger <MetadataMiddleware> logger,
                                  IKeyMaterialService keyService,
                                  IOptions <FederationGatewayOptions> options,
                                  WsFederationMetadataSerializer serializer)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            if (keyService == null)
            {
                throw new ArgumentNullException(nameof(keyService));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (serializer == null)
            {
                throw new ArgumentNullException(nameof(serializer));
            }

            _next       = next;
            _logger     = logger;
            _keyService = keyService;
            _options    = options.Value;
            _serializer = serializer;
        }
示例#3
0
        public SignInResponseGenerator(ILogger <SignInResponseGenerator> logger,
                                       IRelyingPartyStore relyingPartyStore,
                                       IProfileManager profileManager,
                                       IKeyMaterialService keyService,
                                       IOptions <FederationGatewayOptions> options
                                       )
        {
            if (relyingPartyStore == null)
            {
                throw new ArgumentNullException(nameof(relyingPartyStore));
            }
            if (profileManager == null)
            {
                throw new ArgumentNullException(nameof(profileManager));
            }
            if (keyService == null)
            {
                throw new ArgumentNullException(nameof(keyService));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _logger            = logger;
            _relyingPartyStore = relyingPartyStore;
            _profileManager    = profileManager;
            _keyService        = keyService;
            _options           = options.Value;
        }
示例#4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();

            var options = new FederationGatewayOptions();

            Configuration.GetSection("IdentityServer").Bind(options);
            app.UseFederationGateway(options);

            app.UseCors(cfg =>
            {
                cfg.AllowAnyOrigin();
                cfg.AllowAnyMethod();
                cfg.AllowAnyHeader();
            });

            app.UseCookiePolicy(new CookiePolicyOptions
            {
                MinimumSameSitePolicy = SameSiteMode.None,
            });

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }