Custom config for deploying plugins

Is there a way to have an external xml configuration file for plugins? I followed the guide here: http://doc.nuxeo.com/display/Studio/Deploy+your+plugin+manually and deployed my plugin just fine with the xml config inside the jar file, but this doesn't help me much if I need to change config parameters based on where I'm deploying. (I created a new authentication plugin that needs a config parameter pointing towards our login api, which might be different depending on the install).

Thanks

If anyone is looking for this answer later I figured it out finally: thank you guys for your help!

Answer: The authentication plugin also used an authentication chain which needed to be extended in the jar file while the xml contribution for the authenticator could exist externally.

In the plugin jar at OSGI-INF/extensions/nameofmyauthenticator.xml

<?xml version="1.0"?>
<component name="com.ikanow.infinit.e.nuxeo.auth.MyAuthenticator">

  <extension
      target="org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService"
      point="chain">
      <authenticationChain>
        <plugins>           
            <plugin>MY_AUTH</plugin>
            <plugin>FORM_AUTH</plugin>
        </plugins>
      </authenticationChain>
    </extension>

    <extension 
        target="org.nuxeo.ecm.platform.login.LoginPluginRegistry"
        point="plugin">
            <LoginPlugin name="MyLoginPlugin"
                class="com.my.MyLoginPlugin">
                <enabled>true</enabled>
            </LoginPlugin>
    </extension>
</component>

Then externally place the contrib for the authenticator only in NUXEOINSTALL/nxserver/config/my-auth-config.xml (named XXX-config.xml as stated by Florent (thanks!))

<?xml version="1.0"?>
<component name="com.ikanow.infinit.e.nuxeo.auth.MyAuthenticatorConfig">    

    <require>org.nuxeo.ecm.platform.ui.web.auth.defaultConfig</require>

   <extension
      target="org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService"
      point="authenticators">
      <authenticationPlugin 
            name="MY_AUTH"
            enabled="true"
            class="com.my.MyAuthenticator">
       <loginModulePlugin>MyLoginPlugin</loginModulePlugin>
       <parameters>
         <parameter name="MyLoginURL">http://www.my.com/</parameter>
         <parameter name="MyAPIURL">http://www.my.com/api/</parameter>
       </parameters>
      </authenticationPlugin>
  </extension>          
</component>

I was trying to place all the extension point information (login plugin and authentication chain) outside in the /config folder. It would load my extension but not implement the authentication chain so I was still receiving some log messages about my authenticator initializing but it wasn't being used when going to nuxeo. By just putting the authenticator contribution out there, it started working properly.

Thanks for the help everyone, hopefully this helps someone in the future.

0 votes

2 answers

1578 views

ANSWER



These pages might help you to find the information you need. They have been very helpful resources for me.

http://doc.nuxeo.com/display/NXDOC56/Customization+and+Development

or if you are using the Fast Track version

http://doc.nuxeo.com/display/NXDOC/Customization+and+Development

as well as this page.

http://doc.nuxeo.com/display/NXDOC56/How-to+contribute+a+simple+configuration+in+Nuxeo

Hope that helps!

1 votes



You can put your contribution files inside nxserver/config with a name ending in -config.xml.

1 votes



Thanks for the quick response, I moved my contribution xml out into /config (with a -config.xml name). It loads up my components because I can see the log messages from initialization but it doesn't seem to be using my Authentication chain (it doesn't call my authenticator). Do you have an example of what should still go in my jar file or should I not just toss the entire xml file out?
07/30/2013