Ejemplo n.º 1
0
        public void Configure(string name, JwtBearerOptions options)
        {
            // Console.WriteLine($"Before configure named options");
            var authority = _tenantProvider.GetCurrentTenant();

            options.Authority = authority;
            Console.WriteLine($"configured name - {name}");
            Console.WriteLine($"configured authority - {options.Authority}");
            Console.WriteLine($"configured authority hash - {options.Authority.GetHashCode()}");
        }
        public JwtBearerOptions Get(string name)
        {
            // Console.WriteLine($"Before options factory");
            var tenant = _tenantProvider.GetCurrentTenant();

            Lazy <JwtBearerOptions> Create() => new Lazy <JwtBearerOptions>(() => _optionsFactory.Create(name));

            var result = _cache.GetOrAdd((name, tenant), _ => Create()).Value;

            // var result = _optionsFactory.Create(name);
            // Console.WriteLine($"result.ClaimsIssuer = {result.ClaimsIssuer}");
            // Console.WriteLine($"result.Authority = {result.Authority}");
            // result.Authority = tenant;
            Console.WriteLine($"factory name = {name}");
            Console.WriteLine($"factory result.Authority = {result.Authority}");
            Console.WriteLine($"factory result.Authority hash - {result.Authority.GetHashCode()}");
            return(result);
        }