Open vladak opened 6 years ago
Setting up authorization layer is described https://github.com/oracle/opengrok/wiki/Authorization Examples of using Ldap plugins is https://github.com/oracle/opengrok/tree/master/plugins
The ldap-plugin-config.xml
is a parameter of the ldap setup - it's not OpenGrok related file so you put it wherever you want.
<void method="put">
<string>configuration</string>
<string>/opengrok/auth/config/ldap-plugin-config.xml</string>
</void>
and these are the values you can change in the ldap-plugin-config.xml
- basically servers configuration https://github.com/oracle/opengrok/blob/master/plugins/src/opengrok/auth/plugin/configuration/Configuration.java.
maybe @vladak could provide some simple example of ldap-plugin-config.xml
for you
I have no idea about your setup. The LDAP authorization needs more than that.
Firstly, this https://github.com/oracle/opengrok/tree/master/plugins is just an example of using the plugins which might not match your environment.
Secondly, ldap-plugin-config.xml
- you need to create this file by hand - that's why I asked @vladak to provide an example.
Thirdly, you put the ldap-plugin-config.xml
to the location specified in read-only configuration for the authorization stack (again mentioned in https://github.com/oracle/opengrok/tree/master/plugins - ):
Snippet from the https://github.com/oracle/opengrok/tree/master/plugins
<void method="put">
<string>configuration</string>
<string>/opengrok/auth/config/ldap-plugin-config.xml</string>
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
<!-- this is where you put the file -->
</void>
The example of ldap-plugin-config.xml
is here https://github.com/oracle/opengrok/blob/master/plugins/sample-ldap-plugin-config.xml (nothing needed anymore @vladak)
When thinking about how to make LDAP searches done by the authorization plugins more efficient (also see #2283), I discovered that
LdapUserPlugin
can benefit from using the username as base.Specifically, if the
UserPlugin
fills theusername
of a user with DN that matches its node in the LDAP structure, it is not necessary to use the filter at all - certainly not filling the common name there asLdapUserPlugin#getFilter()
does.I.e. instead of passing
null
as a first argument tolookupLdapContent()
inLdapUserPlugin#fillSession()
, it will passuser
(which will then be used as a base) and the filter can be augmented based on that (to only contain thethis.objectClass
).This can be made a tunable of
UserLdapPlugin
- there are still cases when the search base cannot be based onUser
.