Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: User mandatory fields settings is ignored when auto-creating SSO users
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.
Bug report created: https://liferay.atlassian.net/browse/LPS-201078
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™