예제 #1
0
        private void ConfigureTenantOptions(IdentityOptions options, AegisTenant tenant)
        {
            var tenantKey = tenant.TenantKey;

            options.Cookies = new IdentityCookieOptions
            {
                ApplicationCookie = new CookieAuthenticationOptions
                {
                    AuthenticationScheme = tenant.AuthSchemeInternal,
                    CookieName           = tenant.AuthSchemeInternal,
                    SlidingExpiration    = tenant.CookieSlidingExpiration,
                    ExpireTimeSpan       = tenant.CookieLifetime
                },
                ExternalCookie = new CookieAuthenticationOptions
                {
                    AuthenticationScheme = tenant.AuthSchemeExternal,
                    CookieName           = tenant.AuthSchemeExternal,
                    SlidingExpiration    = tenant.CookieSlidingExpiration,
                    ExpireTimeSpan       = tenant.CookieLifetime
                }
            };

            options.Password.RequiredLength         = tenant.PasswordOptions.MinLength;
            options.Password.RequireDigit           = tenant.PasswordOptions.RequireDigit;
            options.Password.RequireLowercase       = tenant.PasswordOptions.RequireLower;
            options.Password.RequireNonAlphanumeric = tenant.PasswordOptions.RequireSpecial;
            options.Password.RequireUppercase       = tenant.PasswordOptions.RequireUpper;
        }
예제 #2
0
        public AegisTenantClientStore(IHttpContextAccessor httpContextAccessor)
        {
            if (httpContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(httpContextAccessor));
            }

            // just to be sure, we are in a tenant context
            var tenantContext = httpContextAccessor.HttpContext.GetTenantContext <AegisTenant>();

            if (tenantContext == null)
            {
                throw new ArgumentNullException(nameof(tenantContext));
            }

            _tenant = tenantContext.Tenant;
        }