identityserver4

Add claims in token from web api

风格不统一 提交于 2020-12-30 03:46:06
问题 I'm working on a project using IdentityServer4 and Identity and an API. The API is protected with IDS4. The API and IDS4 are on the same project, so I have 3 projects in my solutions: - A MVC web project that contains the IdentityServer and the API - An implementation of Identity that use MongoDB as database provider - A console application that simulate the client My client authenticate with IDS4, get the access_token and then call the api with the token. This part is working fine. Now i'm

IdentityServer4 PKCE error: “Transformed code verifier does not match code challenge”

早过忘川 提交于 2020-12-30 02:24:46
问题 I cannot get IdentityServer4 PKCE authorization to work using Postman. Using online tools I create the necessary parts: Choose a random string: 1234567890 Get its SHA-256 hash: c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646 Base64 encode the hash to get the code challenge: Yzc3NWU3Yjc1N2VkZTYzMGNkMGFhMTExM2JkMTAyNjYxYWIzODgyOWNhNTJhNjQyMmFiNzgyODYyZjI2ODY0Ng== In the browser I navigate to the following URL, fill in my credentials and retrieve the code from the fragmented

IdentityServer4 PKCE error: “Transformed code verifier does not match code challenge”

≯℡__Kan透↙ 提交于 2020-12-30 02:22:46
问题 I cannot get IdentityServer4 PKCE authorization to work using Postman. Using online tools I create the necessary parts: Choose a random string: 1234567890 Get its SHA-256 hash: c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646 Base64 encode the hash to get the code challenge: Yzc3NWU3Yjc1N2VkZTYzMGNkMGFhMTExM2JkMTAyNjYxYWIzODgyOWNhNTJhNjQyMmFiNzgyODYyZjI2ODY0Ng== In the browser I navigate to the following URL, fill in my credentials and retrieve the code from the fragmented

Angular-based login page for IdentityServer

流过昼夜 提交于 2020-12-29 06:50:52
问题 I'm developing a frontend app with angular and a backend with Asp.Net Core, which contains and IdentityServer4 for authentication (based on this github project). At the moment I'm logging in the IdentityServer's login page, but I want to use a custom login page developed in angular instead of using the IdentityServer's login page, instead using the login service of the AccountController. I can call this service via http request from Angular app, but I cannot obtain the access jwt token

Angular-based login page for IdentityServer

柔情痞子 提交于 2020-12-29 06:48:31
问题 I'm developing a frontend app with angular and a backend with Asp.Net Core, which contains and IdentityServer4 for authentication (based on this github project). At the moment I'm logging in the IdentityServer's login page, but I want to use a custom login page developed in angular instead of using the IdentityServer's login page, instead using the login service of the AccountController. I can call this service via http request from Angular app, but I cannot obtain the access jwt token

ASP.NET Core Web Api之JWT(一)

99封情书 提交于 2020-12-19 08:02:06
最近沉寂了一段,主要是上半年相当于休息和调整了一段时间,接下来我将开始陆续学习一些新的技能,比如Docker、Jenkins等,都会以生活实例从零开始讲解起,到时一并和大家分享和交流。接下来几节课的内容将会讲解JWT,关于JWT的原理解析等等大有文章,就不再叙述,这里我们讲解使用和一些注意的地方。 在.NET Core之前对于Web应用程序跟踪用户登录状态最普通的方式则是使用Cookie,当用户点击登录后将对其信息进行加密并响应写入到用户浏览器的Cookie里,当用户进行请求时,服务端将对Cookie进行解密,然后创建用户身份,整个过程都是那么顺其自然,但是这是客户端是基于浏览器的情况,如果是客户端是移动app或者桌面应用程序呢? 关于JWT原理可以参考系列文章https://www.cnblogs.com/RainingNight/p/jwtbearer-authentication-in-asp-net-core.html,当然这只是其中一种限制还有其他。 如果我们使用Json Web Token简称为JWT而不是使用Cookie,此时Token将代表用户,同时我们不再依赖浏览器的内置机制来处理Cookie,我们仅仅只需要请求一个Token就好。 这个时候就涉及到Token认证,那么什么是Token认证呢? 一言以蔽之: 将令牌

IdentityServer4 4.x版本 配置Scope的正确姿势

允我心安 提交于 2020-12-14 03:57:35
点击上方蓝字" 小黑在哪里 "关注我吧 前言 IdentityServer4 是为ASP.NET Core系列量身打造的一款基于 OpenID Connect 和 OAuth 2.0 认证的框架 IdentityServer4官方文档:https://identityserver4.readthedocs.io/ 看这篇文章前默认你对IdentityServer4 已经有一些了解。 本篇使用IdentityServer4的4.x版本,跟老版本的稍微有些差别。下面直接进入正题。 鉴权中心 创建IdentityServer4项目 使用IdentityServer4 来搭建一个鉴权中心,首先建议安装一下IdentityServer4的官方项目模板。也可以不安装,自己创建项目,然后NuGet安装需要的包也行。(不过还是推荐用官方的模板,很方便)。 命令行执行: dotnet new -i IdentityServer4.Templates image-20200629205619088 安装完成后会多出以下项目模板: image-20200629205731577 我这里选用is4inmem这个模板来创建项目,这个模板的数据都是写死在内存中的,并且包含了Quickstart页面,比较简单方便。 来到我的项目目录下执行: dotnet new is4inmem --name Idp

ApiResource vs ApiScope vs IdentityResource

青春壹個敷衍的年華 提交于 2020-12-13 03:33:46
问题 I've read the IdentityServer4 documentation but I can't understand what is the exact difference between these three concepts. (ApiResource vs ApiScope vs IdentityResource) 1- As it is said in the documentation, API Scope models an OAuth scope. and API Resource models an API resource. So what is the difference between the OAuth scope and API resource? 2- also, as I understand in this section of document , in AllowsScope of client definition in Identity server, we must add IdentityResources. So

How to authorize a Blazor WebAssembly SPA app using Identity Server

笑着哭i 提交于 2020-12-12 04:40:15
问题 I am writing a demo Blazor WebAssembly SPA technical demo app, but I have some problems with authentication. I'm going to use Identity Server to do the authorization but i can't find any libraries to support it. All the tutorials I found guided to use Blazor Server or add an ASP.net Core hosted, but it's not really make sense for my demo app. I am glad if anyone can help. Thank you 回答1: March 12th, 2020 To add OIDC to an existing Blazor WASM app using an existing OAuth identity provider read

How to authorize a Blazor WebAssembly SPA app using Identity Server

霸气de小男生 提交于 2020-12-12 04:38:32
问题 I am writing a demo Blazor WebAssembly SPA technical demo app, but I have some problems with authentication. I'm going to use Identity Server to do the authorization but i can't find any libraries to support it. All the tutorials I found guided to use Blazor Server or add an ASP.net Core hosted, but it's not really make sense for my demo app. I am glad if anyone can help. Thank you 回答1: March 12th, 2020 To add OIDC to an existing Blazor WASM app using an existing OAuth identity provider read