<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Nifi LDAP user login issue. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-LDAP-user-login-issue/m-p/376350#M242870</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105103"&gt;@mks27&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am reading through this post and see multiple conflicting output shared from you which imply config changes were applied between updates added to this post.&lt;BR /&gt;&lt;BR /&gt;First you need to understand that NiFi authentication and NiFi authorization are two totally separate processes.&amp;nbsp; After successful authentication is successful the user identity string is evaluated against any configured Identity mapping patterns configured in the nifi.properties file.&amp;nbsp; IF a java regex mapping pattern matches against the user identity string returned during authentication, the configured associated identity mapping value is applied.&amp;nbsp; &amp;nbsp;At this point the user identity string is passed off to the configured authorizer configured in NiFi to verify that the user is authorized for the request endpoint being accessed.&amp;nbsp; The authorizer must be aware of all user identity strings and those user must be authorized to the resource before a user will be authorized.&amp;nbsp; It is IMPORTANT to understand that NiFi is case sensitive (Identity bob and BOB would be treated as two different users).&lt;BR /&gt;&lt;BR /&gt;Your initial query you stated that the NiFi UI shows successful authentication, but indicates that authorization was then not successful.&amp;nbsp; We know this because it returned a user identity (determined during authentication) and then reported that user was not known to your NiFi during authorization verification.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Unknown user with identity 'cn=Mohit Kumar,ou=FM-Users,ou=Managed services,dc=CORP,dc=SA,dc=ZAIN,dc=COM'. Contact the system administrator.&lt;/LI-CODE&gt;&lt;P&gt;In your same post you shared the DN from your ldapsearch response as:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CN=Mohit Kumar,OU=FM-Users,OU=Managed services,DC=CORP,DC=SA,DC=ZAIN,DC=COM&lt;/LI-CODE&gt;&lt;P&gt;As we can see these do not match.&amp;nbsp; Regardless of above, what NiFi received in response to your authentication request from your ldap is what is displayed in the NiFiUI.&lt;BR /&gt;&lt;BR /&gt;Now, in a later post you shared the nifi-user.log output below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;023-05-23 02:53:37,220 INFO [NiFi Web Server-21] o.a.n.w.a.c.AccessDeniedExceptionMapper identity[mohit.kumar], groups[] does not have permission to access the requested resource. Unknown user with identity 'mohit.kumar'. Returning Forbidden response.&lt;/LI-CODE&gt;&lt;P&gt;This log line implies that a user was successfully authenticated with a user identity of "mohit.kumar".&amp;nbsp; This is not same user as shared in the initial post.&amp;nbsp; My guess here us that changed your ldap-provider from using:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Identity Strategy"&amp;gt;USE_DN&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;to:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Identity Strategy"&amp;gt;USE_USERNAME&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;The "USE_USERNAME" is more commonly used.&amp;nbsp; Upon successful authentication, the username entered at the NiFi login prompt is used as the user identity rather than the DN returned by ldap.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Or you setup some Identity.mapping.pattern that matched in your full DN, extracted just the CN and set it to all lowercase?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NiFi authorization is handled by the authorizers.xml NiFi configuration file.&lt;BR /&gt;In your authorizers.xml you have the "Managed authorizer" which has a configured dependency on the "File-Access-Policy-Provider" which itself has a configured dependency on "File-User-Group-Provider".&lt;BR /&gt;&lt;BR /&gt;The File-User-Group-Provider is responsible for building the users.xml file and populating it with a few initial entries.&amp;nbsp; This provider will ONLY generate a users.xml file if it does NOT already exist.&amp;nbsp; So any edits to this configuration after the users.xml file already exists will not be reflected in this file.&amp;nbsp; I see you have configured this provider to create the following user identity:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Initial User Identity 1"&amp;gt;CN=Mohit Kumar,OU=FM-Users,OU=Managed services,DC=CORP,DC=SA,DC=ZAIN,DC=COM&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;This Identity matches neither Identity mentioned earlier that resulted from successful authentication (remember that NiFi is case sensitive).&lt;/P&gt;&lt;P&gt;I would recommend changing this to the following and deleting the users.xml so it gets recreated:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Initial User Identity 1"&amp;gt;mohit.kumar&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Make sure you are also use "USE_USERNAME" in your ldap-provider.&lt;BR /&gt;&lt;BR /&gt;The File-Access-Policy-Provider is responsible for building the authorizations.xml file only if it does not already exist.&amp;nbsp; &amp;nbsp;Within this provider you defined who your initial admin user identity should be.&amp;nbsp; When building the authorizations.xml file for the first time, this initial admin user identity will be granted the authorization needed to act as an administrator.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Initial Admin Identity"&amp;gt;CN=Mohit Kumar,OU=FM-Users,OU=Managed services,DC=CORP,DC=SA,DC=ZAIN,DC=COM&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;This should be changed to below and current authorizations.xml (not authorizers.xml) must be deleted so it can be rebuild based on new initial admin:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;property name="Initial Admin Identity"&amp;gt;mohit.kumar&amp;lt;/property&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now restart your NiFi and login using "mohit.kumar" in the NiFi login window.&amp;nbsp; &lt;STRONG&gt;I should note that I am assuming here that "mohit.kumar" is your users sAMAccountName value in your LDAP entry.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 16:51:41 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2023-09-14T16:51:41Z</dc:date>
  </channel>
</rss>

