Wiki source code of Set Up a Groovy Authenticator in a Wiki Page
Last modified by Eleni Cojocariu-testing account on 2026/08/11 00:45
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | To authenticate through a script kept in a wiki page: | ||
| 2 | |||
| 3 | 1. Create a wiki page whose content is Groovy code returning an ##XWikiAuthService## object. | ||
| 4 | 1. Save that page as a user who has [[programming rights>>Documentation.AdminGuide.Access Rights.Permission types.WebHome||anchor="HProgrammingRight"]], since the code only runs while the page has them. | ||
| 5 | 1. Set the Groovy authenticator in the ##xwiki.cfg## file:((( | ||
| 6 | {{code language="properties"}} | ||
| 7 | xwiki.authentication.authclass=com.xpn.xwiki.user.impl.xwiki.GroovyAuthServiceImpl | ||
| 8 | {{/code}} | ||
| 9 | ))) | ||
| 10 | 1. Point the authenticator at the page holding the code:((( | ||
| 11 | {{code language="properties"}} | ||
| 12 | xwiki.authentication.groovy.pagename=MySpace.MyPage | ||
| 13 | {{/code}} | ||
| 14 | ))) | ||
| 15 | 1. Restart the wiki. | ||
| 16 | 1. Log in and check that your script decided the outcome; when it could not be used, the wiki logs "No page specified for auth service implementation" or a missing programming rights error instead. |