public static SetupServiceSettings FromConfigDir(string serviceSettingsConfigDir) { var serviceSettingsFile = Path.Combine(serviceSettingsConfigDir, "SetupServiceSettings.json"); SetupServiceSettings result = new SetupServiceSettings(); if (!File.Exists(serviceSettingsFile)) { throw new FileNotFoundException( "ConfigDir can't be found", serviceSettingsFile); } var jsonContent = File.ReadAllText(serviceSettingsFile); var svcSettingsFromFile = JsonConvert.DeserializeObject <SetupServiceSettingsMemento>(jsonContent); string scheme = "https"; result.EndpointUrl = $"{scheme}://{svcSettingsFromFile.HostName}:{svcSettingsFromFile.Port}"; result.TlsCertificatePath = Path.Combine(serviceSettingsConfigDir, svcSettingsFromFile.TlsCertificate); result.SigningCertificatePath = Path.Combine(serviceSettingsConfigDir, svcSettingsFromFile.SigningCertificate); result.TlsCertificate = new X509Certificate2(result.TlsCertificatePath); result.SigningCertificate = new X509Certificate2(result.SigningCertificatePath); return(result); }
public static SetupServiceSettings FromStsSettings(StsSettings stsSettings) { var result = new SetupServiceSettings(); result.ServiceId = stsSettings.SolutionServiceId; result.OwnerId = stsSettings.SolutionOwnerId; return(result); }
public SsoSolutionUserRegistration( ILoggerFactory loggerFactory, SetupServiceSettings serviceSettings, SsoAdminClient ssoAdminClient) { if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } _logger = loggerFactory.CreateLogger(typeof(SsoSolutionUserRegistration).FullName); _serviceSettings = serviceSettings ?? throw new ArgumentNullException(nameof(serviceSettings)); _ssoAdminClient = ssoAdminClient ?? throw new ArgumentNullException(nameof(ssoAdminClient)); }
public LookupServiceRegistration( ILoggerFactory loggerFactory, SetupServiceSettings serviceSettings, LookupServiceClient lsClient) { if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } _logger = loggerFactory.CreateLogger(typeof(LookupServiceRegistration).FullName); _lsClient = lsClient ?? throw new ArgumentNullException(nameof(lsClient)); _serviceSettings = serviceSettings ?? throw new ArgumentNullException(nameof(serviceSettings)); }
public static SetupServiceSettings NewService( X509Certificate2 tlsCertificate, X509Certificate2 signingCertificate, string hostName, int port) { var result = new SetupServiceSettings(); result.NodeId = Guid.NewGuid().ToString(); result.OwnerId = $"srs-SolutionOwner-{Guid.NewGuid()}"; result.ServiceId = Guid.NewGuid().ToString(); result.TlsCertificate = tlsCertificate; result.SigningCertificate = signingCertificate; string scheme = "https"; result.EndpointUrl = $"{scheme}://{hostName}:{port}"; return(result); }