RE: User mandatory fields settings is ignored when auto-creating SSO users

Jan Tošovský, modified 1 Year ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts

The user's lastname field is mandatory by default, but it can be made optional by overriding the Language_en.properties:
lang.user.name.required.field.names=

When a new user is created, the lastname field is validated this way:

if (Validator.isNull(lastName) &&
        fullNameDefinition.isFieldRequired("last-name")) {
    throw new ContactNameException.MustHaveLastName();
}

If the lastname is null, it only throws an exception when the "last-name" value is listed in that lang.user.name.required.field.names property.

However, when the user is auto-created based on the UserInfo endpoint of the Identity Provider upon logging via SSO for the first time, a similar logic is missing:

if (Validator.isNull(lastName)) {
  throw new OpenIdConnectServiceException.UserMappingException(
    "Last name is null");
}

If the lastname can be optional, it should be taken into an account in all places.

thumbnail
Jamie Sammons, modified 1 Year ago. Expert Posts: 367 Join Date: 9/5/14 Recent Posts

Bug report created: https://liferay.atlassian.net/browse/LPS-201078