|
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
authorizationService, |
|
|
|
null, |
|
|
|
policyName |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) |
|
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, |
|
|
|
resource, |
|
|
|
requirement |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) |
|
|
|
@ -31,16 +31,16 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, |
|
|
|
resource, |
|
|
|
policy |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) |
|
|
|
{ |
|
|
|
return await AuthorizeAsync( |
|
|
|
authorizationService, |
|
|
|
authorizationService, |
|
|
|
null, |
|
|
|
policy |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) |
|
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, |
|
|
|
resource, |
|
|
|
requirements |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName) |
|
|
|
@ -58,42 +58,42 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, |
|
|
|
resource, |
|
|
|
policyName |
|
|
|
).ConfigureAwait(false); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, string policyName) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(policyName).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(policyName)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, requirement).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, requirement)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, policy).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, policy)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(policy).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(policy)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, requirements).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, requirements)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task<bool> IsGrantedAsync(this IAuthorizationService authorizationService, object resource, string policyName) |
|
|
|
{ |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, policyName).ConfigureAwait(false)).Succeeded; |
|
|
|
return (await authorizationService.AuthorizeAsync(resource, policyName)).Succeeded; |
|
|
|
} |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, string policyName) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(policyName)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted: " + policyName); |
|
|
|
} |
|
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, requirement).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, requirement)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given requirement has not granted for given resource: " + resource); |
|
|
|
} |
|
|
|
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, policy).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, policy)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted for given resource: " + resource); |
|
|
|
} |
|
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(policy).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(policy)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given policy has not granted."); |
|
|
|
} |
|
|
|
@ -125,7 +125,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, requirements).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, requirements)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given requirements have not granted for given resource: " + resource); |
|
|
|
} |
|
|
|
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Authorization |
|
|
|
|
|
|
|
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName) |
|
|
|
{ |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, policyName).ConfigureAwait(false)) |
|
|
|
if (!await authorizationService.IsGrantedAsync(resource, policyName)) |
|
|
|
{ |
|
|
|
throw new AbpAuthorizationException("Authorization failed! Given polist has not granted for given resource: " + resource); |
|
|
|
} |
|
|
|
|