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);
    
        }
    }
  • 相关阅读:
    Spring1()
    常用的比较器:实现方式Compareable和Comparator
    数据结构 2(数据结构 逻辑关系 存储关系 数据类型 抽象数据类型)
    面试题目
    数据结构(1术语)
    第一次作业-四则运算题目生成程序
    第二次 作业——APP案例分析
    面试题
    字符串转换时间的方法
    安卓获取手机内存,SD卡内存使用状态的方法
  • 原文地址:https://www.cnblogs.com/htlp/p/15256490.html
Copyright © 2011-2022 走看看