AuthService Backport

Version 8.2 by Thomas Mortagne on 2023/03/13 11:23

cogAllow adding support for component based authenticator in XWiki versions older than 15.3
Type
CategoryApplication
Developed by

Thomas Mortagne

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

The point of this extension is to make it easier to switch from one authenticator to another without restarting.

The system is based on a component implemented by authenticators. The can also provide a display name and description.

LDAPAuthService.png

Have your authenticator appear in AuthService Application after it's installed

To see your authenticator listed and allow switching it at runtime, you should:

  • add a dependency on authservice-backport-api:

        <dependency>
         <groupId>org.xwiki.contrib</groupId>
         <artifactId>authservice-backport-api</artifactId>
         <version>1.0.0</version>
       </dependency>
  • implement component org.xwiki.security.authservice.XWikiAuthServiceComponent, for existing authenticators the easiest is generally to extend the org.xwiki.security.authservice.AbstractXWikiAuthServiceWrapper helper:

    @Component
    @Named(LDAPAuthService.ID)
    public class LDAPAuthService extends AbstractXWikiAuthServiceWrapper implements XWikiAuthServiceComponent
    {
       public static final String ID = "ldap";

       /**
         * Wrap a {@link XWikiLDAPAuthServiceImpl} instance.
         */

       public LDAPAuthService()
       {
           super(new XWikiLDAPAuthServiceImpl());
       }

       @Override
       public String getId()
       {
           return ID;
       }
    }
  • provide translation for the authenticator display name and description following the formats
    security.authservice.service.<id>.name
    and security.authservice.service.<id>.description as in:

    security.authservice.service.ldap.name=LDAP Authenticator
    security.authservice.service.ldap.description=Authenticate using LDAP protocol

Get Connected