Fix parsing of displayName
Currently, we only have one field for the name. The first part is first name. The rest is last name. Obviously, this won't work in all cases but is the best we can do for the moment.
This commit is contained in:
@@ -648,17 +648,17 @@ async function claims(userId/*, use, scope*/) {
|
||||
if (error) return { error: 'user not found' };
|
||||
|
||||
const displayName = user.displayName || user.username || ''; // displayName can be empty and username can be null
|
||||
const nameParts = displayName.split(' ');
|
||||
const firstName = nameParts[0];
|
||||
const lastName = nameParts.length > 1 ? nameParts[nameParts.length - 1] : ''; // choose last part, if it exists
|
||||
const { firstName, lastName, middleName } = users.parseDisplayName(displayName);
|
||||
|
||||
const { fqdn:dashboardFqdn } = await dashboard.getLocation();
|
||||
|
||||
// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
|
||||
const claims = {
|
||||
sub: user.username, // it is essential to always return a sub claim
|
||||
email: user.email,
|
||||
email_verified: true,
|
||||
family_name: lastName,
|
||||
middle_name: middleName,
|
||||
given_name: firstName,
|
||||
locale: 'en-US',
|
||||
name: user.displayName,
|
||||
|
||||
Reference in New Issue
Block a user