package com.uas.platform.home.controller; import com.uas.account.entity.UuzcUserSpaceDetail; import com.uas.account.util.AccountUtils; import com.uas.platform.home.core.support.SystemSession; import com.uas.platform.home.web.BaseController; import com.uas.sso.SSOHelper; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.io.IOException; @Controller public class AccountController extends BaseController { /** * 账户信息、SSO配置 * * @return */ @RequestMapping(value = "/account", method = RequestMethod.GET) @ResponseBody public ModelMap getAccountInfo() throws Exception { if(null != SystemSession.getUser()) { ModelMap map = new ModelMap(); UuzcUserSpaceDetail detail = AccountUtils.getUuzcUserSpaceDetail(SystemSession.getUser().getSpaceUID()); map.put("content", SystemSession.getUser()); if(null != detail) { map.put("space", detail); } return map; } return success(); } /** * 跳转登录 * * @throws IOException */ @RequestMapping(value = "/account/login", method = RequestMethod.GET) @ResponseBody public ModelMap getLoginPage() throws IOException { SSOHelper.clearLogin(request, response); return success(SSOHelper.getRedirectRefererLoginUrl(request)); } /** * 跳转登录 * * @throws IOException */ @RequestMapping(value = "/account/logout", method = RequestMethod.GET) @ResponseBody public ModelMap logout() throws IOException { SSOHelper.clearLogin(request, response); return success(); } }