private AuthToutiaoErrorCode GetToutiaoErrorCode(int errorCode) { var enumObjects = typeof(AuthToutiaoErrorCode).ToList(); var codeEnum = enumObjects.Where(a => a.ID == errorCode).ToList(); if (codeEnum.Count > 0) { return(GlobalAuthUtil.EnumFromString <AuthToutiaoErrorCode>(codeEnum[0].Name)); } else { return(AuthToutiaoErrorCode.EC999); } }
/// <summary> /// 获取默认的 Request /// </summary> /// <param name="authSource"></param> /// <returns>{@link AuthRequest}</returns> private IAuthRequest getDefaultRequest(string authSource) { ClientConfig clientConfig = GetClientConfig(authSource); IAuthStateCache authStateCache = new DefaultAuthStateCache(); DefaultAuthSourceEnum authSourceEnum = GlobalAuthUtil.EnumFromString <DefaultAuthSourceEnum>(authSource); switch (authSourceEnum) { case DefaultAuthSourceEnum.WECHAT_MP: return(new WeChatMpAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.WECHAT_OPEN: return(new WeChatOpenAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.WECHAT_ENTERPRISE: return(new WeChatEnterpriseAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.WECHAT_ENTERPRISE_SCAN: return(new WeChatEnterpriseScanAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.ALIPAY_MP: return(new AlipayMpAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.GITEE: return(new GiteeAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.GITHUB: return(new GithubAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.BAIDU: return(new BaiduAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.XIAOMI: return(new XiaoMiAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.DINGTALK_SCAN: return(new DingTalkScanAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.OSCHINA: return(new OschinaAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.CODING: return(new CodingAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.LINKEDIN: return(new LinkedInAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.WEIBO: return(new WeiboAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.QQ: return(new QQAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.DOUYIN: return(new DouyinAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.GOOGLE: return(new GoogleAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.FACEBOOK: return(new FackbookAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.MICROSOFT: return(new MicrosoftAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.TOUTIAO: return(new ToutiaoAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.TEAMBITION: return(new TeambitionAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.RENREN: return(new RenrenAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.PINTEREST: return(new PinterestAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.STACK_OVERFLOW: return(new StackOverflowAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.HUAWEI: return(new HuaweiAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.KUJIALE: return(new KujialeAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.GITLAB: return(new GitlabAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.MEITUAN: return(new MeituanAuthRequest(clientConfig, authStateCache)); case DefaultAuthSourceEnum.ELEME: return(new ElemeAuthRequest(clientConfig, authStateCache)); default: return(null); } }