| 1 | |
package com.ctrip.framework.apollo.portal.controller; |
| 2 | |
|
| 3 | |
import com.ctrip.framework.apollo.portal.auth.LogoutHandler; |
| 4 | |
import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; |
| 5 | |
import com.ctrip.framework.apollo.portal.entity.po.UserInfo; |
| 6 | |
|
| 7 | |
import org.springframework.beans.factory.annotation.Autowired; |
| 8 | |
import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | |
import org.springframework.web.bind.annotation.RestController; |
| 10 | |
|
| 11 | |
import java.io.IOException; |
| 12 | |
|
| 13 | |
import javax.servlet.http.HttpServletRequest; |
| 14 | |
import javax.servlet.http.HttpServletResponse; |
| 15 | |
|
| 16 | |
@RestController |
| 17 | 1 | public class PortalUserInfoController { |
| 18 | |
|
| 19 | |
@Autowired |
| 20 | |
private UserInfoHolder userInfoHolder; |
| 21 | |
@Autowired |
| 22 | |
private LogoutHandler logoutHandler; |
| 23 | |
|
| 24 | |
@RequestMapping("/user") |
| 25 | |
public UserInfo getCurrentUserName() { |
| 26 | 0 | return userInfoHolder.getUser(); |
| 27 | |
} |
| 28 | |
|
| 29 | |
@RequestMapping("/user/logout") |
| 30 | |
public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { |
| 31 | 0 | logoutHandler.logout(request, response); |
| 32 | 0 | } |
| 33 | |
} |