public void UpdateEndpoints(EndpointConfiguration endpoints) { using (var entities = IdentityServerConfigurationContext.Get()) { var entity = Mapper.Map <EndpointConfiguration, Endpoints>(endpoints); entity.Name = StandardConfigurationName; entities.Endpoints.Attach(entity); entities.Entry(entity).State = System.Data.EntityState.Modified; entities.SaveChanges(); CacheRepository.Invalidate(EndpointConfigurationCacheKey); CacheRepository.Invalidate(Constants.CacheKeys.WSFedMetadata); } }
public void UpdateConfiguration(GlobalConfiguration configuration) { using (var entities = IdentityServerConfigurationContext.Get()) { var entity = Mapper.Map <GlobalConfiguration, Global>(configuration); entity.Name = StandardConfigurationName; entities.Global.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); CacheRepository.Invalidate(GlobalConfigurationCacheKey); CacheRepository.Invalidate(Constants.CacheKeys.WSFedMetadata); } }
public void UpdateCertificates(string sslSubjectName, string signingSubjectName) { using (var entities = IdentityServerConfigurationContext.Get()) { var certs = entities.Certificates; if (!string.IsNullOrWhiteSpace(sslSubjectName)) { var ssl = new Certificates { Name = SslCertificateName, SubjectDistinguishedName = sslSubjectName }; certs.Attach(ssl); entities.Entry(ssl).State = EntityState.Modified; } if (!string.IsNullOrWhiteSpace(signingSubjectName)) { var signing = new Certificates { Name = SigningCertificateName, SubjectDistinguishedName = signingSubjectName }; certs.Attach(signing); entities.Entry(signing).State = EntityState.Modified; } entities.SaveChanges(); CacheRepository.Invalidate(SigningCertificateCacheKey); CacheRepository.Invalidate(SslCertificateCachekey); CacheRepository.Invalidate(Constants.CacheKeys.WSFedMetadata); } }