Search in sources :

Example 1 with NotLoginException

use of com.ruoyi.common.core.exception.auth.NotLoginException in project RuoYi-Cloud-Oracle by yangzongzhuan.

the class AuthLogic method getLoginUser.

/**
 * 获取当前用户缓存信息, 如果未登录,则抛出异常
 *
 * @return 用户缓存信息
 */
public LoginUser getLoginUser() {
    String token = SecurityUtils.getToken();
    if (token == null) {
        throw new NotLoginException("未提供token");
    }
    LoginUser loginUser = SecurityUtils.getLoginUser();
    if (loginUser == null) {
        throw new NotLoginException("无效的token");
    }
    return loginUser;
}
Also used : NotLoginException(com.ruoyi.common.core.exception.auth.NotLoginException) LoginUser(com.ruoyi.system.api.model.LoginUser)

Example 2 with NotLoginException

use of com.ruoyi.common.core.exception.auth.NotLoginException in project RuoYi-Cloud by yangzongzhuan.

the class AuthLogic method getLoginUser.

/**
 * 获取当前用户缓存信息, 如果未登录,则抛出异常
 *
 * @return 用户缓存信息
 */
public LoginUser getLoginUser() {
    String token = SecurityUtils.getToken();
    if (token == null) {
        throw new NotLoginException("未提供token");
    }
    LoginUser loginUser = SecurityUtils.getLoginUser();
    if (loginUser == null) {
        throw new NotLoginException("无效的token");
    }
    return loginUser;
}
Also used : NotLoginException(com.ruoyi.common.core.exception.auth.NotLoginException) LoginUser(com.ruoyi.system.api.model.LoginUser)

Aggregations

NotLoginException (com.ruoyi.common.core.exception.auth.NotLoginException)2 LoginUser (com.ruoyi.system.api.model.LoginUser)2