GWiki provide an own small solution to manage users.
This Howto describe how to make usage of other user managment systems.
The user managment implementation is implemented with the interface de.micromata.genome.gwiki.model.GWikiAuthorization.
The abstract class de.micromata.genome.gwiki.auth.GWikiAuthorizationBase provides basic mechanism.
The interface is designed to have no user object and operates only with strings as rights. You have to be able
to add new rights in your user management. See also GWiki Rights for the rights GWiki uses.
Something like user groups, roles (as a group of rights) should be a private detail of the user managment itself.
To create an Adapter to another&external User Managment, you have to implement an Class derived from GWikiAuthorizationBase.
Some important methods:
public boolean initThread(GWikiContext wikiContext)
public void clearThread(GWikiContext wikiContext);
will be called before and after executing a GWiki element.
You can use the method initThread f.e. to read user from session and set it into a thread local.
You also use the wikiContext.set/getRequestAttribute() or set/getSessionAttribute() to store your
user object in the wikiContext. This methods access directly underlying HttpServletRequest and HttpSession object,
so you can set this value in an own filter.
boolean isAllowTo(GWikiContext ctx, String right);
you have to test if an user exists (thread local or attribute, see above) and if true if
the user has given right.
public boolean login(GWikiContext ctx, String user, String password)
public void logout(GWikiContext ctx)
you only need to implement, if you use the gwiki login/logout dialog.
public <T> T runAsSu(GWikiContext wikiContext, CallableX<T, RuntimeException> callback)
public <T> T runAsUser(String user, GWikiContext wikiContext, CallableX<T, RuntimeException> callback)
are wrapper to safly running code with a given user.
In the implementation you have to change user before calling callback and after swich back to orignal user.
public Locale getCurrentUserLocale(GWikiContext ctx);
public String getCurrentUserEmail(GWikiContext ctx);
public String getCurrentUserName(GWikiContext ctx);
Provides specific information about the current user.
public String getUserProp(GWikiContext ctx, String key);
public void setUserProp(GWikiContext ctx, String key, String value, boolean persist);
stores and retrive general user related information. It is up to the implementation where to store these values - sessions, persistant cookies, database or somewhere in the gwiki storage.
For often used values and slow storage a caching mechanism should be provided.
After written your own MyAuthorization, the class has to be registered.
Therefore you have to modify the GWikiContext.xml. (See Understanding the GWikiContext.xml).
If your Authorization modul needs further information - like database information etc. - I recoment to configure this also via this Spring Context file and inject the values inside the MyAuthorization class.
The most simple way to remove the GWiki User Managment pages is just to edit them and give them a right, which nobody has.
The the corresponding menu items will dissapear.
The Logout and Login Pages are normal GWiki elements.
which can be replaced by own implemenation or redirects.
To edit this elements you have to search the pages via Admin / All Elements page.