/// <summary> /// Generate the JWS payload for user information endpoint. /// If at least one claim is defined then returns the filtered resultKind /// Otherwise returns the default payload based on the scopes. /// </summary> /// <param name="claimsPrincipal"></param> /// <param name="authorizationParameter"></param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the async operation.</param> /// <returns></returns> private async Task <Option <JwtPayload> > GenerateUserInformationPayload( ClaimsPrincipal claimsPrincipal, AuthorizationParameter authorizationParameter, CancellationToken cancellationToken) { if (authorizationParameter.Claims != null && authorizationParameter.Claims.IsAnyUserInfoClaimParameter()) { return(_jwtGenerator.GenerateFilteredUserInfoPayload( authorizationParameter.Claims.UserInfo, claimsPrincipal, authorizationParameter)); } var payload = await _jwtGenerator.GenerateUserInfoPayloadForScope( claimsPrincipal, authorizationParameter, cancellationToken) .ConfigureAwait(false); return(new Option <JwtPayload> .Result(payload)); }