package org.esco.demo.ssc.web.rest;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/api")
public class AccountResource {
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
// @Inject
// private ServletContext servletContext;
//
// @Inject
// private ApplicationContext applicationContext;
/**
* GET /rest/authenticate -> check if the user is authenticated, and return its login.
*/
@RequestMapping(value = "authenticate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String isAuthenticated(HttpServletRequest request) {
log.debug("REST request to check if the current user is authenticated");
return request.getRemoteUser();
}
}