Package net.risesoft.security
Class DefaultSecurityManager
- java.lang.Object
-
- net.risesoft.security.DefaultSecurityManager
-
- All Implemented Interfaces:
javax.servlet.Filter,SecurityManager,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Service public class DefaultSecurityManager extends Object implements SecurityManager, javax.servlet.Filter, org.springframework.context.ApplicationContextAware
-
-
Field Summary
Fields Modifier and Type Field Description String[]excludeEndUrlsgetToken 接口放开String[]excludeStartUrlsrpc 和注册相关http 跳过static net.risesoft.pojo.Y9Result<Object>noPermissionstatic net.risesoft.pojo.Y9Result<Object>noTokenstatic net.risesoft.pojo.Y9Result<Object>tokenError-
Fields inherited from interface net.risesoft.security.SecurityManager
TOKEN_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultSecurityManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckFailureToken()每1小时判断一次 检查token 状态voiddoFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)StringgetConcurrentIp()ConcurrentSecuritygetConcurrentSecurity()StringgetToken()booleanhasMatch(String[] source, String compare)booleanhasMatch(String source, String compare)voidinit(javax.servlet.FilterConfig filterConfig)booleanremoveToken(String token)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidtokenFailure(List<String> failureTokens, Long time)
-
-
-
Field Detail
-
noToken
public static net.risesoft.pojo.Y9Result<Object> noToken
-
tokenError
public static net.risesoft.pojo.Y9Result<Object> tokenError
-
noPermission
public static net.risesoft.pojo.Y9Result<Object> noPermission
-
excludeStartUrls
public String[] excludeStartUrls
rpc 和注册相关http 跳过
-
excludeEndUrls
public String[] excludeEndUrls
getToken 接口放开
-
-
Method Detail
-
getConcurrentSecurity
public ConcurrentSecurity getConcurrentSecurity()
- Specified by:
getConcurrentSecurityin interfaceSecurityManager
-
hasMatch
public boolean hasMatch(String source, String compare)
- Specified by:
hasMatchin interfaceSecurityManager
-
hasMatch
public boolean hasMatch(String[] source, String compare)
- Specified by:
hasMatchin interfaceSecurityManager
-
tokenFailure
public void tokenFailure(List<String> failureTokens, Long time)
- Specified by:
tokenFailurein interfaceSecurityManager
-
removeToken
public boolean removeToken(String token)
- Specified by:
removeTokenin interfaceSecurityManager
-
getConcurrentIp
public String getConcurrentIp()
- Specified by:
getConcurrentIpin interfaceSecurityManager
-
checkFailureToken
@Scheduled(cron="0 0 0/1 * * ? ") public void checkFailureToken()
每1小时判断一次 检查token 状态
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Filter- Throws:
javax.servlet.ServletException
-
getToken
public String getToken()
- Specified by:
getTokenin interfaceSecurityManager
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
-