public void ConnectionSettingsTest() { dynamic config = new Configuration(); ConnectionSettings settings = config.Bind<ConnectionSettings>(new ConnectionSettings(_envFile)); Assert.IsNotNull(settings); Assert.IsNotNullOrEmpty(settings["Redis"]); Assert.IsTrue(settings["Redis"].Contains(_testAddress)); }
public TestClass() { Count1 = 0; Success = new List<string>(); Count2 = 0; Fail = new List<string>(); dynamic config = new Configuration(); _stressTestCount = config.StressRequestCount<int>(5); _baseUrl = config.UrlBase; _url = config.Url; _responseValidation = config.ResponseValidation; }
public void ExecuteMailTest() { dynamic config = new Configuration(); var userName = config.UserName; var password = config.Password; const string file = "c:\\temp\\KMs\\send\\km_e-Us_E_201406.pdf"; var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential(userName, password), EnableSsl = true }; var emailHelper = new EmailHelper(client); emailHelper.SendTestEmail("","", file); }
protected void Application_Start() { // Makes the JSON easier to read in a browser without installing an extension like JSONview GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented; // Stops the backing field names being used instead of the public property names (*Field & PropertyChanged etc.) GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); // Returns JSON to the browser without needing to add application/json to the accept request header - remove to use XML (becomes the default) GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); // Pass Register into Configure to support attribute routing in the future GlobalConfiguration.Configure(WebApiConfig.Register); // Load settings dynamic config = new Configuration(); Settings = config.Bind<HuxleySettings>(); // Set the CRS dictionary passing in embedded CRS path CrsCodes = GetCrsCodes(Server.MapPath("~/RailReferences.csv")).Result; // https://en.wikipedia.org/wiki/London_station_group // Farringdon [ZFD] is not a London Terminal but it probably should be (maybe when Crossrail opens it will be) LondonTerminals = new List<CrsRecord> { new CrsRecord {CrsCode = "BFR", StationName = "London Blackfriars",}, new CrsRecord {CrsCode = "CST", StationName = "London Cannon Street",}, new CrsRecord {CrsCode = "CHX", StationName = "London Charing Cross",}, new CrsRecord {CrsCode = "CTK", StationName = "City Thameslink",}, new CrsRecord {CrsCode = "EUS", StationName = "London Euston",}, new CrsRecord {CrsCode = "FST", StationName = "London Fenchurch Street",}, new CrsRecord {CrsCode = "KGX", StationName = "London Kings Cross",}, new CrsRecord {CrsCode = "LST", StationName = "London Liverpool Street",}, new CrsRecord {CrsCode = "LBG", StationName = "London Bridge",}, new CrsRecord {CrsCode = "MYB", StationName = "London Marylebone",}, new CrsRecord {CrsCode = "MOG", StationName = "Moorgate",}, new CrsRecord {CrsCode = "OLD", StationName = "Old Street",}, new CrsRecord {CrsCode = "PAD", StationName = "London Paddington",}, new CrsRecord {CrsCode = "STP", StationName = "London St Pancras International",}, new CrsRecord {CrsCode = "VXH", StationName = "Vauxhall",}, new CrsRecord {CrsCode = "VIC", StationName = "London Victoria",}, new CrsRecord {CrsCode = "WAT", StationName = "London Waterloo",}, new CrsRecord {CrsCode = "WAE", StationName = "London Waterloo East",}, }; }
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 public void ConfigureAuth(IAppBuilder app) { // Configure the db context and user manager to use a single instance per request //app.CreatePerOwinContext(ApplicationDbContext.Create); //app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider // Configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); var configuration = new Configuration(); // Uncomment the following lines to enable logging in with third party login providers //app.UseMicrosoftAccountAuthentication( // clientId: "", // clientSecret: ""); //app.UseTwitterAuthentication( // consumerKey: "", // consumerSecret: ""); //app.UseFacebookAuthentication( // appId: "", // appSecret: ""); app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() { ClientId = configuration.Get<string>("GoogleClientId"), ClientSecret = configuration.Get<string>("GoogleClientSecret") }); }
public async Task<ActionResult> ExternalLoginCallback(string returnUrl) { var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); if (loginInfo == null) { return RedirectToAction("Login"); } var configuration = new Configuration(); var userList = configuration.Get<string>("UserList").Split(';'); if (!userList.Contains(loginInfo.Email)) { return RedirectToAction("Login"); } // Sign in the user with this external login provider if the user already has a login var user = await UserManager.FindAsync(loginInfo.Login); if (user != null) { await SignInAsync(user, isPersistent: false); return RedirectToLocal(returnUrl); } else { // If the user does not have an account, then prompt the user to create an account ViewBag.ReturnUrl = returnUrl; ViewBag.LoginProvider = loginInfo.Login.LoginProvider; return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email, Name = loginInfo.ExternalIdentity.Name}); } }
public TmdbMoviesService() { var config = new Configuration(); _client = new TMDbClient(config.Get<string>("TmdbApiKey")); _client.GetConfig(); }
public static void Init() { _config = new Configuration(); // bind to this static class _config.Bind<AppSettings>(); }