zoukankan      html  css  js  c++  java
  • 2.2SignInAuthenticationHandler【SignOutAuthenticationHandler、IAuthenticationSignInHandler】

    using System.Security.Claims;
    using System.Text.Encodings.Web;
    using System.Threading.Tasks;
    using Microsoft.Extensions.Logging;
    using Microsoft.Extensions.Options;
    
    namespace Microsoft.AspNetCore.Authentication
    {
        /// <summary>
        /// Adds support for SignInAsync
        /// </summary>
        public abstract class SignInAuthenticationHandler<TOptions> : SignOutAuthenticationHandler<TOptions>, IAuthenticationSignInHandler
            where TOptions : AuthenticationSchemeOptions, new()
        {
            /// <summary>
            /// Initializes a new instance of <see cref="SignInAuthenticationHandler{TOptions}"/>.
            /// </summary>
            /// <param name="options">The monitor for the options instance.</param>
            /// <param name="logger">The <see cref="ILoggerFactory"/>.</param>
            /// <param name="encoder">The <see cref="UrlEncoder"/>.</param>
            /// <param name="clock">The <see cref="ISystemClock"/>.</param>
            public SignInAuthenticationHandler(IOptionsMonitor<TOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
            { }
    
            /// <inheritdoc/>
            public virtual Task SignInAsync(ClaimsPrincipal user, AuthenticationProperties? properties)
            {
                var target = ResolveTarget(Options.ForwardSignIn);
                return (target != null)
                    ? Context.SignInAsync(target, user, properties)
                    : HandleSignInAsync(user, properties ?? new AuthenticationProperties());
            }
    
            /// <summary>
            /// Override this method to handle SignIn.
            /// </summary>
            /// <param name="user"></param>
            /// <param name="properties"></param>
            /// <returns>A Task.</returns>
            protected abstract Task HandleSignInAsync(ClaimsPrincipal user, AuthenticationProperties? properties);
    
        }
    }
  • 相关阅读:
    2020-2-21 牛客试题复盘
    Java核心技术36讲读书笔记(5~8讲)
    2020-2-21 牛客试题复盘
    Java核心技术36讲读书笔记(1~4讲)
    2020-2-20 牛客试题复盘
    2020-2-19 牛客试题复盘
    2020-2-18 牛客试题复盘
    P4213 【模板】杜教筛(Sum)
    「SDOI2015」约数个数和(莫比乌斯反演)
    Crash的数字表格(莫比乌斯反演)
  • 原文地址:https://www.cnblogs.com/htlp/p/15256490.html
Copyright © 2011-2022 走看看