mirror of https://github.com/abpframework/abp.git
6 changed files with 76 additions and 21 deletions
@ -0,0 +1,13 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Authorization.TestServices |
|||
{ |
|||
public interface IMyAuthorizedServiceWithRole |
|||
{ |
|||
Task<int> ProtectedByRole(); |
|||
|
|||
Task<int> ProtectedByScheme(); |
|||
|
|||
Task<int> ProtectedByAnotherRole(); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.Authorization.TestServices |
|||
{ |
|||
[Authorize(Roles = "MyRole")] |
|||
public class MyAuthorizedServiceWithRole : IMyAuthorizedServiceWithRole, ITransientDependency |
|||
{ |
|||
public virtual Task<int> ProtectedByRole() |
|||
{ |
|||
return Task.FromResult(42); |
|||
} |
|||
|
|||
[Authorize(Roles = "MyAnotherRole")] |
|||
public virtual Task<int> ProtectedByAnotherRole() |
|||
{ |
|||
return Task.FromResult(42); |
|||
} |
|||
|
|||
[Authorize(AuthenticationSchemes = "Bearer")] |
|||
public virtual Task<int> ProtectedByScheme() |
|||
{ |
|||
return Task.FromResult(42); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue