| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.osomapps.pt.token; |
||
| 17 | @RestController |
||
| 18 | @RequestMapping("api/v1/token") |
||
| 19 | class TokenResource { |
||
| 20 | |||
| 21 | private final TokenService tokenService; |
||
| 22 | |||
| 23 | @Autowired |
||
| 24 | TokenResource(TokenService tokenService) { |
||
| 25 | this.tokenService = tokenService; |
||
| 26 | } |
||
| 27 | |||
| 28 | @GetMapping |
||
| 29 | List<InUser> list() { |
||
| 30 | return Collections.emptyList(); |
||
| 31 | } |
||
| 32 | |||
| 33 | @PostMapping |
||
| 34 | TokenResponseDTO create(@RequestBody TokenRequestDTO tokenRequest, HttpServletRequest request) { |
||
| 35 | return tokenService.createOrReadNewToken(tokenRequest, request.getRemoteAddr()); |
||
| 36 | } |
||
| 37 | |||
| 38 | @DeleteMapping |
||
| 39 | @ResponseStatus(value = HttpStatus.NO_CONTENT) |
||
| 40 | void delete(@RequestHeader(value = "X-Token") String token, HttpServletRequest request) { |
||
| 41 | tokenService.deleteToken(token, request.getRemoteAddr()); |
||
| 42 | } |
||
| 44 |