ОК, это можно понять из более сложных примеров:
public class LocalAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
public LocalAuthenticationHandler(
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
}
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
// Create an empty claims identity and pass it off as a valid user. This is only valid in a local build environment to bypass the
// web-based authentication service.
var principal = new ClaimsPrincipal(new ClaimsIdentity(Array.Empty<Claim>(), this.Scheme.Name));
return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, this.Scheme.Name)));
}
}
И в файле startup.cs
serviceCollection.AddAuthentication(options => options.DefaultAuthenticateScheme = "Local")
.AddScheme<AuthenticationSchemeOptions, LocalAuthenticationHandler>("Local", null);