identityserver4

How do I update my cookie, having got a new access_token?

孤街浪徒 提交于 2020-08-05 04:54:18
问题 Having used a refresh token to get a new access token, I want to update my client side cookie with that access token. My client is able to sign in and call my REST API using ajax, however when that first authorization expires, naturally the API calls no longer work. I have a .NET web application which consumes its own REST API. The API is a part of the same project. It does not have its own startup configuration. As the cookie is being sent in the header of each request it needs to have the

IdentityServer4使用EFCore生成MySql Column length too big for column 'Data' (max = 21845);

旧街凉风 提交于 2020-08-04 14:44:31
IdentityServer4中,使用efcore生成PersistedGrant数据库时报错,错误信息如下: Column length too big for column 'Data' (max = 21845); Column length too big for column 'Data' (max = 21845); use BLOB or TEXT instead 错误提示最大长度限制问题 查看生成结构代码 migrationBuilder.CreateTable( name: "DeviceCodes", columns: table => new { UserCode = table.Column<string>(maxLength: 200, nullable: false), DeviceCode = table.Column<string>(maxLength: 200, nullable: false), SubjectId = table.Column<string>(maxLength: 200, nullable: true), ClientId = table.Column<string>(maxLength: 200, nullable: false), CreationTime = table.Column<DateTime>(nullable

How to insert Identity Server 4 persisted ApiSecret values using T-SQL

孤街浪徒 提交于 2020-08-02 08:11:49
问题 I have been through the Identity Server 4 QuickStart for using Entity Framework for persistent storage of configuration and operational data. In the QuickStart, the ApiResources are loaded into the database in code. The Api secret is set with new ApiResource("api1", "My API") { ApiSecrets = { new Secret("secret".Sha256())} } in the ApiResource constructor. When, in Startup.InitializeDatabase, that ApiResource is added to the ConfigurationDbContext.ApiResources DbSet, foreach(var resource in

How to insert Identity Server 4 persisted ApiSecret values using T-SQL

别说谁变了你拦得住时间么 提交于 2020-08-02 08:11:14
问题 I have been through the Identity Server 4 QuickStart for using Entity Framework for persistent storage of configuration and operational data. In the QuickStart, the ApiResources are loaded into the database in code. The Api secret is set with new ApiResource("api1", "My API") { ApiSecrets = { new Secret("secret".Sha256())} } in the ApiResource constructor. When, in Startup.InitializeDatabase, that ApiResource is added to the ConfigurationDbContext.ApiResources DbSet, foreach(var resource in

How to insert Identity Server 4 persisted ApiSecret values using T-SQL

亡梦爱人 提交于 2020-08-02 08:08:59
问题 I have been through the Identity Server 4 QuickStart for using Entity Framework for persistent storage of configuration and operational data. In the QuickStart, the ApiResources are loaded into the database in code. The Api secret is set with new ApiResource("api1", "My API") { ApiSecrets = { new Secret("secret".Sha256())} } in the ApiResource constructor. When, in Startup.InitializeDatabase, that ApiResource is added to the ConfigurationDbContext.ApiResources DbSet, foreach(var resource in

Not able to enable CORS for identity server 4 in asp.net core

拜拜、爱过 提交于 2020-07-29 20:21:51
问题 Ok, I have added CORS policy for my dot net core APIs but somehow these CORS policies are not working for identity server 4 endpoints. I have following api where I try to register a user: [EnableCors("AllowAllCorsPolicy")] [Route("api/User")] public class UserController : Controller { private readonly UserManager<ApplicationUser> _userManager; private IUserServices _userService; public UserController(UserManager<ApplicationUser> userManager, IUserServices userService) { _userManager =

identityserver4 V4 新版本踩坑

点点圈 提交于 2020-07-29 10:52:03
identityserver4 的版本前段时间更新到V4,和之前的版本,还是有一些使用的差异; 1. API资源声明,之前版本用的是ApiResource,新版本用的是ApiScope,从名字就可以看出区别,新版是用 Scope 区分的; /// <summary> /// 新版本 /// </summary> public static IEnumerable<ApiScope> Apis => new List<ApiScope> { new ApiScope( " api1 " , "my api1 " ), }; /// <summary> /// 旧版本 /// </summary> public static IEnumerable<ApiResource> ApiScopes => new List<ApiResource> { new ApiResource( " api1 " , " my api1 " ), }; 2. 如果使用了IdentityServer4 的快速入门的登录等界面代码,这里也有好些要改的,我是测试项目直接赋值的新版的快速入门代码 3.因为API声明的地方做了修改,相应的在API的认证授权上也不一样 新版认证的时候不需要设置Audience 新版的Audience 是从 Claim 中获取的,需要添加对应的授权 // 新版API认证

使用Ocelot、IdentityServer4、Spring Cloud Eureka搭建微服务网关:Step by Step(二)

空扰寡人 提交于 2020-07-29 07:18:29
本文继续介绍使用Ocelot、IdentityServer4以及Spring Cloud Eureka搭建微服务网关的步骤。相关文章: 《 使用Ocelot、IdentityServer4、Spring Cloud Eureka搭建微服务网关:Step by Step(一) 》 Step 4:引入Ocelot API网关 新建一个ASP.NET Core API项目,添加对以下NuGet包的引用: Ocelot IdentityServer4 IdentityServer4.AccessTokenValidation Serilog(我使用了Serilog来输出格式化的日志,如果不使用Serilog,则不需要引用) 首先,修改Startup.cs文件,用来启用Ocelot,并指定身份认证机构为之前我们建好的IdentityServer服务: public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddAuthentication() .AddIdentityServerAuthentication("AuthProviderKey",

HttpContext is NULL when running web app in IIS

安稳与你 提交于 2020-07-28 20:30:13
问题 I have two application, both running on the same Windows machine. One application is IdentityServer4, and the other is my own web application (Server side Blazor app). Both web apps are build with .NET Core 3.1. When I navigate to my web app, I first get redirected to my IdentityServer4 app. I login, and after that I get redirected back to my web app. The login was successful, because there are no errors in the logs of IdentitServer. Also, I see a certain claim value on my Blazor webpage. I

HttpContext is NULL when running web app in IIS

自作多情 提交于 2020-07-28 20:25:22
问题 I have two application, both running on the same Windows machine. One application is IdentityServer4, and the other is my own web application (Server side Blazor app). Both web apps are build with .NET Core 3.1. When I navigate to my web app, I first get redirected to my IdentityServer4 app. I login, and after that I get redirected back to my web app. The login was successful, because there are no errors in the logs of IdentitServer. Also, I see a certain claim value on my Blazor webpage. I