<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>User mandatory fields settings is ignored when auto-creating SSO users</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122214151" />
  <subtitle>User mandatory fields settings is ignored when auto-creating SSO users</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122214151</id>
  <updated>2026-04-05T23:46:14Z</updated>
  <dc:date>2026-04-05T23:46:14Z</dc:date>
  <entry>
    <title>RE: User mandatory fields settings is ignored when auto-creating SSO users</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122218180" />
    <author>
      <name>Jamie Sammons</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122218180</id>
    <updated>2023-11-07T16:09:50Z</updated>
    <published>2023-11-07T16:09:50Z</published>
    <summary type="html">&lt;p&gt;Bug report created: https://liferay.atlassian.net/browse/LPS-201078&lt;/p&gt;</summary>
    <dc:creator>Jamie Sammons</dc:creator>
    <dc:date>2023-11-07T16:09:50Z</dc:date>
  </entry>
  <entry>
    <title>User mandatory fields settings is ignored when auto-creating SSO users</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122214150" />
    <author>
      <name>Jan Tošovský</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122214150</id>
    <updated>2023-11-03T10:56:57Z</updated>
    <published>2023-11-03T10:56:54Z</published>
    <summary type="html">&lt;p&gt;The user's lastname field is mandatory by default, but it can be made
  optional by overriding the Language_en.properties:&lt;br&gt; lang.user.name.required.field.names=&lt;/p&gt;
&lt;p&gt;When a new user is created, the lastname field is validated this way:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;if (Validator.isNull(lastName) &amp;amp;&amp;amp;
        fullNameDefinition.isFieldRequired(&amp;quot;last-name&amp;quot;)) {
    throw new ContactNameException.MustHaveLastName();
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the lastname is null, it only throws an exception when the
  &amp;quot;last-name&amp;quot; value is listed in that
  lang.user.name.required.field.names property.&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;if (Validator.isNull(lastName)) {
  throw new OpenIdConnectServiceException.UserMappingException(
    &amp;quot;Last name is null&amp;quot;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the lastname can be optional, it should be taken into an account
  in all places.&lt;/p&gt;</summary>
    <dc:creator>Jan Tošovský</dc:creator>
    <dc:date>2023-11-03T10:56:54Z</dc:date>
  </entry>
</feed>
