protected AbstractClientProvider(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) { ClientId = ccOauth.ClientId; ClientSecret = ccOauth.ClientSecret; CallBackUrl = ccOauth.CallbackUrl; Scope = ccOauth.Scope; Endpoint = ccOauth.Endpoint; AcceptedRedirectUrl = ccRoot.AcceptedRedirectUrl; FailedRedirectUrl = ccRoot.FailedRedirectUrl; Proxy = ccRoot.Proxy; }
public static T CreateClient <T>(string appName, string configName) where T : AbstractClientProvider, new() { if (String.IsNullOrEmpty(appName)) { throw new Exception("ERROR: AppName cannot be null!"); } if (String.IsNullOrEmpty(configName)) { throw new Exception("ERROR: ConfigName cannot be null!"); } var ccRoot = OAuth2LoginConfig.Instance; if (ccRoot != null) { WebConfiguration ccWebElem = ccRoot.Web; OAuthConfig ccAppElem = OAuth2LoginConfig.Instance.OAuth.GetItemByKey(appName); if (ccAppElem == null) { throw new Exception($"ERROR: AppName[{appName}] in OAuth2Login.Configuartion is not found!"); } OAuthSettingsConfig ccOauth = ccAppElem.OAuthSettings.GetItemByKey(configName); if (ccOauth == null) { throw new Exception($"ERROR: ConfigurationName[{configName}] in OAuth2Login.Configuartion is not found!"); } var constructorParams = new object[] { ccWebElem, ccOauth }; var client = (T)Activator.CreateInstance(typeof(T), constructorParams); return(client); } return(default(T)); }
public PayPalClient(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) : base(ccRoot, ccOauth) { }
public WindowsLiveClient(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) : base(ccRoot, ccOauth) { }
public TwitterClient(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) : base(ccRoot, ccOauth) { }
public FacebookClient(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) : base(ccRoot, ccOauth) { }