| | |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.exception.user.UserAppletException; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | Map<String, Object> claimsMap = new HashMap<String, Object>(); |
| | | claimsMap.put(SecurityConstants.USER_KEY, token); |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); |
| | | claimsMap.put(SecurityConstants.USER_TYPE, "system"); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); |
| | | |
| | | // 接口返回信息 |
| | |
| | | Map<String, Object> claimsMap = new HashMap<String, Object>(); |
| | | claimsMap.put(SecurityConstants.USER_APPLET_KEY, token); |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); |
| | | claimsMap.put(SecurityConstants.USER_TYPE, "applet"); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, name); |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | |
| | | return rspMap; |
| | | } |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | return getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | LoginUserApplet loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | if (loginUserAppletToken == null){ |
| | | throw new UserAppletException("登录失效,请重新登录!", 401); |
| | | } |
| | | return loginUserAppletToken; |
| | | } |
| | | public LoginUserApplet getLoginUserAppletToken(HttpServletRequest request) { |
| | | // 获取请求携带的令牌 |