Esempio n. 1
0
        public Startup(IConfiguration configuration, IWebHostEnvironment environment)
        {
            IdentityModelEventSource.ShowPII = true;
            _configuration = configuration;
            _environment   = environment;

            _databaseOptions = new DatabaseOptions();
            _configuration.GetSection("ConnectionStrings").Bind(_databaseOptions);

            _authenticationServerConfiguration = new AuthenticationServerConfiguration();
            _configuration.GetSection("AuthenticationServer").Bind(_authenticationServerConfiguration);
        }
        public AuthenticationHelper(AuthenticationServerConfiguration authenticationServerConfiguration)
        {
            _authenticationServerConfiguration = authenticationServerConfiguration;

            _passwordHashLock = new object();
            _sha250Managed    = new SHA256Managed();

            _memcachedExpiryTimeSpan = _authenticationServerConfiguration.Cache_MemcachedExpiryMinutes > 0 ? (TimeSpan?)TimeSpan.FromMinutes(_authenticationServerConfiguration.Cache_MemcachedExpiryMinutes) : null;

            _jwtSecurityTokenHandler = new JwtSecurityTokenHandler();

            var certAndKeyInfo = CertHelper.GetCertAndKeyInfoFromDisk(_authenticationServerConfiguration.AuthCertificatesRoot, DEFAULT_CERTIFICATE_NAME, true);

            SigningCertificate = certAndKeyInfo.AppASCIIArmoredX509Certificate;
            SigningCredentials = new X509SigningCredentials(certAndKeyInfo.Certificate);
        }
Esempio n. 3
0
        public static UnityContainer GetContainer()
        {
            try
            {
                UnityContainer container = new UnityContainer();

                //get configuration from etcd
                var authenticationServerConfiguration = new AuthenticationServerConfiguration();

                //configuration
                container.RegisterInstance <AuthenticationServerConfiguration>(authenticationServerConfiguration);

                //authentication
                container.RegisterType <IAuthenticationHelper, AuthenticationHelper>(new ContainerControlledLifetimeManager());

                return(container);
            }
            catch (Exception ex)
            {
                Serilog.Log.Error(ex, "Exception in UnityHelper.GetContainer");
                throw;
            }
        }
Esempio n. 4
0
 public JWTAuthenticateController(AuthenticationServerConfiguration authenticationServerConfiguration, IAuthenticationHelper authenticationHelper)
 {
     _authenticationServerConfiguration = authenticationServerConfiguration;
     _authenticationHelper    = authenticationHelper;
     _jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
 }
 public CertificateController(AuthenticationServerConfiguration authenticationServerConfiguration)
 {
     _authenticationServerConfiguration = authenticationServerConfiguration;
 }
Esempio n. 6
0
 public BasicAuthenticateController(AuthenticationServerConfiguration authenticationServerConfiguration, IAuthenticationHelper authenticationHelper)
 {
     _authenticationServerConfiguration = authenticationServerConfiguration;
     _authenticationHelper = authenticationHelper;
 }