Commit 683dce59 by Tuomas Riihimäki

We need to add domain to logging in username because we no longer inject it in H…

…ostnameFilter to BortalLocalContextHolder
1 parent 91223aea
......@@ -23,13 +23,13 @@ import io.swagger.annotations.Api;
@RequestScoped
@Path("/apiapp/v1")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON + "; charset=UTF-8" })
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON + "; charset=UTF-8"})
@Api(value = "/apiapp/v1/", description = "Manage api application and keys")
public class ApiAppRestViewV1 {
private static final Logger logger = LoggerFactory.getLogger(ApiAppRestViewV1.class);
@Context
private HttpServletRequest servletRequest;
......@@ -49,8 +49,10 @@ public class ApiAppRestViewV1 {
principal = null;
}
servletRequest.getSession(true);
servletRequest.login(username, password);
String domain = servletRequest.getHeader("host");
servletRequest.login(username + "@" + domain, password);
ApiApplication app = apibean.findApplication(appKey);
ApiApplicationInstance apiInstance = apibean.createApplicationInstance(app);
ApiApplicationInstancePojo ret = new ApiApplicationInstancePojo();
......@@ -59,7 +61,7 @@ public class ApiAppRestViewV1 {
ret.setEnabled(apiInstance.isEnabled());
ret.setSecret(apiInstance.getSecretKey());
return Response.ok(ret).build();
} catch (ServletException e) {
logger.warn("Error logging in while creating ApiApplication instance");
return Response.serverError().entity(e.getCause()).build();
......
......@@ -60,8 +60,10 @@ public class EventInfoV1 {
if (principal != null && principal.getName() != null) {
servletRequest.logout();
}
String domain = servletRequest.getHeader("host");
servletRequest.getSession(true);
servletRequest.login(username, password);
servletRequest.login(username + "@"+domain, password);
}
return Response.ok(PojoUtils.parseEvents(eventBean.findAllEventsForCurrentUser())).build();
} catch (ServletException e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!