[Minor] catch AccessDeniedException and throw StrolchException

we don't want to propagate why a user can't log in if credentials are
not correct
This commit is contained in:
Robert von Burg 2014-01-27 20:30:49 +01:00
parent 6d6ed977b4
commit 6db47346da
1 changed files with 7 additions and 1 deletions

View File

@ -22,8 +22,10 @@ import java.util.Map;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchComponent;
import li.strolch.exception.StrolchException;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import ch.eitchnet.privilege.base.AccessDeniedException;
import ch.eitchnet.privilege.base.PrivilegeException;
import ch.eitchnet.privilege.handler.DefaultPrivilegeHandler;
import ch.eitchnet.privilege.handler.EncryptionHandler;
@ -113,7 +115,11 @@ public class DefaultStrolchPrivilegeHandler extends StrolchComponent implements
@Override
public Certificate authenticate(String username, byte[] password) {
assertContainerStarted();
return this.privilegeHandler.authenticate(username, password);
try {
return this.privilegeHandler.authenticate(username, password);
} catch (AccessDeniedException e) {
throw new StrolchException("Authentication credentials are invalid", e);
}
}
/**