fix deprecation warnings
This commit is contained in:
parent
5c60b6ace7
commit
a846f041cd
@ -13,19 +13,23 @@
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// 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)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
|
||||||
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
{
|
||||||
|
new Dictionary<string, IEnumerable<string>>
|
||||||
{
|
{
|
||||||
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator" } }
|
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator" } }
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,19 +13,23 @@
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// 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)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
|
||||||
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
{
|
||||||
|
new Dictionary<string, IEnumerable<string>>
|
||||||
{
|
{
|
||||||
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator" } }
|
{ "oauth2", new [] { "Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator" } }
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,9 @@ namespace Basket.API.Infrastructure.Filters
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// Check for authorize attribute
|
||||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||||
|
.OfType<AuthorizeAttribute>().Any();
|
||||||
|
|
||||||
if (hasAuthorize)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
|
@ -12,19 +12,22 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filt
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// Check for authorize attribute
|
||||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||||
|
.OfType<AuthorizeAttribute>().Any();
|
||||||
|
|
||||||
if (hasAuthorize)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
|
||||||
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
{
|
||||||
|
new Dictionary<string, IEnumerable<string>>
|
||||||
{
|
{
|
||||||
{ "oauth2", new [] { "locationsapi" } }
|
{ "oauth2", new [] { "locationsapi" } }
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filt
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// Check for authorize attribute
|
||||||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
|
||||||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
.Union(context.MethodInfo.GetCustomAttributes(true))
|
||||||
|
.OfType<AuthorizeAttribute>().Any();
|
||||||
|
|
||||||
if (hasAuthorize)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ordering.API.Infrastructure.Filters
|
namespace Ordering.API.Infrastructure.Filters
|
||||||
{
|
{
|
||||||
@ -13,19 +11,23 @@ namespace Ordering.API.Infrastructure.Filters
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// 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)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
|
||||||
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
{
|
||||||
|
new Dictionary<string, IEnumerable<string>>
|
||||||
{
|
{
|
||||||
{ "oauth2", new [] { "orderingapi" } }
|
{ "oauth2", new [] { "orderingapi" } }
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Webhooks.API.Infrastructure
|
namespace Webhooks.API.Infrastructure
|
||||||
{
|
{
|
||||||
@ -13,19 +11,23 @@ namespace Webhooks.API.Infrastructure
|
|||||||
public void Apply(Operation operation, OperationFilterContext context)
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
{
|
{
|
||||||
// Check for authorize attribute
|
// 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)
|
if (hasAuthorize)
|
||||||
{
|
{
|
||||||
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
|
||||||
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
{
|
||||||
|
new Dictionary<string, IEnumerable<string>>
|
||||||
{
|
{
|
||||||
{ "oauth2", new [] { "webhooksapi" } }
|
{ "oauth2", new [] { "webhooksapi" } }
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user