React to aspnet/Configuration #194
This commit is contained in:
parent
030459b8ba
commit
717b7a090c
|
|
@ -23,9 +23,11 @@ namespace IdentitySamples
|
||||||
* Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
* Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||||
* then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
* then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||||
*/
|
*/
|
||||||
Configuration = new ConfigurationSection(env.ApplicationBasePath)
|
var builder = new ConfigurationBuilder(env.ApplicationBasePath)
|
||||||
.AddJsonFile("LocalConfig.json")
|
.AddJsonFile("LocalConfig.json")
|
||||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||||
|
|
||||||
|
Configuration = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfiguration Configuration { get; private set; }
|
public IConfiguration Configuration { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ namespace Microsoft.AspNet.Identity.Test
|
||||||
{"identity:lockout:EnabledByDefault", "TRUe"},
|
{"identity:lockout:EnabledByDefault", "TRUe"},
|
||||||
{"identity:lockout:MaxFailedAccessAttempts", "1000"}
|
{"identity:lockout:MaxFailedAccessAttempts", "1000"}
|
||||||
};
|
};
|
||||||
var config = new ConfigurationSection(new MemoryConfigurationSource(dic));
|
var builder = new ConfigurationBuilder(new MemoryConfigurationSource(dic));
|
||||||
|
var config = builder.Build();
|
||||||
Assert.Equal(roleClaimType, config.Get("identity:claimsidentity:roleclaimtype"));
|
Assert.Equal(roleClaimType, config.Get("identity:claimsidentity:roleclaimtype"));
|
||||||
|
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
|
|
@ -93,7 +94,8 @@ namespace Microsoft.AspNet.Identity.Test
|
||||||
{"identity:user:requireUniqueEmail", "true"},
|
{"identity:user:requireUniqueEmail", "true"},
|
||||||
{"identity:lockout:MaxFailedAccessAttempts", "1000"}
|
{"identity:lockout:MaxFailedAccessAttempts", "1000"}
|
||||||
};
|
};
|
||||||
var config = new ConfigurationSection(new MemoryConfigurationSource(dic));
|
var builder = new ConfigurationBuilder(new MemoryConfigurationSource(dic));
|
||||||
|
var config = builder.Build();
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
services.ConfigureIdentity(config.GetConfigurationSection("identity"));
|
services.ConfigureIdentity(config.GetConfigurationSection("identity"));
|
||||||
services.AddIdentity<TestUser, TestRole>(o => { o.User.RequireUniqueEmail = false; o.Lockout.MaxFailedAccessAttempts++; });
|
services.AddIdentity<TestUser, TestRole>(o => { o.User.RequireUniqueEmail = false; o.Lockout.MaxFailedAccessAttempts++; });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue