Ich folge diesem post, um IdentityServer4 zu implementieren. Ich habe ein Problem, das in ProfileService in der Prozedur GetProfileDataAsync IEnumerable context.RequestedClaimTypes leer ist. Soll ich meine Anfrage in Postman ändern, um bestimmte Reklamationstypen anzufordern? Was kann ich tun, damit context.RequestedClaimTypes Anspruchstypen enthält?So fordern Sie Anspruchstypen in IdentityServer4 an?
My Postman Anfrage sieht wie folgt aus:
Post http://localhost:57577/connect/token
Authorization: Basic Z2xvYmFsX2F...
Body (x-www-form-urlencoded):
username:[email protected]
password:pass
grant_type:password
scope:my_api
Das hat fast mein Problem gelöst. Name und E-Mail-Adresse stehen im Kontext zur Verfügung.RequestedClaimTypes, der Betreff ist jedoch immer noch nicht verfügbar. Ich habe JwtClaimTypes.Subject zu UserClaims hinzugefügt. Zu Scopes habe ich "my_api", "openid", "profile", "email" hinzugefügt. Im Client habe ich AllowedScopes hinzugefügt: "my_api", "openid", "profile", "email", "sub". In Postman enthält der Bereich "my_api openid profile email". – Uros
Der JwtClaimTypes.Subject ("sub") Anspruch wird standardmäßig in User.Claims in der API enthalten sein. – Uros