From ffe9ea5db1956ab7570d467ce8388aac8a474fe0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 13 Oct 2017 11:46:09 +0300 Subject: api: /auth --- juick-api/src/main/java/com/juick/api/controllers/Users.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Users.java b/juick-api/src/main/java/com/juick/api/controllers/Users.java index 35bd229b..4881d841 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Users.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Users.java @@ -24,10 +24,7 @@ import com.juick.service.UserService; import com.juick.server.util.UserUtils; import com.juick.server.util.WebUtils; 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.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.util.ArrayList; @@ -41,6 +38,11 @@ public class Users { @Inject private UserService userService; + @RequestMapping(value = "/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public String getAuthToken() { + return userService.getHashByUID(UserUtils.getCurrentUser().getUid()); + } + @RequestMapping(value = "/users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List doGetUsers( @RequestParam(value = "uname", required = false) List unames, -- cgit v1.2.3