diff --git a/src/Duende.Bff/EndpointServices/User/DefaultUserService.cs b/src/Duende.Bff/EndpointServices/User/DefaultUserService.cs index 105dbc32..01bff8b2 100644 --- a/src/Duende.Bff/EndpointServices/User/DefaultUserService.cs +++ b/src/Duende.Bff/EndpointServices/User/DefaultUserService.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Protocols.OpenIdConnect; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -71,8 +72,8 @@ public virtual async Task ProcessRequestAsync(HttpContext context) else { var claims = new List(); - claims.AddRange(GetUserClaims(result)); - claims.AddRange(GetManagementClaims(context, result)); + claims.AddRange(await GetUserClaimsAsync(result)); + claims.AddRange(await GetManagementClaimsAsync(context, result)); var json = JsonSerializer.Serialize(claims); @@ -89,9 +90,9 @@ public virtual async Task ProcessRequestAsync(HttpContext context) /// /// /// - protected virtual IEnumerable GetUserClaims(AuthenticateResult authenticateResult) + protected virtual ValueTask> GetUserClaimsAsync(AuthenticateResult authenticateResult) { - return authenticateResult.Principal?.Claims.Select(x => new ClaimRecord(x.Type, x.Value)) ?? Enumerable.Empty(); + return ValueTask.FromResult(authenticateResult.Principal?.Claims.Select(x => new ClaimRecord(x.Type, x.Value)) ?? Enumerable.Empty()); } /// @@ -100,7 +101,7 @@ protected virtual IEnumerable GetUserClaims(AuthenticateResult auth /// /// /// - protected virtual IEnumerable GetManagementClaims(HttpContext context, AuthenticateResult authenticateResult) + protected virtual ValueTask> GetManagementClaimsAsync(HttpContext context, AuthenticateResult authenticateResult) { var claims = new List(); @@ -131,7 +132,7 @@ protected virtual IEnumerable GetManagementClaims(HttpContext conte } } - return claims; + return ValueTask.FromResult(claims as IEnumerable); } ///