@Service public class SecurityServiceImpl extends java.lang.Object implements ManagerService
限定符和类型 | 字段和说明 |
---|---|
(专用程序包) org.apache.shiro.web.servlet.AbstractShiroFilter |
abstractShiroFilter |
(专用程序包) org.apache.shiro.web.mgt.DefaultWebSecurityManager |
securityManager |
(专用程序包) org.apache.shiro.spring.web.ShiroFilterFactoryBean |
shiroFilterFactoryBean |
(专用程序包) ShiroSessionConfig |
shiroSessionConfig |
(专用程序包) java.lang.String |
uploadFileExtWithList |
static java.util.concurrent.atomic.AtomicInteger |
userTimes |
构造器和说明 |
---|
SecurityServiceImpl() |
限定符和类型 | 方法和说明 |
---|---|
void |
addFilter(java.lang.String name,
javax.servlet.Filter Filter)
动态增加filter
this.addFilter("jwt", new FunctionFilter());
|
void |
addUrls(java.util.Map<java.lang.String,java.lang.String> filterChainDefinitionMap)
动态增加shiro的url 验证
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>() {
{
put("/a/**", "jwt");
}
};
this.addUrls(filterChainDefinitionMap)
|
boolean |
checkLicense()
license 授权文件校验
|
static void |
cleanTakenThreadLocal()
清除线程变量,防止下次还可以使用
|
java.util.List<CoreUser> |
findOnlineUser(java.lang.String orgid)
查询机构下的在线用户
|
org.apache.shiro.session.Session |
getCurrentSession()
获取当前用户session;
|
UserVo |
getCurrentUser()
获取当前的用户
|
java.io.InputStream |
getLicenseInfo()
获取授权文件的注册信息
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getMenuAuth(ZlUserToken.ClientType clientType)
获取菜单树权限
|
CoreRightRes |
getMenuAuthByMenuCode(java.lang.String menuCode)
通过菜单编号获取当前用户的权限菜单资源
|
CoreRightRes |
getMenuAuthByMenuId(java.lang.String menuId)
通过菜单id获取当前用户的权限菜单资源
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getPhoneMenuAuth() |
static java.lang.String |
getResid()
得到资源id 一般等于菜单id 用于查询权限需要该参数
|
java.lang.Object |
getSessionAttribute(java.lang.Object key)
取用户session的 key-value值
|
java.util.List<CoreRightRes> |
getsysAuth() |
java.util.Map<java.lang.String,java.lang.Object> |
getTokenDatas()
已过时。
|
static java.lang.String |
getTokenId()
获取当前线程的tokenId
|
void |
init()
初始化
|
void |
killSessionByUserid(java.lang.String userId)
踢出对应的用户id
|
void |
killUserBySessionId(java.util.ArrayList<CoreUser> coreUsers)
踢出用户
|
org.apache.shiro.subject.Subject |
login(ZlUserToken userToken)
登录
|
void |
logOut()
登出
|
java.lang.Object |
removeAttribute(java.lang.Object key)
移除session的key 属性
|
static void |
removeResidThreadLocal() |
static void |
setResid(java.lang.String resid) |
void |
setSessionAttribute(java.lang.Object key,
java.lang.Object value)
设置session的key-value值
|
static void |
setTokenId(java.lang.String tokenId)
记录当前请求的tokenId
|
void |
switchRole(java.lang.String switchroleid,
java.lang.String deptid) |
void |
unInit()
结束
|
void |
updateSessionUserVo()
更新当前的session的UserVo
|
@Value(value="upload-exts: xls,xlxs,doc,docx,pdf,pcx,svg,jpg,jpeg,bmp,gif,png,swf,tiff") java.lang.String uploadFileExtWithList
@Autowired ShiroSessionConfig shiroSessionConfig
@Autowired org.apache.shiro.spring.web.ShiroFilterFactoryBean shiroFilterFactoryBean
@Autowired org.apache.shiro.web.mgt.DefaultWebSecurityManager securityManager
@Autowired @Qualifier(value="shiroFilter") org.apache.shiro.web.servlet.AbstractShiroFilter abstractShiroFilter
public static java.util.concurrent.atomic.AtomicInteger userTimes
public org.apache.shiro.session.Session getCurrentSession()
public static void setTokenId(java.lang.String tokenId)
tokenId
- tokenIdpublic static void cleanTakenThreadLocal()
public UserVo getCurrentUser()
public static java.lang.String getTokenId()
public void setSessionAttribute(java.lang.Object key, java.lang.Object value)
key
- 唯一keyvalue
- 值public java.lang.Object getSessionAttribute(java.lang.Object key)
key
- 唯一keypublic void init()
ManagerService
init
在接口中 ManagerService
public void unInit()
ManagerService
unInit
在接口中 ManagerService
public java.io.InputStream getLicenseInfo()
public boolean checkLicense()
public org.apache.shiro.subject.Subject login(ZlUserToken userToken)
userToken
- 用户信息tokenpublic void logOut() throws java.lang.Exception
java.lang.Exception
- 出错会抛出异常public java.lang.Object removeAttribute(java.lang.Object key)
key
- 唯一key@Deprecated public java.util.Map<java.lang.String,java.lang.Object> getTokenDatas()
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getMenuAuth(ZlUserToken.ClientType clientType)
clientType
- 客户端类型public CoreRightRes getMenuAuthByMenuCode(java.lang.String menuCode)
menuCode
- 菜单编号public CoreRightRes getMenuAuthByMenuId(java.lang.String menuId)
menuId
- 菜单idpublic void switchRole(java.lang.String switchroleid, java.lang.String deptid) throws java.lang.Exception
java.lang.Exception
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getPhoneMenuAuth()
public void updateSessionUserVo()
public java.util.List<CoreUser> findOnlineUser(java.lang.String orgid)
orgid
- 机构IDpublic void killUserBySessionId(java.util.ArrayList<CoreUser> coreUsers) throws java.lang.Exception
coreUsers
- 用户实体 Listjava.lang.Exception
- 出错会抛出异常public void killSessionByUserid(java.lang.String userId)
userId
- 用户idpublic java.util.List<CoreRightRes> getsysAuth()
public static java.lang.String getResid()
public static void setResid(java.lang.String resid)
public static void removeResidThreadLocal()
public void addFilter(java.lang.String name, javax.servlet.Filter Filter)
name
- 名称Filter
- 实例public void addUrls(java.util.Map<java.lang.String,java.lang.String> filterChainDefinitionMap) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
filterChainDefinitionMap
- url 校验mapjava.lang.IllegalArgumentException
- 出错抛出异常java.lang.IllegalAccessException
- 出错抛出异常