Browse Source

fix AuthorizeFilter deprecation

pull/992/head
Rafsanul Hasan 5 years ago
parent
commit
b41be28a16
No known key found for this signature in database GPG Key ID: 4BBF45E04D0AD72B
7 changed files with 28 additions and 14 deletions
  1. +4
    -2
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs
  2. +4
    -2
      src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs
  3. +4
    -2
      src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
  4. +4
    -2
      src/Services/Location/Locations.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
  5. +4
    -2
      src/Services/Marketing/Marketing.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
  6. +4
    -2
      src/Services/Ordering/Ordering.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs
  7. +4
    -2
      src/Services/Webhooks/Webhooks.API/Infrastructure/AuthorizeCheckOperationFilter.cs

+ 4
- 2
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs View File

@ -13,8 +13,10 @@
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)
{ {


+ 4
- 2
src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs View File

@ -13,8 +13,10 @@
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)
{ {


+ 4
- 2
src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs View File

@ -11,8 +11,10 @@ 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() ||
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)
{ {


+ 4
- 2
src/Services/Location/Locations.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs View File

@ -12,8 +12,10 @@ 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() ||
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)
{ {


+ 4
- 2
src/Services/Marketing/Marketing.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs View File

@ -11,8 +11,10 @@ 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() ||
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)
{ {


+ 4
- 2
src/Services/Ordering/Ordering.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs View File

@ -13,8 +13,10 @@ 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)
{ {


+ 4
- 2
src/Services/Webhooks/Webhooks.API/Infrastructure/AuthorizeCheckOperationFilter.cs View File

@ -13,8 +13,10 @@ 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)
{ {


Loading…
Cancel
Save