| | |
| | | |
| | | package com.whyc.util; |
| | | |
| | | import com.mysql.cj.core.util.StringUtils; |
| | | import com.whyc.constant.SuperConstant; |
| | | import com.whyc.pojo.User; |
| | | import com.whyc.pojo.UserInf; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.session.Session; |
| | | import org.apache.shiro.subject.Subject; |
| | |
| | | return subject.isAuthenticated(); |
| | | } |
| | | |
| | | public static User getUser() { |
| | | public static UserInf getUser() { |
| | | if (!isNullOrEmpty(ThreadContext.getSubject()) && !isNullOrEmpty(SecurityUtils.getSubject().getPrincipal())) { |
| | | return (User) SecurityUtils.getSubject().getPrincipal(); |
| | | return (UserInf) SecurityUtils.getSubject().getPrincipal(); |
| | | }else { |
| | | return new User(0,"none"); |
| | | return new UserInf(0L,"none"); |
| | | } |
| | | } |
| | | |