先看一下接口内容:
[AssemblyNeutral]
public interface IAuthenticationHandler
{
void Authenticate(IAuthenticateContext context);
Task AuthenticateAsync(IAuthenticateContext context);
void Challenge(IChallengeContext context);
void GetDescriptions(IAuthTypeContext context);
void SignIn(ISignInContext context);
void SignOut(ISignOutContext context);
}
IAuthenticationContext:
[AssemblyNeutral]
public interface IAuthenticateContext
{
IEnumerable<string> AuthenticationTypes { get; }
void Authenticated(ClaimsIdentity identity, IDictionary<string, string> properties, IDictionary<string, object> description);
void NotAuthenticated(string authenticationType, IDictionary<string, string> properties, IDictionary<string, object> description);
}
IChallengeContext:
[AssemblyNeutral]
public interface IChallengeContext
{
IEnumerable<string> AuthenticationTypes { get; }
IDictionary<string, string> Properties { get; }
void Accept(string authenticationType, IDictionary<string, object> description);
}
实现接口的若干类:
public abstract class AuthenticationHandler : IAuthenticationHandler{}
public abstract class AuthenticationHandler<TOptions> : AuthenticationHandler
where TOptions : AuthenticationOptions{}
internal class CookieAuthenticationHandler : AuthenticationHandler<CookieAuthenticationOptions>{}
public class OAuthBearerAuthenticationHandler : AuthenticationHandler<OAuthBearerAuthenticationOptions>{}
public class OpenIdConnectAuthenticationHandler : AuthenticationHandler<OpenIdConnectAuthenticationOptions>{}
internal class TwitterAuthenticationHandler : AuthenticationHandler<TwitterAuthenticationOptions>{}
public class OAuthAuthenticationHandler<TOptions, TNotifications> : AuthenticationHandler<TOptions>
where TOptions : OAuthAuthenticationOptions<TNotifications>
where TNotifications : IOAuthAuthenticationNotifications{}
internal class GoogleAuthenticationHandler
: OAuthAuthenticationHandler<GoogleAuthenticationOptions, IGoogleAuthenticationNotifications>{}
internal class MicrosoftAccountAuthenticationHandler
: OAuthAuthenticationHandler<MicrosoftAccountAuthenticationOptions
, IMicrosoftAccountAuthenticationNotifications>{}
internal class FacebookAuthenticationHandler
: OAuthAuthenticationHandler<FacebookAuthenticationOptions, IFacebookAuthenticationNotifications>{}
浙公网安备 33010602011771号