|
|
@ -3,9 +3,7 @@ using System.Linq;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Volo.Abp.Clients;
|
|
|
|
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
using Volo.Abp.Users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.Authorization
|
|
|
|
namespace Volo.Abp.Authorization
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -29,10 +27,10 @@ namespace Volo.Abp.Authorization
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var authorizationAttribute in GetAuthorizationDataAttributes(context.Method))
|
|
|
|
var authorizationPolicy = await AuthorizationPolicy.CombineAsync(_abpAuthorizationPolicyProvider,
|
|
|
|
{
|
|
|
|
GetAuthorizationDataAttributes(context.Method)).ConfigureAwait(false);
|
|
|
|
await CheckAsync(authorizationAttribute).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
await _abpAuthorizationService.CheckAsync(authorizationPolicy).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context)
|
|
|
|
protected virtual bool AllowAnonymous(MethodInvocationAuthorizationContext context)
|
|
|
@ -46,7 +44,7 @@ namespace Volo.Abp.Authorization
|
|
|
|
.GetCustomAttributes(true)
|
|
|
|
.GetCustomAttributes(true)
|
|
|
|
.OfType<IAuthorizeData>();
|
|
|
|
.OfType<IAuthorizeData>();
|
|
|
|
|
|
|
|
|
|
|
|
if (methodInfo.IsPublic)
|
|
|
|
if (methodInfo.IsPublic && methodInfo.DeclaringType != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
attributes = attributes
|
|
|
|
attributes = attributes
|
|
|
|
.Union(
|
|
|
|
.Union(
|
|
|
@ -58,13 +56,5 @@ namespace Volo.Abp.Authorization
|
|
|
|
|
|
|
|
|
|
|
|
return attributes;
|
|
|
|
return attributes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected async Task CheckAsync(IAuthorizeData authorizationAttribute)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var authorizationPolicy = await AuthorizationPolicy.CombineAsync(
|
|
|
|
|
|
|
|
_abpAuthorizationPolicyProvider,
|
|
|
|
|
|
|
|
new List<IAuthorizeData> { authorizationAttribute });
|
|
|
|
|
|
|
|
await _abpAuthorizationService.CheckAsync(authorizationPolicy).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|