public TwitterProvider(ProviderParams providerParams) { providerParams.Validate(); _consumerKey = providerParams.Key; _consumerSecret = providerParams.Secret; }
public GitHubProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; }
public WindowsLiveProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; }
public AmazonProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; }
public HttpStatusCode Connect(ProviderParams providerParams) { _imapClient = new ImapClient(); _smtpClient = new MailKit.Net.Smtp.SmtpClient(); _imapClient.ServerCertificateValidationCallback = (s, c, h, e) => true; try { _imapClient.Connect(providerParams.ImapServerName, providerParams.ImapPortNumber, true); _smtpClient.Connect(providerParams.SmtpServerName, providerParams.SmtpPortNumber, true); _imapClient.AuthenticationMechanisms.Remove("XOAUTH2"); _smtpClient.Authenticate(providerParams.EmailAddress, providerParams.Password); _imapClient.Authenticate(providerParams.EmailAddress, providerParams.Password); } catch (Exception exception) { Console.WriteLine(exception.ToString()); return(HttpStatusCode.ExpectationFailed); } if (_imapClient.IsConnected && _smtpClient.IsConnected) { _currentFolder = ""; return(HttpStatusCode.OK); } else { return(HttpStatusCode.InternalServerError); } }
public TwitterProvider(ProviderParams providerParams) : base("Twitter", "OAuth 1.0a") { providerParams.Validate(); PublicApiKey = providerParams.PublicApiKey; SecretApiKey = providerParams.SecretApiKey; RestClientFactory = new RestClientFactory(); }
public async Task <IActionResult> RemoveProvider(int?id) { ProviderParams model = await Task.Run(() => { return(_context.ProviderParams.Where(x => x.ID == id).ToList().First()); }); _context.ProviderParams.Remove(model); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public FacebookProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List<string> {"email"}; }
protected BaseOAuth20Provider(string name, ProviderParams providerParams) : base(name, "OAuth 2.0") { providerParams.Validate(); PublicApiKey = providerParams.PublicApiKey; SecretApiKey = providerParams.SecretApiKey; Scopes = providerParams.Scopes; RestClientFactory = new RestClientFactory(); }
public FacebookProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List <string> { "email" }; }
public LinkedInProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List<string>() { "r_basicprofile", "r_emailaddress" }; }
public LinkedInProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List <string>() { "r_basicprofile", "r_emailaddress" }; }
public GoogleProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List <string> { "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email" }; }
public GoogleProvider(ProviderParams providerParams) { providerParams.Validate(); _clientId = providerParams.Key; _clientSecret = providerParams.Secret; // Optionals. _scope = new List<string> { "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email" }; }
private void AddProviderParamsToOtherUser() { var fakeProviderParams = new ProviderParams() { EmailAddress = "*****@*****.**", Password = "******", ImapServerName = "fake", ImapPortNumber = 1, SmtpServerName = "fake", SmtpPortNumber = 1, UserId = "user2" }; mockDbContext.ProviderParams.Add(fakeProviderParams); mockDbContext.SaveChanges(); }
public void RegisterOAuthProviders() { // Add in all of our registered authorization providers (Google, RT Vision, etc.) var authenticationProviderFactory = new AuthenticationProviderFactory(); foreach (var provider in OAuthProviders) { var parameters = new ProviderParams { PublicApiKey = provider.Key, SecretApiKey = provider.Secret }; switch (provider.Name.ToLower()) { case "google": authenticationProviderFactory.AddProvider(new GoogleProvider(parameters)); break; case "github": // Request the full user scope instead of the default which is user:email List <string> scopes = new List <string>(); scopes.Add("user"); parameters.Scopes = scopes; authenticationProviderFactory.AddProvider(new GitHubProvider(parameters)); break; case "rtvision": authenticationProviderFactory.AddProvider(new RTVisionProvider(parameters)); break; /* * case "mndot": * authenticationProviderFactory.AddProvider(new RTVisionProvider(parameters)); * break; */ case "arcgisonline": authenticationProviderFactory.AddProvider(new ArcGISOnlineProvider(parameters)); break; default: logger.Warn("Unknown OAuth provider: '{0}'. Skipping.", provider.Name); break; } } }
private async Task <bool> ConnectToProvider() { if (_provider.IsAuthenticated()) { return(true); } System.GC.Collect(); var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var providerParams = _dbContext.ProviderParams.Where(p => p.UserId == user.Id).ToList(); if (providerParams.Any()) { _providerParams = providerParams.First(); HttpStatusCode result; result = _provider.Connect(_providerParams); return(result == HttpStatusCode.OK); } return(false); }
public OpenIdProvider(ProviderParams providerParams) { }
protected LinkedInProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://www.linkedin.com/uas/oauth2/authorization"); }
public ThirtySevenSignalsProvider(ProviderParams providerParams) : base("ThirtySevenSignals", providerParams) { AuthenticateRedirectionUrl = new Uri("https://launchpad.37signals.com/authorization/new"); }
public GoogleProvider(ProviderParams providerParams) : this("Google", providerParams) { }
public LinkedInProvider(ProviderParams providerParams) : this("LinkedIn", providerParams) { }
protected ThirtySevenSignalsProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://launchpad.37signals.com/authorization/new"); }
public WindowsLiveProvider(ProviderParams providerParams) : this("WindowsLive", providerParams) { }
protected ArcGISOnlineProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://www.arcgis.com/sharing/oauth2/authorize"); }
public WindowsLiveProvider(ProviderParams providerParams) : base("WindowsLive", providerParams) { AuthenticateRedirectionUrl = new Uri("https://login.live.com/oauth20_authorize.srf"); }
public ArcGISOnlineProvider(ProviderParams providerParams) : this("ArcGISOnline", providerParams) { }
protected InstagramProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://api.instagram.com/oauth/authorize/"); }
public InstagramProvider(ProviderParams providerParams) : this("Instagram", providerParams) { }
public ThirtySevenSignalsProvider(ProviderParams providerParams) : this("ThirtySevenSignals", providerParams) { }
public OpenIdProvider(ProviderParams providerParams) : base("OpenId", "OpenId") { }
public FacebookProvider(ProviderParams providerParams) : base("Facebook", providerParams) { DisplayType = DisplayType.Unknown; IsMobile = false; }
protected WindowsLiveProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://login.live.com/oauth20_authorize.srf"); }
protected GoogleProvider(string name, ProviderParams providerParams) : base(name, providerParams) { AuthenticateRedirectionUrl = new Uri("https://accounts.google.com/o/oauth2/auth"); }