|
|
|
@ -184,6 +184,7 @@ public class AuthorizationController : Controller |
|
|
|
identity.SetClaim(Claims.Subject, await _userManager.GetUserIdAsync(user)) |
|
|
|
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user)) |
|
|
|
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray()); |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
@ -277,6 +278,7 @@ public class AuthorizationController : Controller |
|
|
|
identity.SetClaim(Claims.Subject, await _userManager.GetUserIdAsync(user)) |
|
|
|
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user)) |
|
|
|
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray()); |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
@ -371,6 +373,7 @@ public class AuthorizationController : Controller |
|
|
|
identity.SetClaim(Claims.Subject, await _userManager.GetUserIdAsync(user)) |
|
|
|
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user)) |
|
|
|
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray()); |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
@ -485,6 +488,7 @@ public class AuthorizationController : Controller |
|
|
|
identity.SetClaim(Claims.Subject, await _userManager.GetUserIdAsync(user)) |
|
|
|
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user)) |
|
|
|
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray()); |
|
|
|
|
|
|
|
// Note: in this sample, the granted scopes match the requested scope
|
|
|
|
@ -538,6 +542,7 @@ public class AuthorizationController : Controller |
|
|
|
identity.SetClaim(Claims.Subject, await _userManager.GetUserIdAsync(user)) |
|
|
|
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user)) |
|
|
|
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user)) |
|
|
|
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray()); |
|
|
|
|
|
|
|
identity.SetDestinations(GetDestinations); |
|
|
|
@ -558,7 +563,7 @@ public class AuthorizationController : Controller |
|
|
|
|
|
|
|
switch (claim.Type) |
|
|
|
{ |
|
|
|
case Claims.Name: |
|
|
|
case Claims.Name or Claims.PreferredUsername: |
|
|
|
yield return Destinations.AccessToken; |
|
|
|
|
|
|
|
if (claim.Subject.HasScope(Scopes.Profile)) |
|
|
|
|