예제 #1
0
        protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            var result = await EnsureCookieTicket();

            if (!result.Succeeded)
            {
                return(result);
            }

            var context = new SidValidatePrincipalContext(Context, result.Ticket, Options);
            await Options.Events.ValidatePrincipal(context);

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

            if (context.ShouldRenew)
            {
                RequestRefresh(result.Ticket);
            }

            var setCurrentContext = new SidSetCurrentContext(Context, Options, Options.AuthenticationScheme, context.Principal);
            await Options.Events.SetCurrent(setCurrentContext);

            return(AuthenticateResult.Success(new AuthenticationTicket(context.Principal, context.Properties, Options.AuthenticationScheme)));
        }
예제 #2
0
 /// <summary>
 /// Implements the interface method by invoking the related delegate method.
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public virtual Task ValidatePrincipal(SidValidatePrincipalContext context) => OnValidatePrincipal(context);