/// <summary>
 /// 验证
 /// </summary>
 /// <param name="config">授权配置</param>
 /// <param name="param">授权参数</param>
 protected void Validate(TAuthorizationConfig config, AuthorizationParam param)
 {
     param.CheckNotNull(nameof(param));
     param.Validate();
     Validate(config);
     ValidateParam(param);
 }
        /// <summary>
        /// 生成授权地址
        /// </summary>
        /// <param name="param">授权参数</param>
        /// <returns></returns>
        public virtual async Task <string> GenerateUrlAsync(AuthorizationParam param)
        {
            var config = await ConfigProvider.GetConfigAsync();

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

            ConfigGenerateUrl(builder, param, config);
            return(HandlerUrl(builder));
        }
 /// <summary>
 /// 配置生成授权地址
 /// </summary>
 /// <param name="builder">授权参数生成器</param>
 /// <param name="param">授权参数</param>
 /// <param name="config">授权配置</param>
 protected virtual void ConfigGenerateUrl(AuthorizationParameterBuilder builder, AuthorizationParam param,
                                          TAuthorizationConfig config)
 {
     builder.GatewayUrl(config.AuthorizationUrl)
     .ClientId(config.AppId)
     .ResponseType(param.ResponseType)
     .State(param.State)
     .RedirectUri(string.IsNullOrWhiteSpace(param.RedirectUri) ? config.CallbackUrl : param.RedirectUri);
 }
 /// <summary>
 /// 验证参数
 /// </summary>
 /// <param name="param">授权参数</param>
 protected virtual void ValidateParam(AuthorizationParam param)
 {
 }