Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            #region 内存方式
            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddInMemoryApiResources(OAuthMemoryData.GetApiResources())
            .AddInMemoryClients(OAuthMemoryData.GetClients())
            .AddTestUsers(OAuthMemoryData.GetTestUsers());
            #endregion

            #region 数据库存储方式
            //services.AddIdentityServer()
            //    .AddDeveloperSigningCredential()
            //    .AddInMemoryApiResources(OAuthMemoryData.GetApiResources())
            //    //.AddInMemoryClients(OAuthMemoryData.GetClients())
            //    .AddClientStore<ClientStore>()
            //    .AddResourceOwnerValidator<ResourceOwnerPasswordValidator>();
            #endregion

            #region 单点登录方式 Demo

            #endregion
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });


            #region 内存方式
            //services.AddIdentityServer()
            //    .AddDeveloperSigningCredential()
            //    .AddInMemoryApiResources(OAuthMemoryData.GetApiResources())
            //    .AddInMemoryClients(OAuthMemoryData.GetClients())
            //    .AddTestUsers(OAuthMemoryData.GetTestUsers());
            #endregion

            #region 数据库存储方式
            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddInMemoryApiResources(OAuthMemoryData.GetApiResources())
            //.AddInMemoryClients(OAuthMemoryData.GetClients())
            .AddClientStore <ClientStore>()
            .AddResourceOwnerValidator <ResourceOwnerPasswordValidator>()
            .AddExtensionGrantValidator <WeiXinOpenGrantValidator>();   //添加微信端自定义方式的验证
            #endregion

            #region 单点登录方式 Demo

            #endregion
        }