Commit d28442df authored by Marco Descher's avatar Marco Descher

[9918] Remove IExternalLoginService

parent 08e81a56
Pipeline #12488 failed with stages
in 1 minute and 16 seconds
package ch.elexis.core.services;
import javax.security.auth.login.LoginException;
import ch.elexis.core.model.IUser;
public interface IExternalLoginService {
/**
* Returns the {@link IUser} after an external login or {@link LoginException} if the login
* fails
*
* @param username
* @param password
* @return
* @throws LoginException
*/
public IUser login(String username, char[] password) throws LoginException;
}
package ch.elexis.data.service.internal;
import javax.security.auth.login.LoginException;
import org.osgi.service.component.annotations.Component;
import ch.elexis.core.model.IUser;
import ch.elexis.core.model.RoleConstants;
import ch.elexis.core.services.IExternalLoginService;
@Component
public class CsvLoginService implements IExternalLoginService {
private String[] rows;
public void initCsvRows(String defaultContanctId){
rows = new String[] {
"sazgin1:password:" + defaultContanctId + ":" + RoleConstants.SYSTEMROLE_LITERAL_USER
+ "," + RoleConstants.SYSTEMROLE_LITERAL_DOCTOR,
"afi1:password:XXXXX:" + RoleConstants.SYSTEMROLE_LITERAL_USER + ","
+ RoleConstants.SYSTEMROLE_LITERAL_EXECUTIVE_DOCTOR
};
}
@Override
public IUser login(String username, char[] password) throws LoginException{
IUser csvUser = new CsvUser(rows).login(username, password);
if (csvUser == null) {
throw new LoginException("Authentication failed");
}
return csvUser;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment