Commit 81b6c93a by Tuomas Riihimäki

Do not explode if principal is null

1 parent 9a98b30e
...@@ -114,7 +114,7 @@ public class JaasBean implements MoyaRealmBeanRemote { ...@@ -114,7 +114,7 @@ public class JaasBean implements MoyaRealmBeanRemote {
// If there is no eventuser found, try to create one. // If there is no eventuser found, try to create one.
if (user != null) { if (user != null) {
logger.info("TryLogin user not null: {}", user); logger.info("TryLogin user not null: {}, login {}", user, user.getLogin());
if (user.isAnonymous()) { if (user.isAnonymous()) {
logger.info("logging in as anonymous!!!"); logger.info("logging in as anonymous!!!");
} else if (!user.checkPassword(password)) { } else if (!user.checkPassword(password)) {
...@@ -140,7 +140,7 @@ public class JaasBean implements MoyaRealmBeanRemote { ...@@ -140,7 +140,7 @@ public class JaasBean implements MoyaRealmBeanRemote {
} }
// jos logitetaan anomuumi, niin uuden tapahtuman luominen hajoaa jännästi. // jos logitetaan anomuumi, niin uuden tapahtuman luominen hajoaa jännästi.
if (!user.isAnonymous()) if (user != null && !user.isAnonymous())
secubean.sendMessage(MoyaEventType.LOGIN_SUCCESSFULL, eventUser, "User logged in with username: '", username, "' eventuser: ", eventUser); secubean.sendMessage(MoyaEventType.LOGIN_SUCCESSFULL, eventUser, "User logged in with username: '", username, "' eventuser: ", eventUser);
} else { } else {
secubean.sendMessage(MoyaEventType.LOGIN_FAILED, eventUserFacade.findByLogin(User.ANONYMOUS_LOGINNAME), "Login failed: Username not found: ", username); secubean.sendMessage(MoyaEventType.LOGIN_FAILED, eventUserFacade.findByLogin(User.ANONYMOUS_LOGINNAME), "Login failed: Username not found: ", username);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!