-
Notifications
You must be signed in to change notification settings - Fork 32
PageFilter and on page authorization check example
asyasky edited this page Jan 11, 2019
·
1 revision
public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next)
{
AuthorizationResult authResult;
switch (this.EventRole)
{
case (EventRole.admin):
authResult = authorizationService.AuthorizeAsync(User, "IsEventAdmin").Result;
break;
case (EventRole.author):
authResult = authorizationService.AuthorizeAsync(User, "IsEventAuthor").Result;
break;
case (EventRole.play):
default:
authResult = authorizationService.AuthorizeAsync(User, "IsEventPlayer").Result;
break;
}
if (authResult.Succeeded)
{
await base.OnPageHandlerExecutionAsync(context, next);
}
else if (User.Identity.IsAuthenticated)
{
context.Result = new ForbidResult();
}
else
{
context.Result = new ChallengeResult();
}
}
- First-time setup
- Contributing using git
- Local Development Environment Setup
- External Authentication Setup
- Build and run locally
- Best practices
- Common Errors
- Making a page Event aware
- Making your page aware of the current user
- PageFilter and on page authorization check example
- Updating the DataModel and or Database Schema
- Debugging the database locally
- FAQ
- Onboarding
- Puzzle setup
- Puzzle properties defined
- Webification
- Unlock a puzzle for a team
- Setting up hints
- Puzzle lockout
- Annotations