public AuthenticationDomain AuthenticateForms(AuthenticationDomain domain, Uri formUri, Uri tokenUri, string root) { var webDialogThread = new WebDialogThread(this, domain, formUri, tokenUri, root); var t = new Thread(webDialogThread.Run); t.SetApartmentState(ApartmentState.STA); t.Start(); var ResultDomain = webDialogThread.Result; if (ResultDomain != null && (ResultDomain.OAuthToken != null || ResultDomain.AuthID != null)) { if (Domains.ContainsKey(ResultDomain.Uri)) { Domains.Remove(ResultDomain.Uri); } Domains.Add(ResultDomain.Uri, ResultDomain); Client.AddAuthenticationId(new Uri(ResultDomain.Uri), ResultDomain.AuthID); Client.BaseUri = new Uri(ResultDomain.Uri); this.Save(); } else { throw new Exception("Invalid Authentication"); } return(ResultDomain); }
public AuthenticationDomain AuthenticateOAuth(AuthenticationDomain domain) { var webDialogThread = new WebDialogThread(this, domain); var t = new Thread(webDialogThread.Run); t.SetApartmentState(ApartmentState.STA); t.Start(); var ResultDomain = webDialogThread.Result; if (ResultDomain != null && ResultDomain.OAuthToken != null) { if (Domains.ContainsKey(ResultDomain.Uri)) { Domains.Remove(ResultDomain.Uri); } Domains.Add(ResultDomain.Uri, ResultDomain); PrimaryDomain = ResultDomain; Client.AddOAuthCredentials(new Uri(ResultDomain.Uri), ResultDomain.OAuthToken); Client.BaseUri = new Uri(ResultDomain.Uri); this.Save(); } else { throw new Exception("Invalid Authentication"); } return(ResultDomain); }
public AuthenticationDomain AuthenticateForms(AuthenticationDomain domain, Uri formUri, Uri tokenUri, string root) { var webDialogThread = new WebDialogThread(this, domain, formUri, tokenUri, root); var t = new Thread(webDialogThread.Run); t.SetApartmentState(ApartmentState.STA); t.Start(); var ResultDomain = webDialogThread.Result; if (ResultDomain != null && (ResultDomain.OAuthToken != null || ResultDomain.AuthID != null)) { if (Domains.ContainsKey(ResultDomain.Uri)) Domains.Remove(ResultDomain.Uri); Domains.Add(ResultDomain.Uri, ResultDomain); Client.AddAuthenticationId(new Uri(ResultDomain.Uri), ResultDomain.AuthID); Client.BaseUri = new Uri(ResultDomain.Uri); this.Save(); } else throw new Exception("Invalid Authentication"); return ResultDomain; }
public AuthenticationDomain AuthenticateOAuth(AuthenticationDomain domain) { var webDialogThread = new WebDialogThread(this, domain); var t = new Thread(webDialogThread.Run); t.SetApartmentState(ApartmentState.STA); t.Start(); var ResultDomain = webDialogThread.Result; if (ResultDomain != null && ResultDomain.OAuthToken != null) { if (Domains.ContainsKey(ResultDomain.Uri)) Domains.Remove(ResultDomain.Uri); Domains.Add(ResultDomain.Uri, ResultDomain); PrimaryDomain = ResultDomain; Client.AddOAuthCredentials(new Uri(ResultDomain.Uri), ResultDomain.OAuthToken); Client.BaseUri = new Uri(ResultDomain.Uri); this.Save(); } else throw new Exception("Invalid Authentication"); return ResultDomain; }