public void SaveConfiguration() { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings[nameof(Configured)].Value = Configured.ToString(); config.AppSettings.Settings[nameof(ConnectionString)].Value = ConnectionString.ToString(); config.AppSettings.Settings[nameof(JwtIssuer)].Value = JwtIssuer.ToString(); config.AppSettings.Settings[nameof(JwtAudience)].Value = JwtAudience.ToString(); config.AppSettings.Settings[nameof(JwtExpiryInDays)].Value = JwtExpiryInDays.ToString(); config.AppSettings.Settings[nameof(JwtSecurityKey)].Value = JwtSecurityKey.ToString(); //config.AppSettings.Settings[nameof(ExtendsClassApi)].Value = ExtendsClassApi.ToString(); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name); }
/// <summary> /// Audience settings /// </summary> private static AppConfig.AuthSection.JwtSection.AudienceSection GetAudienceSettings(AppConfig appConfig, JwtAudience audience) { return((from a in appConfig.Auth.Jwt.Audiences where a.Audience == audience.ToString() select a).FirstOrDefault()); }