AdaptiveConsulting / nexus-casc-plugin

Configuration as code plugin for Sonatype Nexus Repository Manager
MIT License
48 stars 21 forks source link

Add support for LDAP configuration #15

Open goober opened 3 years ago

goober commented 3 years ago

What I can read out from the documentation there is currently no support for configuring LDAP settings through this plugin.

I am happy to help out if I get some initial guidelines on how to attack the problem.

bdellegrazie commented 3 years ago

Hi @goober,

Partial support is there - we can enable / disable realms however the individual configuration of the realms is not yet supported that I can see.

Need to look at how these are created / managed in Nexus OSS to determine how to add the config for the specific realms. Frequently I look at how the underlying REST API does it - then follow the code until I reach the underlying API.

Essentially the Config object tree in this code mirrors the configuration properties of the objects in Nexus. Most (but not all) of which are generalised map properties going to the Orient DB. All I really do is model the config in yaml, translate it to an object form and "map" it back to the API available in Nexus.

I hope that helps - freel free to ask more questions

bdellegrazie commented 3 years ago

Taking a quick look at nexus-public repo - their LDAP plugin is not available in the repo itself, which makes debugging difficult. You could try using the rest interface and tracing the calls down but you're on your own - we'd need to look up the name of the managing interface by reflection and that's getting a bit convoluted.

Wonno commented 3 years ago

Tried to give it a start by grabbing the necessary dependenies. See branch Please note: the build process is slightly changed: run mvn -Pprepare validate in advance of regular maven build.

Integration test started failing after adapting Config.java in order to get the values from the yaml.

Currently I have no idea why this is failing. Maybe karaf config is missing - and I am not familiar with OSGI. Maybe someone can give advice.

bdellegrazie commented 3 years ago

@Wonno Thanks for this. Our config object uses lists and/or maps of base types to map easily to YAML. I realise its just a start but you've tightly coupled their internal persistence layer to our config object which we shouldn't really do.

The properties objects we supply are fed to the configuration functions in Nexus which then persists them to OrientDB. I'd prefer not to rely/depend upon their internal object as that may change but they do keep the config structure consistent between versions (usually).

It's an absolute pain getting this structure and I appreciate you getting as far as you did. I'll take a look sometime soon.

Wonno commented 3 years ago

I'd prefer not to rely/depend upon their internal object

Then lets go on with a mapper.