Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            IdentityCenterOptions options = Configuration.GetSection("IdentityCenter").Get <IdentityCenterOptions>();

            services.AddAutoMapper();
            services.AddIdentityCenter(Configuration.GetSection("IdentityCenter"));
            //配置Orleans客户端
            services.AddOrleansClient(build =>
            {
                build.AddClient(Configuration.GetSection("OrleansClient:Identity"), b =>
                {
                    var c = Configuration.GetSection("OrleansClient:Identity").Get <OrleansClientOptions>();
                    b.UseConsulClustering((ConsulClusteringClientOptions opt) =>
                    {
                        opt.Address = new Uri(c.ConsulAddress);
                    });
                });
            });
            //配置IdentityServer
            services.AddIdentityServer(opt =>
            {
                opt.Caching.ClientStoreExpiration   = TimeSpan.FromMinutes(30);
                opt.Caching.ResourceStoreExpiration = TimeSpan.FromHours(2);
                opt.Caching.CorsExpiration          = TimeSpan.FromHours(1);
            })
            .AddIdentityServiceStore()
            .AddConfigurationStoreCache()
            .AddSigningCredential(options.SigningCredentialRsa);
            services.AddSession();
            services.AddMvc();
        }
Example #2
0
 public AccountService(IOrleansClient client, ILogger <AccountService> logger, IIdentityServerInteractionService interaction,
                       IEventService events, IOptions <IdentityCenterOptions> options,
                       IHttpContextAccessor httpContextAccessor)
 {
     this.client              = client;
     this.logger              = logger;
     this.interaction         = interaction;
     this.events              = events;
     this.httpContextAccessor = httpContextAccessor;
     this.options             = options?.Value;
 }