mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 18:10:50 +08:00 
			
		
		
		
	
				
					committed by
					
						
						Thiago Loureiro
					
				
			
			
				
	
			
			
			
						parent
						
							88f31966d4
						
					
				
				
					commit
					c8a2144a4b
				
			@@ -25,7 +25,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        public async Task Invoke(DownstreamContext context)
 | 
					        public async Task Invoke(DownstreamContext context)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (IsAuthenticatedRoute(context.DownstreamReRoute))
 | 
					            if (!IsOptionsHttpMethod(context) && IsAuthenticatedRoute(context.DownstreamReRoute))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Logger.LogInformation("route is authenticated scopes must be checked");
 | 
					                Logger.LogInformation("route is authenticated scopes must be checked");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,7 +52,7 @@
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (IsAuthorisedRoute(context.DownstreamReRoute))
 | 
					            if (!IsOptionsHttpMethod(context) && IsAuthorisedRoute(context.DownstreamReRoute))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Logger.LogInformation("route is authorised");
 | 
					                Logger.LogInformation("route is authorised");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,5 +99,10 @@
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            return reRoute.IsAuthorised;
 | 
					            return reRoute.IsAuthorised;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static bool IsOptionsHttpMethod(DownstreamContext context)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return context.HttpContext.Request.Method.ToUpper() == "OPTIONS";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user