/// <summary> /// 请求结果 /// </summary> /// <param name="config">授权配置</param> /// <param name="builder">授权参数生成器</param> /// <param name="type">参数解析器类型</param> /// <param name="success">请求成功条件</param> /// <returns></returns> protected override async Task<AuthorizationResult> RequestResult(GithubAuthorizationConfig config, AuthorizationParameterBuilder builder, ParameterParserType type, Func<AuthorizationResult, bool> success) { var result = new AuthorizationResult(await Request(builder, config.ApplicationName), success, type); result.Parameter = builder.ToString(); result.Message = GetMessage(result); WriteLog(config, builder, result); return result; }
/// <summary> /// 发送请求 /// </summary> /// <param name="builder">授权参数生成器</param> /// <param name="appName">应用名称</param> /// <returns></returns> private async Task <string> Request(AuthorizationParameterBuilder builder, string appName) { return(await Web.Client().Get(builder.ToString()).Header("User-Agent", appName).ResultAsync()); }
/// <summary> /// 处理授权地址 /// </summary> /// <param name="builder">授权参数生成器</param> /// <returns></returns> protected override string HandlerUrl(AuthorizationParameterBuilder builder) => $"{builder.ToString()}#wechat_redirect";