Cannot find customized authentication implementation class

1
0
-1

I am trying to use a customized authentication implementation on 7.2.2. However, I fail to open login page which gives me 500 error and say my implementation class does not exists.

Here are the steps of my work so far:
1) Implemented a new jar package with below code:
`package com.synale.BonitaAuthentication;

import java.io.Serializable;
import java.util.Map;

import org.bonitasoft.engine.authentication.AuthenticationConstants;
import org.bonitasoft.engine.authentication.AuthenticationException;
import org.bonitasoft.engine.authentication.GenericAuthenticationService;
import org.bonitasoft.engine.commons.LogUtil;
import org.bonitasoft.engine.identity.IdentityService;
import org.bonitasoft.engine.log.technical.TechnicalLogSeverity;
import org.bonitasoft.engine.log.technical.TechnicalLoggerService;

public class SimpleAuthenticationServiceImpl implements GenericAuthenticationService {

private final IdentityService identityService;

private final TechnicalLoggerService logger;

public SimpleAuthenticationServiceImpl(final IdentityService identityService, final TechnicalLoggerService logger) {
    this.identityService = identityService;
    this.logger = logger;
}

public String checkUserCredentials(Map<String, Serializable> credentials) throws AuthenticationException {
    // TODO Auto-generated method stub
    final String methodName = "checkUserCredentials";
    try {
        final String password = String.valueOf(credentials.get(AuthenticationConstants.BASIC_PASSWORD));
        final String userName = String.valueOf(credentials.get(AuthenticationConstants.BASIC_USERNAME));
        if(userName.equals(password))
            return userName;
    } catch (final Exception sunfe) {
        if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) {
            logger.log(this.getClass(), TechnicalLogSeverity.TRACE, LogUtil.getLogOnExceptionMethod(this.getClass(), methodName, sunfe));
        }
    }
    return null;
}

}
`

2) Copy compiled jar file to /webapps/bonita/WEB-INF/lib

3) Updated auth.AuthenticationManager in configuration file /client/tenants/1/conf/authenticationManager-config.properties, and give the class name "com.synale.BonitaAuthentication.SimpleAuthenticationServiceImpl"

4) Updated "<bean id="authenticationService">" in configuration file /engine-server/work/tenants/1/bonita-tenant-community.xml, and bind to class "com.synale.BonitaAuthentication.SimpleAuthenticationServiceImpl"

May I know what else are still missing?

1 answer

1
0
-1

Ok...now I know what is not done correctly...

Basically, step 3 is not required.

After I reverted step 3 back, and keep other changes, now this customized authentication implementation works fine.

Notifications