예제 #1
0
        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);
        }
예제 #2
0
        public static SetupServiceSettings FromStsSettings(StsSettings stsSettings)
        {
            var result = new SetupServiceSettings();

            result.ServiceId = stsSettings.SolutionServiceId;
            result.OwnerId   = stsSettings.SolutionOwnerId;
            return(result);
        }
예제 #3
0
 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));
 }
예제 #4
0
 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));
 }
예제 #5
0
        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);
        }