fix AuthorizeFilter deprecation
This commit is contained in:
parent
167bb167ff
commit
b41be28a16
@ -13,8 +13,10 @@
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -13,8 +13,10 @@
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -11,8 +11,10 @@ namespace Basket.API.Infrastructure.Filters
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -12,8 +12,10 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filt
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -11,8 +11,10 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filt
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -13,8 +13,10 @@ namespace Ordering.API.Infrastructure.Filters
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
@ -13,8 +13,10 @@ namespace Webhooks.API.Infrastructure
|
||||
public void Apply(Operation operation, OperationFilterContext context)
|
||||
{
|
||||
// Check for authorize attribute
|
||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||
.OfType<AuthorizeAttribute>()
|
||||
.Any();
|
||||
|
||||
if (hasAuthorize)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user