public Response login(@HeaderParam("Referer") String ref, @QueryParam("logout") @DefaultValue("false") boolean logout,
@QueryParam("user") String login) {
// Check whether we want to logout
if (logout) {
userService.setCurrentUser(userService.getAnonymousUser());
throw new AccessDeniedException();
}
// Anonymous cannot login
if (userService.isAnonymous(userService.getCurrentUser())) throw new AccessDeniedException();
// Check whether this is the right (desired) user
if (login != null && !userService.getCurrentUser().equals(userService.getUser(login))) throw new AccessDeniedException();
if (ref == null || "".equals(ref)) {
ref = configurationService.getServerUri() + configurationService.getStringConfiguration("kiwi.pages.startup");
}
return Response.seeOther(java.net.URI.create(ref)).build();