The whole documentation mentions never to use ssoadm to register the custom authentication module and uses the AMPlugin framework to register the new authentication module. However there are a few issues that is incomplete in this
a) After the custom module is installed using the onInstall (as in the samples), the module cannot be uninstalled. There is no explicit lifecyle to clean this up. Although the JAR can be removed, there remains residual in the LDAP registry
b) Due to (a), even if the whole custom auth module is removed and many restart done and if a old plugin is replaces, there will be no changes made as the old registry values exist. The old registry can be removed with ssodm delete-svcs BUT this is of no helps. Doing so makes matter worst and the custom auth module will never appear in the selection
c) The issue inn (b) is cause by the amPluginService registry holding to registry. So this is also indicating we have no way to remove this to start afresh.
d) So for (b) and (c), one may think that maybe we use AmPlugin method upgrade(String fromVersion) to do the update of the service registry. This is itself no good as there's lack of API to do this The lacking portion
i) No error handling in upgrade (what if we throw Exception) and it affect other
ii) We cannot install the same service twice (like using the method used in onInstall()) so doing so seems like we need some internal API to cleanup things.
[(d) is probably and RFE but just to indicate this is not easy to workaround this like that]
A initial erroneous Sample Auth module may cause very hard to reason to correct things as the configuration will persists until ssoadm is used to delete things. However the PluginRegistry entry is still there (this may prevent later AMPlugin to run even if the custom auth service is gone).
- Use the custom authentication sample. But before deploy say remove the resourceName from attributes iPlanetAMAuthSampleAuthService. This is to generated a broken sample auth
- Deploy this and restart and see adding this custom sample auth module surely this should fails
- Now remove the old custom module and use the corrected one.
- Check if this works now. (Currently: it seems the old config is used)
- Remove using ssoadm delete-svc -s iPlanetAMAuthSampleAuthService to cleanup the module
- Restart and see if this custom module deploys or not
- (Currently: it seems that the custom module is no longer in the choice to select and so it means the new custom module is not registered)
It seems that ssoadm create-svc -X amAuthSampleAuth.xml will correct this but then it opposite to what the installation guides says not to do
1. We can delete-svc and create-svc for using ssoadm to correct any failing service config
2. If we still want to start afresh, then for the sample, on top of removing the custom authentication use ldap to remove the dn: ou=<module>,ou=plugins,ou=default,ou=GlobalConfig,ou=1.0,ou=amPluginService,ou=services,dc=openam,dc=forgerock,dc=org and restart all servers. Then the AMPlugin should then work to install the custom auth module again
AMPlugin and the PluginLifeCycle lacks the part to uninstall. Also there is not much support to uninstall plugins using the provided API. (and there not much error handling – eg: What happens if we throw excecption ...)