public static Owin.IAppBuilder UseOpenIdConnectAuthenticationPatched(this Owin.IAppBuilder app, Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationOptions openIdConnectOptions)
 {
     if (app == null)
     {
         throw new System.ArgumentNullException("app");
     }
     if (openIdConnectOptions == null)
     {
         throw new System.ArgumentNullException("openIdConnectOptions");
     }
     System.Type type     = typeof(OpenIdConnectAuthenticationPatchedMiddleware);
     object[]    objArray = new object[] { app, openIdConnectOptions };
     return(app.Use(type, objArray));
 }
예제 #2
0
        protected override void SetupThrottling(Owin.IAppBuilder app)
        {
            MemoryCacheRepository cache = new MemoryCacheRepository();

            cache.Clear();
            app.Use(typeof(CustomThrottlingMiddleware), new ThrottlePolicy(perHour: 600)
            {
                IpThrottling     = false,
                ClientThrottling = true,
                ClientRules      = new Dictionary <string, RateLimits>
                {
                    { CustomThrottlingMiddleware.IS_AUTHENTICATE, new RateLimits {
                          PerHour = 4000
                      } }
                },
                EndpointThrottling = true,
                EndpointRules      = new Dictionary <string, RateLimits>()
                {
                    { "api/ip", new RateLimits {
                          PerMinute = 2
                      } }
                }
            }, new PolicyMemoryCacheRepository(), cache, new ThrottlingLogger());
        }
예제 #3
0
 public static AppBuilder UseYOYOFxOwin(this AppBuilder app, Action <IRouteBuilder> routebuilderFunc = null, Action <YOYOFxOptions> configuration = null)
 {
     UseYOYOFx(app, routebuilderFunc, configuration);
     app.Use(new Func <AppFunc, AppFunc>(next => Invoke));
     return(app);
 }