identityserver4

ASP.NET Core微服务框架Ocelot+Consul+IdentityServer4实战演练

孤街浪徒 提交于 2020-04-07 10:23:21
一、背景介绍 API网关的流行源于最近几年移动应用与企业间接口对接的兴起,使得原来单一的PC客户端,变化到PC客户端、各种浏览器、手机移动端及智能终端等。同时系统之间大部分都不是单独运行,经常会涉及与其他系统对接、共享数据的需求。随着微服务架构概念的提出,API网关成为了微服务架构的一个标配组件。随着业务快速发展,面向手机移动应用业务越来越多,为了减少客户端与服务的耦合,节约后端微服务的开发成本,建立一个高性能、高可用、减少上线风险的API网关成为一个迫切的需求。 1)、目前面临现状:假设你正好是一个后端开发,而老板又刚好让你开发网站,其中需要涉及到很多后端的微服务,比如会员、商品、推荐服务等等。那么这里就会遇到一个问题,APP/Browser怎么去访问这些后端的服务?如果业务比较简单的话,可以给每个业务都分配一个独立的域名(https://service.api.company.com),但这种方式会有几个问题:每个业务都会需要鉴权、限流、权限校验等逻辑,如果每个业务都各自为战,自己造轮子实现一遍,会很麻烦,完全可以抽出来,放到一个统一的地方去做。 2)、有效的解决办法:更好的方式是采用API网关,实现一个API网关接管所有的入口流量,类似Nginx的作用,将所有用户的请求转发给后端的服务器,但网关做的不仅仅只是简单的转发,也会针对流量做一些扩展。比如鉴权、限流、权限、熔断

Using Client Credentials flow on identityserver4 and custom AuthorizationHandler User.Identity.isAuthenticated = false

若如初见. 提交于 2020-03-24 09:44:26
问题 Hi i am using identity server 4 and i created a client which is protected using client_credentials I am able to retrieve a token using the clientid and secret, and according to jwt.io the expiry of the access token is 3600 seconds or (1 hour) on the net core 2.2 api i have a custom AuthorizationHandler protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ClientCredentialRequirement requirement) { if (requirement.AllowedClients != null && requirement

IdentityServer4 - sub claim is missing

二次信任 提交于 2020-03-22 08:05:32
问题 I've got an IdentityServer4 instance that I'm trying to get running in a Docker container behind an nginx proxy. I've based it on the AspNet identity sample from the Git repo, but after a user successfully registers a new account I get "An error occurred" from IdentityServer and the logs show [07:46:39 ERR] An unhandled exception has occurred: sub claim is missing System.InvalidOperationException: sub claim is missing at IdentityServer4.IdentityServerPrincipal.AssertRequiredClaims

Iframe wont respect login cookies

China☆狼群 提交于 2020-03-21 12:07:19
问题 I have a very strange issue that i have been trying to debug for more then a week now. I am out of ideas as to what the problem could be. I am hoping someone here may have run into this same problem before and be able to give me an idea what the issue could be and how to fix it. I a asp .net core 2.0 application. It runs fine when hosted stand alone. Main controller requires authentication. Logs into Identity server 4. (hybrid granttype) Returns to application fetches data and displays it.

Iframe wont respect login cookies

心已入冬 提交于 2020-03-21 12:07:08
问题 I have a very strange issue that i have been trying to debug for more then a week now. I am out of ideas as to what the problem could be. I am hoping someone here may have run into this same problem before and be able to give me an idea what the issue could be and how to fix it. I a asp .net core 2.0 application. It runs fine when hosted stand alone. Main controller requires authentication. Logs into Identity server 4. (hybrid granttype) Returns to application fetches data and displays it.

IdentityServer Session cookie is not sliding

余生长醉 提交于 2020-03-05 05:38:45
问题 I am facing a weird problem. I am able to do the silent renew, but my IdP cookie is getting sliding. More into the problem... I have an IdP session cookie (IdentityServer) lifetime set to expire in 15 minutes and I kept the same time for the access token and id token lifetime too. On my JavaScript client, I check user activity every 2 minutes and if there is activity in the last 2 min, I will renew the token. I am able to get the access token and id token with renewed expiration times, but

Oauth2 with Postman and IdentityServer4

孤街醉人 提交于 2020-03-03 07:48:48
问题 This bounty has ended . Answers to this question are eligible for a +250 reputation bounty. Bounty grace period ends in 8 hours . Bastien Vandamme wants to draw more attention to this question: I need help on this one. Is there people fro Postman community that can help? I'm trying to register authenticate with Postman on my Identity Server 4. It worked with .Net Code 2 but I recently updated to .Net Core 3 and did adaptations. I can open my login page, I can login but then I'm not redirected

Oauth2 with Postman and IdentityServer4

纵然是瞬间 提交于 2020-03-03 07:48:11
问题 This bounty has ended . Answers to this question are eligible for a +250 reputation bounty. Bounty grace period ends in 8 hours . Bastien Vandamme wants to draw more attention to this question: I need help on this one. Is there people fro Postman community that can help? I'm trying to register authenticate with Postman on my Identity Server 4. It worked with .Net Code 2 but I recently updated to .Net Core 3 and did adaptations. I can open my login page, I can login but then I'm not redirected

Upgrading IdentityServer4 to Core 3.1 - tokens are suddenly not signed correctly?

。_饼干妹妹 提交于 2020-02-26 04:03:07
问题 We encountered an error while upgrading IdentityServer4 (2.5.3 - 3.1.0) to Core 3.1 (from 2.2). Suddenly tokens that are issued doesn't have the correct signature. We haven't changed the signing algorithm; still using the same .PFX-certificate between versions. var idSrvBuilder = services.AddIdentityServer(opts => { opts.Events.RaiseErrorEvents = true; opts.Events.RaiseFailureEvents = true; opts.Events.RaiseInformationEvents = true; opts.Events.RaiseSuccessEvents = true; if (_env.IsProduction

Passing additional data with reference tokens in Identity Server 4

放肆的年华 提交于 2020-02-16 07:50:36
问题 I am using reference tokens on my Identity Server and want to pass some additional data to the client. I know how to do this with a JWT by setting claims in my Profile Service but I can't find a way to do something similar with reference tokens. Ideally I would like to pass my data as an extra parameter in the token json result like so: { "access_token": "...", "expires_in": 3600, "token_type": "Bearer", "scope": "api1", "custom_property": "custom value" } 回答1: You can implement (and register