From e268b5e7be3332ad7dd2a9b4adf66e5e239a98ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Wed, 2 Dec 2015 01:03:11 +0100 Subject: [PATCH] Add explicit claim destinations --- src/OpenIddict.Core/OpenIddictProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenIddict.Core/OpenIddictProvider.cs b/src/OpenIddict.Core/OpenIddictProvider.cs index 4074227a..4c264e3e 100644 --- a/src/OpenIddict.Core/OpenIddictProvider.cs +++ b/src/OpenIddict.Core/OpenIddictProvider.cs @@ -256,7 +256,7 @@ namespace OpenIddict { } var identity = new ClaimsIdentity(context.Options.AuthenticationScheme); - identity.AddClaim(ClaimTypes.NameIdentifier, await manager.GetUserIdAsync(user)); + identity.AddClaim(ClaimTypes.NameIdentifier, await manager.GetUserIdAsync(user), destination: "id_token token"); // Only add the name claim if the "profile" scope was present in the authorization request. // Note: filtering the username is not needed at this stage as OpenIddictController.Accept @@ -341,8 +341,8 @@ namespace OpenIddict { Debug.Assert(application != null); var identity = new ClaimsIdentity(context.Options.AuthenticationScheme); - identity.AddClaim(ClaimTypes.NameIdentifier, context.ClientId); - identity.AddClaim(ClaimTypes.Name, await manager.GetDisplayNameAsync(application)); + identity.AddClaim(ClaimTypes.NameIdentifier, context.ClientId, destination: "id_token token"); + identity.AddClaim(ClaimTypes.Name, await manager.GetDisplayNameAsync(application), destination: "id_token token"); context.Validate(new ClaimsPrincipal(identity)); } @@ -393,7 +393,7 @@ namespace OpenIddict { } var identity = new ClaimsIdentity(context.Options.AuthenticationScheme); - identity.AddClaim(ClaimTypes.NameIdentifier, await manager.GetUserIdAsync(user)); + identity.AddClaim(ClaimTypes.NameIdentifier, await manager.GetUserIdAsync(user), destination: "id_token token"); // Resolve the username and the email address associated with the user. var username = await manager.GetUserNameAsync(user);