Evaluating ASP.NET Core Authorization Policies

added by DotNetKicks
5/30/2019 5:19:19 PM

2 Kicks, 166 Views

public class SecretsModel : PageModel { public bool IsLucky { get; set; } private readonly IAuthorizationService authorization; public SecretsModel(IAuthorizationService authorization) { this.authorization = authorization; } public async Task OnGet() { var result = await authorization.AuthorizeAsync(User, "IsLucky"); IsLucky = result.Succeeded; } }


0 comments