Commit 844809d7 by Tuukka Kivilahti

username is no longer null

1 parent a170840b
...@@ -39,6 +39,8 @@ import fi.codecrew.moya.model.EventUser; ...@@ -39,6 +39,8 @@ import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent; import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.utilities.PasswordFunctions; import fi.codecrew.moya.utilities.PasswordFunctions;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventType; import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Session Bean implementation class RestAuthBean * Session Bean implementation class RestAuthBean
...@@ -68,6 +70,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal { ...@@ -68,6 +70,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal {
@EJB @EJB
UserBean userBean; UserBean userBean;
private static final Logger logger = LoggerFactory.getLogger(ApiApplicationBean.class);
/** /**
* Default constructor. * Default constructor.
*/ */
...@@ -131,6 +134,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal { ...@@ -131,6 +134,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal {
} }
ApiApplicationInstance instance = instanceFacade.findInstance(appkey, userkey, event); ApiApplicationInstance instance = instanceFacade.findInstance(appkey, userkey, event);
if (instance == null) { if (instance == null) {
logger.error("Tried to get Api Application Instance: appkey={}, userkey={}, domain={}, event={}", appkey, userkey, domain, event.getName());
throw new EJBException("ApiApplicationInstance not found"); throw new EJBException("ApiApplicationInstance not found");
} }
return instance.getEventuser().getUser().getLogin(); return instance.getEventuser().getUser().getLogin();
......
...@@ -32,7 +32,7 @@ public class RestMacAuthPBean extends ApiAuth implements AuthenticationFormat { ...@@ -32,7 +32,7 @@ public class RestMacAuthPBean extends ApiAuth implements AuthenticationFormat {
LanEvent event = eventbean.getEventForHostname(domain); LanEvent event = eventbean.getEventForHostname(domain);
AuthenticationResult ret = null; AuthenticationResult ret = null;
if ((username == null || username.isEmpty()) && password.startsWith(JaasBeanLocal.REST_PREFIX)) { if (password.startsWith(JaasBeanLocal.REST_PREFIX)) {
ret = new AuthenticationResult(); ret = new AuthenticationResult();
ret.setUsertype(UserType.REST.name()); ret.setUsertype(UserType.REST.name());
if(restAuth(password, event) != null) { if(restAuth(password, event) != null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!