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