AccountController.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.uas.platform.home.controller;
  2. import com.uas.account.entity.UuzcUserSpaceDetail;
  3. import com.uas.account.util.AccountUtils;
  4. import com.uas.platform.home.core.support.SystemSession;
  5. import com.uas.platform.home.web.BaseController;
  6. import com.uas.sso.SSOHelper;
  7. import org.springframework.stereotype.Controller;
  8. import org.springframework.ui.ModelMap;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import org.springframework.web.bind.annotation.ResponseBody;
  12. import java.io.IOException;
  13. @Controller
  14. public class AccountController extends BaseController {
  15. /**
  16. * 账户信息、SSO配置
  17. *
  18. * @return
  19. */
  20. @RequestMapping(value = "/account", method = RequestMethod.GET)
  21. @ResponseBody
  22. public ModelMap getAccountInfo() throws Exception {
  23. if(null != SystemSession.getUser()) {
  24. ModelMap map = new ModelMap();
  25. UuzcUserSpaceDetail detail = AccountUtils.getUuzcUserSpaceDetail(SystemSession.getUser().getSpaceUID());
  26. map.put("content", SystemSession.getUser());
  27. if(null != detail) {
  28. map.put("space", detail);
  29. }
  30. return map;
  31. }
  32. return success();
  33. }
  34. /**
  35. * 跳转登录
  36. *
  37. * @throws IOException
  38. */
  39. @RequestMapping(value = "/account/login", method = RequestMethod.GET)
  40. @ResponseBody
  41. public ModelMap getLoginPage() throws IOException {
  42. SSOHelper.clearLogin(request, response);
  43. return success(SSOHelper.getRedirectRefererLoginUrl(request));
  44. }
  45. /**
  46. * 跳转登录
  47. *
  48. * @throws IOException
  49. */
  50. @RequestMapping(value = "/account/logout", method = RequestMethod.GET)
  51. @ResponseBody
  52. public ModelMap logout() throws IOException {
  53. SSOHelper.clearLogin(request, response);
  54. return success();
  55. }
  56. }