protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            var ticket = GetTicket();

            if (ticket == null)
            {
                return(AuthenticateResult.Failed("No ticket."));
            }

            var context = new BearerValidatePrincipalContext(Context, Options, ticket.Principal, ticket.Properties);
            await Options.Events.ValidatePrincipal(context);

            if (context.Principal == null)
            {
                return(AuthenticateResult.Failed("No principal."));
            }

            if (context.ShouldRenew)
            {
                _shouldRenew = true;
            }

            return(AuthenticateResult.Success(new AuthenticationTicket(context.Principal, context.Properties, Options.AuthenticationScheme)));
        }
示例#2
0
 public Task ValidatePrincipal(BearerValidatePrincipalContext context)
 {
     return(OnValidatePrincipal(context));
 }