mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-13 09:01:27 +08:00
sonar bug fix
This commit is contained in:
@@ -44,16 +44,17 @@ public class DefaultAopMethodAuthorizeDefinitionParser implements AopMethodAutho
|
||||
CacheKey key = buildCacheKey(paramContext);
|
||||
|
||||
AuthorizeDefinition definition = cache.get(key);
|
||||
if (definition != null) return definition instanceof EmptyAuthorizeDefinition ? null : definition;
|
||||
if (definition != null && (definition instanceof EmptyAuthorizeDefinition)) {
|
||||
return null;
|
||||
}
|
||||
//使用自定义
|
||||
if (!CollectionUtils.isEmpty(parserCustomers)) {
|
||||
definition = parserCustomers.stream()
|
||||
.map(customer -> customer.parse(paramContext))
|
||||
.filter(Objects::nonNull)
|
||||
.findAny().orElse(null);
|
||||
if (definition != null) {
|
||||
if(definition instanceof EmptyAuthorizeDefinition)return null;
|
||||
return definition;
|
||||
if (definition == null || definition instanceof EmptyAuthorizeDefinition) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package org.hswebframework.web.authorization.basic.configuration;
|
||||
|
||||
import org.hswebframework.web.authorization.access.DataAccessController;
|
||||
import org.hswebframework.web.authorization.basic.aop.AopAuthorizingController;
|
||||
import org.hswebframework.web.authorization.basic.aop.AopMethodAuthorizeDefinitionParser;
|
||||
import org.hswebframework.web.authorization.basic.aop.DefaultAopMethodAuthorizeDefinitionParser;
|
||||
import org.hswebframework.web.authorization.basic.handler.AuthorizingHandler;
|
||||
import org.hswebframework.web.authorization.basic.handler.DefaultAuthorizingHandler;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.hswebframework.web.authorization.basic.handler.access.DefaultDataAcce
|
||||
import org.hswebframework.web.authorization.basic.web.*;
|
||||
import org.hswebframework.web.authorization.token.MemoryUserTokenManager;
|
||||
import org.hswebframework.web.authorization.token.UserTokenManager;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -24,9 +23,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO 完成注释
|
||||
* 权限控制自动配置类
|
||||
*
|
||||
* @author zhouhao
|
||||
* @since 3.0
|
||||
*/
|
||||
@Configuration
|
||||
public class AuthorizingHandlerAutoConfiguration {
|
||||
@@ -53,7 +53,7 @@ public class AuthorizingHandlerAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SessionIdUserTokenGenerator sessionIdUserTokenGenerator(){
|
||||
public SessionIdUserTokenGenerator sessionIdUserTokenGenerator() {
|
||||
return new SessionIdUserTokenGenerator();
|
||||
}
|
||||
|
||||
@@ -93,12 +93,12 @@ public class AuthorizingHandlerAutoConfiguration {
|
||||
private DefaultDataAccessController defaultDataAccessController;
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
if (bean instanceof DataAccessHandler) {
|
||||
defaultDataAccessController.addHandler(((DataAccessHandler) bean));
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by zhouhao on 2017/8/13.
|
||||
* 默认权限权限定义
|
||||
*
|
||||
* @author zhouhao
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DefaultBasicAuthorizeDefinition implements AuthorizeDefinition {
|
||||
private boolean dataAccessControl;
|
||||
|
||||
Reference in New Issue
Block a user