package eu.dnetlib.repo.manager.controllers;

import eu.dnetlib.repo.manager.service.UserServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/user")
@Api(description = "User API",  tags = {"user"})
public class UserController {

    @Autowired
    UserServiceImpl userService;

    @RequestMapping(value = "/login" , method = RequestMethod.GET)
    @PreAuthorize("hasRole('ROLE_USER')")
    public ResponseEntity<Object> login() {
        return userService.login();
    }
}
