/// <summary>
 /// 验证
 /// </summary>
 /// <param name="config">授权配置</param>
 /// <param name="param">访问令牌参数</param>
 protected void Validate(TAuthorizationConfig config, AccessTokenParam param)
 {
     param.CheckNotNull(nameof(param));
     param.Validate();
     Validate(config);
     ValidateParam(param);
 }
        /// <summary>
        /// 获取访问令牌
        /// </summary>
        /// <param name="param">访问令牌参数</param>
        /// <returns></returns>
        public virtual async Task <AuthorizationResult> GetTokenAsync(AccessTokenParam param)
        {
            var config = await ConfigProvider.GetConfigAsync();

            Validate(config, param);
            var builder = new AuthorizationParameterBuilder();

            ConfigGetToken(builder, param, config);
            return(await RequestResult(config, builder, ParameterParserType.Url, Success));
        }
 /// <summary>
 /// 配置获取访问令牌
 /// </summary>
 /// <param name="builder">授权参数生成器</param>
 /// <param name="param">访问令牌参数</param>
 /// <param name="config">授权配置</param>
 protected virtual void ConfigGetToken(AuthorizationParameterBuilder builder, AccessTokenParam param,
                                       TAuthorizationConfig config)
 {
     builder.GatewayUrl(config.AccessTokenUrl)
     .GrantType(OAuthConst.AuthorizationCode)
     .ClientId(config.AppId)
     .ClientSecret(config.AppKey)
     .Code(param.Code)
     .RedirectUri(string.IsNullOrWhiteSpace(param.RedirectUri) ? config.CallbackUrl : param.RedirectUri);
 }
 /// <summary>
 /// 验证参数
 /// </summary>
 /// <param name="param">访问令牌参数</param>
 protected virtual void ValidateParam(AccessTokenParam param)
 {
 }