Commit aa0bccf5 by Tuomas Riihimäki

Merge branch 'restFix2018' into 'master'

Fixed rest api

See merge request !388
2 parents a170840b 5946366b
......@@ -39,6 +39,8 @@ import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.utilities.PasswordFunctions;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Session Bean implementation class RestAuthBean
......@@ -68,6 +70,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal {
@EJB
UserBean userBean;
private static final Logger logger = LoggerFactory.getLogger(ApiApplicationBean.class);
/**
* Default constructor.
*/
......@@ -131,6 +134,7 @@ public class ApiApplicationBean implements ApiApplicationBeanLocal {
}
ApiApplicationInstance instance = instanceFacade.findInstance(appkey, userkey, event);
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");
}
return instance.getEventuser().getUser().getLogin();
......
......@@ -32,13 +32,12 @@ public class RestMacAuthPBean extends ApiAuth implements AuthenticationFormat {
LanEvent event = eventbean.getEventForHostname(domain);
AuthenticationResult ret = null;
if ((username == null || username.isEmpty()) && password.startsWith(JaasBeanLocal.REST_PREFIX)) {
if (password.startsWith(JaasBeanLocal.REST_PREFIX)) {
if(restAuth(password, event) != null) {
ret = new AuthenticationResult();
ret.setUsertype(UserType.REST.name());
if(restAuth(password, event) != null) {
ret.setUsername(jaasUsername);
}
//ret.setUsername(restAuth(password, event) + '@'+domain);
}
return ret;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!