diff --git a/hsweb-authorization/hsweb-authorization-api/pom.xml b/hsweb-authorization/hsweb-authorization-api/pom.xml index e7c1a3175..2b832f0f2 100644 --- a/hsweb-authorization/hsweb-authorization-api/pom.xml +++ b/hsweb-authorization/hsweb-authorization-api/pom.xml @@ -5,7 +5,7 @@ hsweb-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/define/AuthorizingContext.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/define/AuthorizingContext.java index 9df70a2fc..e6b34be76 100644 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/define/AuthorizingContext.java +++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/define/AuthorizingContext.java @@ -1,11 +1,19 @@ package org.hswebframework.web.authorization.define; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.hswebframework.web.authorization.Authentication; import org.hswebframework.web.boost.aop.context.MethodInterceptorContext; /** * 权限控制上下文 */ +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor public class AuthorizingContext { private AuthorizeDefinition definition; diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListener.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListener.java deleted file mode 100644 index 5ff18934d..000000000 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListener.java +++ /dev/null @@ -1,18 +0,0 @@ - -package org.hswebframework.web.authorization.listener; - - -import org.hswebframework.web.authorization.listener.event.AuthorizationEvent; - -/** - * 授权监听器,用于监听授权过程,以及自定义授权逻辑 - * 已弃用,请使用{@link org.springframework.context.ApplicationListener} - * - * @author zhouhao - * @see AuthorizationEvent - * @since 3.0 - */ -@Deprecated -public interface AuthorizationListener { - void on(E event); -} diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListenerDispatcher.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListenerDispatcher.java deleted file mode 100644 index 0ad5f54a6..000000000 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/AuthorizationListenerDispatcher.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2016 http://www.hswebframework.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.hswebframework.web.authorization.listener; - -import org.hswebframework.web.authorization.listener.event.AuthorizationEvent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationEventPublisher; - -import java.util.*; - -/** - * {@link org.springframework.context.ApplicationEventPublisher} - * @author zhouhao - */ -@Deprecated -public class AuthorizationListenerDispatcher { - - @Autowired - private ApplicationEventPublisher eventPublisher; - - - private Map, List> listenerStore = new HashMap<>(); - - public void addListener(Class eventClass, AuthorizationListener listener) { - listenerStore.computeIfAbsent(eventClass, (k) -> new LinkedList<>()) - .add(listener); - } - - @SuppressWarnings("unchecked") - public int doEvent(Class eventType, E event) { - eventPublisher.publishEvent(event); -// List> store = (List) listenerStore.get(eventType); -// if (null != store) { -// store.forEach(listener -> listener.on(event)); -// return store.size(); -// } - return 1; - } - - @SuppressWarnings("unchecked") - public int doEvent(E event) { - eventPublisher.publishEvent(event); - return 1; - //return doEvent((Class) event.getClass(), event); - } -} diff --git a/hsweb-authorization/hsweb-authorization-basic/README.md b/hsweb-authorization/hsweb-authorization-basic/README.md index dfc3d447c..00183e893 100644 --- a/hsweb-authorization/hsweb-authorization-basic/README.md +++ b/hsweb-authorization/hsweb-authorization-basic/README.md @@ -48,17 +48,18 @@ where name like ? or full_name like where u_id in(?,?,?) and (name like ? or full_name like) ``` +## 授权登录接口 +http接口: `POST /authorize/login`, 登录接口支持2种`content-type`,`application/json`(Json RequestBody方式)和`application/x-www-form-urlencoded`(表单方式), +请在调用等时候指定对应等`content-type`.必要参数: `username` 和 `password`. + +⚠️注意: 此接口只实现了简单的登录逻辑,不过会通过发布各种事件来实现自定义的逻辑处理. + +1. `AuthorizationDecodeEvent` 在接收到登录请求之后触发,如果在登录前对用户名密码进行里加密,可以通过监听此事件实现对用户名密码的解密操作 +2. `AuthorizationBeforeEvent` 在`AuthorizationDecodeEvent`事件完成后触发,可通过监听此事件并获取请求参数,实现验证码功能 +3. `AuthorizationSuccessEvent` 在授权成功后触发.注意: 权限控制模块也是通过监听此事件来完成授权 +4. `AuthorizationFailedEvent` 授权失败时触发.当发生过程中异常时触发此事件 + +什么? 还不知道如何监听事件? [快看这里](https://github.com/hs-web/hsweb-framework/wiki/事件驱动) + # 会话状态 此模块默认使用sessionId绑定用户信息。还可以使用 [jwt](../hsweb-authorization-jwt) 方式 - -# 跨域设置 -修改application.yml -```yaml -hsweb: - cors: - enabled: on - allowed-origins: "*" - allowed-methods: "*" - allowed-headers: "*" - -``` \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-basic/pom.xml b/hsweb-authorization/hsweb-authorization-basic/pom.xml index 5f4910192..a0dc2878c 100644 --- a/hsweb-authorization/hsweb-authorization-basic/pom.xml +++ b/hsweb-authorization/hsweb-authorization-basic/pom.xml @@ -5,7 +5,7 @@ hsweb-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java index c4b65155d..313c14482 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java @@ -6,12 +6,14 @@ import org.hswebframework.web.authorization.access.DataAccessHandler; import org.hswebframework.web.authorization.basic.aop.AopMethodAuthorizeDefinitionParser; import org.hswebframework.web.authorization.basic.embed.EmbedAuthenticationManager; import org.hswebframework.web.authorization.basic.handler.DefaultAuthorizingHandler; +import org.hswebframework.web.authorization.basic.handler.UserAllowPermissionHandler; import org.hswebframework.web.authorization.basic.handler.access.DefaultDataAccessController; import org.hswebframework.web.authorization.basic.web.*; import org.hswebframework.web.authorization.basic.web.session.UserTokenAutoExpiredListener; import org.hswebframework.web.authorization.token.UserTokenManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -75,6 +77,11 @@ public class AuthorizingHandlerAutoConfiguration { return new EmbedAuthenticationManager(); } + @Bean + public UserAllowPermissionHandler userAllowPermissionHandler() { + return new UserAllowPermissionHandler(); + } + @Bean public UserOnSignIn userOnSignIn(UserTokenManager userTokenManager) { return new UserOnSignIn(userTokenManager); @@ -119,4 +126,16 @@ public class AuthorizingHandlerAutoConfiguration { return bean; } } + + @Configuration + @ConditionalOnProperty(prefix = "hsweb.authorize", name = "basic-authorization", havingValue = "true") + @ConditionalOnClass(UserTokenForTypeParser.class) + public static class BasicAuthorizationConfiguration { + @Bean + public BasicAuthorizationTokenParser basicAuthorizationTokenParser(AuthenticationManager authenticationManager, + UserTokenManager tokenManager) { + return new BasicAuthorizationTokenParser(authenticationManager, tokenManager); + } + + } } diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationTokenParser.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/BasicAuthorizationTokenParser.java similarity index 75% rename from hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationTokenParser.java rename to hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/BasicAuthorizationTokenParser.java index 741330db8..a300db27a 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationTokenParser.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/BasicAuthorizationTokenParser.java @@ -1,18 +1,20 @@ -package org.hswebframework.web.authorization.starter; +package org.hswebframework.web.authorization.basic.configuration; + import org.apache.commons.codec.binary.Base64; +import org.hswebframework.web.authorization.Authentication; +import org.hswebframework.web.authorization.AuthenticationManager; import org.hswebframework.web.authorization.basic.web.AuthorizedToken; import org.hswebframework.web.authorization.basic.web.ParsedToken; import org.hswebframework.web.authorization.basic.web.UserTokenForTypeParser; +import org.hswebframework.web.authorization.simple.PlainTextUsernamePasswordAuthenticationRequest; import org.hswebframework.web.authorization.token.UserToken; import org.hswebframework.web.authorization.token.UserTokenManager; -import org.hswebframework.web.entity.authorization.UserEntity; -import org.hswebframework.web.service.authorization.UserService; import javax.servlet.http.HttpServletRequest; public class BasicAuthorizationTokenParser implements UserTokenForTypeParser { - private UserService userService; + private AuthenticationManager authenticationManager; private UserTokenManager userTokenManager; @@ -21,8 +23,8 @@ public class BasicAuthorizationTokenParser implements UserTokenForTypeParser { return "basic"; } - public BasicAuthorizationTokenParser(UserService userService, UserTokenManager userTokenManager) { - this.userService = userService; + public BasicAuthorizationTokenParser(AuthenticationManager authenticationManager, UserTokenManager userTokenManager) { + this.authenticationManager = authenticationManager; this.userTokenManager = userTokenManager; } @@ -56,12 +58,12 @@ public class BasicAuthorizationTokenParser implements UserTokenForTypeParser { } if (usernameAndPassword.contains(":")) { String[] arr = usernameAndPassword.split("[:]"); - UserEntity user = userService.selectByUserNameAndPassword(arr[0], arr[1]); - if (user != null) { + Authentication authentication = authenticationManager.authenticate(new PlainTextUsernamePasswordAuthenticationRequest(arr[0], arr[1])); + if (authentication != null) { return new AuthorizedToken() { @Override public String getUserId() { - return user.getId(); + return authentication.getUser().getId(); } @Override @@ -77,7 +79,7 @@ public class BasicAuthorizationTokenParser implements UserTokenForTypeParser { @Override public long getMaxInactiveInterval() { //60分钟有效期 - return 60*60*1000L; + return 60 * 60 * 1000L; } }; } diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManager.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManager.java index 86f34fd7d..f691011ad 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManager.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManager.java @@ -11,6 +11,8 @@ import org.hswebframework.web.authorization.simple.builder.SimpleDataAccessConfi import org.hswebframework.web.validate.ValidationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; import org.springframework.util.StringUtils; import javax.annotation.PostConstruct; @@ -22,6 +24,7 @@ import java.util.Map; * @since 3.0.0-RC */ @ConfigurationProperties(prefix = "hsweb") +@Order(Ordered.HIGHEST_PRECEDENCE) public class EmbedAuthenticationManager implements AuthenticationManager { private Map authentications = new HashMap<>(); diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java index 28bc188b8..eeb7f0f43 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java @@ -58,6 +58,8 @@ public class EmbedAuthenticationProperties { private List permissions = new ArrayList<>(); + private Map> permissionsSimple = new HashMap<>(); + @Getter @Setter public static class PermissionInfo { @@ -77,7 +79,9 @@ public class EmbedAuthenticationProperties { user.setType(type); authentication.setUser(user); authentication.setRoles((List) roles); - List permissionList = permissions.stream() + List permissionList = new ArrayList<>(); + + permissionList.addAll(permissions.stream() .map(info -> { SimplePermission permission = new SimplePermission(); permission.setId(info.getId()); @@ -88,7 +92,16 @@ public class EmbedAuthenticationProperties { .build()).collect(Collectors.toSet())); return permission; - }).collect(Collectors.toList()); + }) + .collect(Collectors.toList())); + + permissionList.addAll(permissionsSimple.entrySet().stream() + .map(entry -> { + SimplePermission permission = new SimplePermission(); + permission.setId(entry.getKey()); + permission.setActions(new HashSet<>(entry.getValue())); + return permission; + }).collect(Collectors.toList())); authentication.setPermissions(permissionList); return authentication; diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandler.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandler.java new file mode 100644 index 000000000..68df503aa --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandler.java @@ -0,0 +1,78 @@ +package org.hswebframework.web.authorization.basic.handler; + +import lombok.Getter; +import lombok.Setter; +import org.hswebframework.web.authorization.define.AuthorizingContext; +import org.hswebframework.web.authorization.define.HandleType; +import org.hswebframework.web.authorization.listener.event.AuthorizingHandleBeforeEvent; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.event.EventListener; +import org.springframework.util.AntPathMatcher; +import org.springframework.util.ClassUtils; +import org.springframework.util.PathMatcher; + +import java.util.*; + +/** + *
+ *     hsweb:
+ *        authorize:
+ *            allows:
+ *               users:
+ *                  admin: *
+ *                  guest: **.query*
+ *               roles:
+ *                  admin: *
+ *
+ * 
+ * + * @author zhouhao + * @since 3.0.1 + */ +@ConfigurationProperties("hsweb.authorize") +public class UserAllowPermissionHandler { + + @Getter + @Setter + private Map> allows = new HashMap<>(); + + private PathMatcher pathMatcher = new AntPathMatcher("."); + + @EventListener + public void handEvent(AuthorizingHandleBeforeEvent event) { + + if (allows.isEmpty() || event.getHandleType() == HandleType.DATA) { + return; + } + AuthorizingContext context = event.getContext(); + + // class full name.method + String path = ClassUtils.getUserClass(context.getParamContext() + .getTarget()) + .getName().concat(".") + .concat(context.getParamContext() + .getMethod().getName()); + + String userId = context.getAuthentication().getUser().getId(); + boolean allow; + allow = Optional.ofNullable(allows.get("users")) + .map(users -> users.get(userId)) + .filter(pattern -> "*".equals(pattern) || pathMatcher.match(pattern, path)) + .isPresent(); + if (allow) { + event.setAllow(true); + return; + } + allow = context.getAuthentication() + .getRoles() + .stream() + .map(role -> allows.getOrDefault("roles", Collections.emptyMap()).get(role.getId())) + .filter(Objects::nonNull) + .anyMatch(pattern -> "*".equals(pattern) || pathMatcher.match(pattern, path)); + if (allow) { + event.setAllow(true); + return; + } + } + +} diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java index 7282a1dfc..b2c1f1638 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java @@ -32,6 +32,7 @@ import org.hswebframework.web.logging.AccessLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.MediaType; +import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -77,9 +78,8 @@ public class AuthorizationController { public ResponseMessage> authorize(@ApiParam(example = "{\"username\":\"admin\",\"password\":\"admin\"}") @RequestBody Map parameter) { - return doLogin(Objects.requireNonNull(parameter.get("username"), "用户名不能为空") - , Objects.requireNonNull(parameter.get("password"), "密码不能为空") - , parameter); + + return doLogin(parameter.get("username"), parameter.get("password"), parameter); } @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @@ -93,6 +93,9 @@ public class AuthorizationController { @SneakyThrows protected ResponseMessage> doLogin(String username, String password, Map parameter) { + Assert.hasLength(username, "用户名不能为空"); + Assert.hasLength(password, "密码不能为空"); + AuthorizationFailedEvent.Reason reason = AuthorizationFailedEvent.Reason.OTHER; Function parameterGetter = parameter::get; try { diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserOnSignIn.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserOnSignIn.java index 4b26c57f4..927ba1117 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserOnSignIn.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserOnSignIn.java @@ -1,6 +1,5 @@ package org.hswebframework.web.authorization.basic.web; -import org.hswebframework.web.authorization.listener.AuthorizationListener; import org.hswebframework.web.authorization.listener.event.AuthorizationSuccessEvent; import org.hswebframework.web.authorization.token.UserToken; import org.hswebframework.web.authorization.token.UserTokenHolder; diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/AuthorizeTests.java b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java similarity index 100% rename from hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/AuthorizeTests.java rename to hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/RedisUserTokenManagerTests.java b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/RedisUserTokenManagerTests.java similarity index 100% rename from hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/RedisUserTokenManagerTests.java rename to hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/RedisUserTokenManagerTests.java diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/TestApplication.java b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/TestApplication.java similarity index 63% rename from hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/TestApplication.java rename to hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/TestApplication.java index 67ac7bab7..797c1ff4d 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/TestApplication.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/TestApplication.java @@ -1,5 +1,6 @@ -package org.hswebframework.web.authorization.starter; +package org.hswebframework.web.authorization; +import org.hswebframework.web.authorization.basic.configuration.EnableAopAuthorize; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.test.context.web.WebAppConfiguration; @@ -9,6 +10,7 @@ import org.springframework.test.context.web.WebAppConfiguration; */ @SpringBootApplication @WebAppConfiguration +@EnableAopAuthorize public class TestApplication { } diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy similarity index 93% rename from hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy rename to hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy index 39921eab4..d798da84e 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy +++ b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationManagerTest.groovy @@ -2,6 +2,7 @@ package org.hswebframework.web.authorization.basic.embed import org.hswebframework.web.authorization.Authentication import org.hswebframework.web.authorization.AuthenticationManager +import org.hswebframework.web.authorization.TestApplication import org.hswebframework.web.authorization.simple.PlainTextUsernamePasswordAuthenticationRequest import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest @@ -30,6 +31,7 @@ class EmbedAuthenticationManagerTest extends Specification { authentication.getUser() != null authentication.getUser().getName() == "超级管理员" authentication.hasPermission("user-manager", "query") + authentication.hasPermission("test", "query") authentication.getPermission("user-manager") != null authentication.hasRole("user") authentication.getPermission("user-manager") diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/TestController.java b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/TestController.java new file mode 100644 index 000000000..390429596 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/TestController.java @@ -0,0 +1,24 @@ +package org.hswebframework.web.authorization.basic.handler; + +import org.hswebframework.web.authorization.annotation.Authorize; +import org.hswebframework.web.controller.message.ResponseMessage; + +/** + * @author zhouhao + * @since 3.0.1 + */ +public class TestController { + + public ResponseMessage query() { + return ResponseMessage.ok(); + } + + public ResponseMessage update() { + return ResponseMessage.ok(); + } + + public ResponseMessage delete() { + return ResponseMessage.ok(); + } + +} diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandlerTest.groovy b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandlerTest.groovy new file mode 100644 index 000000000..f809f2568 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/basic/handler/UserAllowPermissionHandlerTest.groovy @@ -0,0 +1,61 @@ +package org.hswebframework.web.authorization.basic.handler + +import org.hswebframework.web.authorization.Authentication +import org.hswebframework.web.authorization.AuthenticationManager +import org.hswebframework.web.authorization.TestApplication +import org.hswebframework.web.authorization.basic.define.EmptyAuthorizeDefinition +import org.hswebframework.web.authorization.define.AuthorizeDefinition +import org.hswebframework.web.authorization.define.AuthorizingContext +import org.hswebframework.web.authorization.define.HandleType +import org.hswebframework.web.authorization.listener.event.AuthorizingHandleBeforeEvent +import org.hswebframework.web.authorization.simple.PlainTextUsernamePasswordAuthenticationRequest +import org.hswebframework.web.boost.aop.context.MethodInterceptorContext +import org.hswebframework.web.boost.aop.context.MethodInterceptorHolder +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.web.WebAppConfiguration +import spock.lang.Specification + +/** + * @author zhouhao + * @since 3.0.1 + */ +@WebAppConfiguration +@ContextConfiguration +@SpringBootTest(classes = [TestApplication.class], properties = ["classpath:application.yml"]) +class UserAllowPermissionHandlerTest extends Specification { + + @Autowired + UserAllowPermissionHandler handler; + + @Autowired + private AuthenticationManager manager; + + def createMethodInterceptorContext(TestController controller, String name) { + return new MethodInterceptorHolder( + "test" + , TestController.class.getMethod(name) + , controller + , new HashMap()) + .createParamContext() + } + + def "Test"() { + setup: + def authentication = manager.authenticate(new PlainTextUsernamePasswordAuthenticationRequest("admin", "admin")); + def definition = EmptyAuthorizeDefinition.instance; + def controller = new TestController(); + def context = createMethodInterceptorContext(controller, "query"); + def authorizingContext = new AuthorizingContext( + authentication: authentication + , definition: definition + , paramContext: context); + def event = new AuthorizingHandleBeforeEvent(authorizingContext, HandleType.RBAC); + handler.handEvent(event); + expect: + authentication != null + event.isAllow() + + } +} diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/TestApplication.java b/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/TestApplication.java deleted file mode 100644 index c5b2310a7..000000000 --- a/hsweb-authorization/hsweb-authorization-basic/src/test/java/org/hswebframework/web/authorization/basic/embed/TestApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.hswebframework.web.authorization.basic.embed; - -import org.hswebframework.web.authorization.basic.configuration.AopAuthorizeAutoConfiguration; -import org.hswebframework.web.authorization.basic.configuration.AuthorizingHandlerAutoConfiguration; -import org.hswebframework.web.authorization.basic.configuration.EnableAopAuthorize; -import org.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.test.context.web.WebAppConfiguration; - -/** - * @author zhouhao - * @since 3.0.0-RC - */ -@SpringBootApplication -@WebAppConfiguration -@EnableAopAuthorize -public class TestApplication { - -} diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/resources/application.yml b/hsweb-authorization/hsweb-authorization-basic/src/test/resources/application.yml index 6a69af19a..febdaf1a8 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/test/resources/application.yml +++ b/hsweb-authorization/hsweb-authorization-basic/src/test/resources/application.yml @@ -15,6 +15,10 @@ hsweb: app: name: hsweb-oauth2 客户端示例 version: 3.0.0 + authorize: + allows: + users: + admin: "**.TestController.*" users: admin: name: 超级管理员 @@ -25,6 +29,8 @@ hsweb: name: 管理员 - id: user name: 用户 + permissions-simple: + test: query,get permissions: - id: user-manager actions: query,get,update,delete diff --git a/hsweb-authorization/hsweb-authorization-jwt/pom.xml b/hsweb-authorization/hsweb-authorization-jwt/pom.xml index 6f60822d4..b35a8c307 100644 --- a/hsweb-authorization/hsweb-authorization-jwt/pom.xml +++ b/hsweb-authorization/hsweb-authorization-jwt/pom.xml @@ -5,7 +5,7 @@ hsweb-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml index 0cc6875cb..84607848a 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml @@ -23,7 +23,7 @@ hsweb-authorization-oauth2 org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml index de05f50b4..3d4f55715 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml @@ -23,7 +23,7 @@ hsweb-authorization-oauth2 org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml index 2c4c353b8..0a75454f5 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml @@ -23,7 +23,7 @@ hsweb-authorization-oauth2 org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/hsweb-authorization-oauth2/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/pom.xml index fea7dba0a..0d24e3349 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/pom.xml @@ -5,7 +5,7 @@ hsweb-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-authorization/pom.xml b/hsweb-authorization/pom.xml index 632baa4d6..0f800adff 100644 --- a/hsweb-authorization/pom.xml +++ b/hsweb-authorization/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-boost/hsweb-boost-aop/pom.xml b/hsweb-boost/hsweb-boost-aop/pom.xml index 07377d850..1aed148b6 100644 --- a/hsweb-boost/hsweb-boost-aop/pom.xml +++ b/hsweb-boost/hsweb-boost-aop/pom.xml @@ -23,7 +23,7 @@ hsweb-boost org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-boost/hsweb-boost-excel/pom.xml b/hsweb-boost/hsweb-boost-excel/pom.xml index 8988e9537..54b214fd1 100644 --- a/hsweb-boost/hsweb-boost-excel/pom.xml +++ b/hsweb-boost/hsweb-boost-excel/pom.xml @@ -5,7 +5,7 @@ hsweb-boost org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-boost/hsweb-boost-ftp/pom.xml b/hsweb-boost/hsweb-boost-ftp/pom.xml index 939ab77ab..65b6986a3 100644 --- a/hsweb-boost/hsweb-boost-ftp/pom.xml +++ b/hsweb-boost/hsweb-boost-ftp/pom.xml @@ -5,7 +5,7 @@ hsweb-boost org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-boost/pom.xml b/hsweb-boost/pom.xml index 875353908..de658633a 100644 --- a/hsweb-boost/pom.xml +++ b/hsweb-boost/pom.xml @@ -23,7 +23,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-commons/hsweb-commons-bean/pom.xml b/hsweb-commons/hsweb-commons-bean/pom.xml index eb498b032..e14f9cc94 100644 --- a/hsweb-commons/hsweb-commons-bean/pom.xml +++ b/hsweb-commons/hsweb-commons-bean/pom.xml @@ -5,7 +5,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/hsweb-commons-controller/pom.xml b/hsweb-commons/hsweb-commons-controller/pom.xml index b65ac5df9..0a499b227 100644 --- a/hsweb-commons/hsweb-commons-controller/pom.xml +++ b/hsweb-commons/hsweb-commons-controller/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml b/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml index 3cd8a7d2b..4ec9a13c1 100644 --- a/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml +++ b/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml @@ -23,7 +23,7 @@ hsweb-commons-dao org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml b/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml index db8600996..eba726218 100644 --- a/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml +++ b/hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml @@ -23,7 +23,7 @@ hsweb-commons-dao org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 @@ -84,9 +84,8 @@ test - javax.el - el-api - 2.2 + org.glassfish + javax.el test diff --git a/hsweb-commons/hsweb-commons-dao/pom.xml b/hsweb-commons/hsweb-commons-dao/pom.xml index c87088ed2..a3e2c0d26 100644 --- a/hsweb-commons/hsweb-commons-dao/pom.xml +++ b/hsweb-commons/hsweb-commons-dao/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/hsweb-commons-entity/pom.xml b/hsweb-commons/hsweb-commons-entity/pom.xml index c9fbe2738..41e9e4066 100644 --- a/hsweb-commons/hsweb-commons-entity/pom.xml +++ b/hsweb-commons/hsweb-commons-entity/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-commons/hsweb-commons-model/pom.xml b/hsweb-commons/hsweb-commons-model/pom.xml index 3fcab6818..198627af5 100644 --- a/hsweb-commons/hsweb-commons-model/pom.xml +++ b/hsweb-commons/hsweb-commons-model/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml index aeeb18d19..49f6d272d 100644 --- a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml +++ b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml @@ -23,7 +23,7 @@ hsweb-commons-service org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml index 4766092a6..097c6fb0f 100644 --- a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml +++ b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml @@ -5,7 +5,7 @@ hsweb-commons-service org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml index 2168d47f9..8e06293b8 100644 --- a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml +++ b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml @@ -23,7 +23,7 @@ hsweb-commons-service org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml @@ -61,9 +61,8 @@ ${project.version} - javax.el - javax.el-api - 3.0.0 + org.glassfish + javax.el test diff --git a/hsweb-commons/hsweb-commons-service/pom.xml b/hsweb-commons/hsweb-commons-service/pom.xml index 8b8f2887a..20193d6df 100644 --- a/hsweb-commons/hsweb-commons-service/pom.xml +++ b/hsweb-commons/hsweb-commons-service/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-commons/hsweb-commons-utils/pom.xml b/hsweb-commons/hsweb-commons-utils/pom.xml index ed5dd731f..a60993065 100644 --- a/hsweb-commons/hsweb-commons-utils/pom.xml +++ b/hsweb-commons/hsweb-commons-utils/pom.xml @@ -23,7 +23,7 @@ hsweb-commons org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-commons/pom.xml b/hsweb-commons/pom.xml index 6627fcaf8..9d43959ee 100644 --- a/hsweb-commons/pom.xml +++ b/hsweb-commons/pom.xml @@ -23,7 +23,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-async-job/pom.xml b/hsweb-concurrent/hsweb-concurrent-async-job/pom.xml index b489b249d..b03837bcc 100644 --- a/hsweb-concurrent/hsweb-concurrent-async-job/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-async-job/pom.xml @@ -5,7 +5,7 @@ hsweb-concurrent org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-async-job/src/test/java/org/hswebframework/web/async/TransactionSupportAsyncJobServiceTest.java b/hsweb-concurrent/hsweb-concurrent-async-job/src/test/java/org/hswebframework/web/async/TransactionSupportAsyncJobServiceTest.java index 8347bfcdf..6861b541b 100644 --- a/hsweb-concurrent/hsweb-concurrent-async-job/src/test/java/org/hswebframework/web/async/TransactionSupportAsyncJobServiceTest.java +++ b/hsweb-concurrent/hsweb-concurrent-async-job/src/test/java/org/hswebframework/web/async/TransactionSupportAsyncJobServiceTest.java @@ -1,27 +1,22 @@ package org.hswebframework.web.async; +import lombok.SneakyThrows; import org.hswebframework.ezorm.rdb.executor.SqlExecutor; import org.hswebframework.web.tests.SimpleWebApplicationTests; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.support.TransactionTemplate; import javax.sql.DataSource; -import java.sql.SQLException; -import java.util.List; -import java.util.concurrent.Executors; - -import static org.junit.Assert.*; /** - * * @author zhouhao */ public class TransactionSupportAsyncJobServiceTest extends SimpleWebApplicationTests { @@ -42,11 +37,20 @@ public class TransactionSupportAsyncJobServiceTest extends SimpleWebApplicationT } } + @Before + @SneakyThrows + public void init() { + sqlExecutor.exec("create table test(id varchar(32))"); + } + + @After + @SneakyThrows + public void cleanup() { + sqlExecutor.exec("drop table test"); + } + @Test public void test() throws Exception { - - sqlExecutor.exec("create table test(id varchar(32))"); - try { BatchAsyncJobContainer jobContainer = asyncJobService.batch(); jobContainer.submit(() -> { @@ -66,9 +70,6 @@ public class TransactionSupportAsyncJobServiceTest extends SimpleWebApplicationT @Test public void testSimple() throws Exception { - - sqlExecutor.exec("create table test(id varchar(32))"); - try { BatchAsyncJobContainer jobContainer = asyncJobService.batch(); jobContainer.submit(() -> { @@ -85,6 +86,6 @@ public class TransactionSupportAsyncJobServiceTest extends SimpleWebApplicationT } catch (Exception ignore) { ignore.printStackTrace(); } - Assert.assertTrue(sqlExecutor.list("select * from test").size()>0); + Assert.assertTrue(sqlExecutor.list("select * from test").size() > 0); } } \ No newline at end of file diff --git a/hsweb-concurrent/hsweb-concurrent-cache/pom.xml b/hsweb-concurrent/hsweb-concurrent-cache/pom.xml index da54e99ab..bfc94c89e 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-cache/pom.xml @@ -22,7 +22,7 @@ hsweb-concurrent org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml b/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml index c510ded4c..7d8fbbb7f 100644 --- a/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml @@ -22,7 +22,7 @@ hsweb-concurrent-counter org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml b/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml index 2026357f4..8c09c6338 100644 --- a/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml @@ -5,7 +5,7 @@ hsweb-concurrent-counter org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-counter/pom.xml b/hsweb-concurrent/hsweb-concurrent-counter/pom.xml index 92584d59f..8e0e173cd 100644 --- a/hsweb-concurrent/hsweb-concurrent-counter/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-counter/pom.xml @@ -22,7 +22,7 @@ hsweb-concurrent org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml index 59d6066a9..438b80b2a 100644 --- a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml @@ -5,7 +5,7 @@ hsweb-concurrent-lock org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml index 0cc4d7df9..a7c7994b5 100644 --- a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml @@ -5,7 +5,7 @@ hsweb-concurrent-lock org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml index ddd31c255..aba641cd2 100644 --- a/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-concurrent-lock org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/hsweb-concurrent-lock/pom.xml b/hsweb-concurrent/hsweb-concurrent-lock/pom.xml index 1aebbf3fe..9556c1f50 100644 --- a/hsweb-concurrent/hsweb-concurrent-lock/pom.xml +++ b/hsweb-concurrent/hsweb-concurrent-lock/pom.xml @@ -22,7 +22,7 @@ hsweb-concurrent org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-concurrent/pom.xml b/hsweb-concurrent/pom.xml index 8eccc35f6..938d10e4a 100644 --- a/hsweb-concurrent/pom.xml +++ b/hsweb-concurrent/pom.xml @@ -22,7 +22,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-core/pom.xml b/hsweb-core/pom.xml index e0f37e798..2a11d56e3 100644 --- a/hsweb-core/pom.xml +++ b/hsweb-core/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-datasource/hsweb-datasource-api/pom.xml b/hsweb-datasource/hsweb-datasource-api/pom.xml index 3d436cd8b..4f94013f0 100644 --- a/hsweb-datasource/hsweb-datasource-api/pom.xml +++ b/hsweb-datasource/hsweb-datasource-api/pom.xml @@ -5,7 +5,7 @@ hsweb-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-datasource/hsweb-datasource-jta/pom.xml b/hsweb-datasource/hsweb-datasource-jta/pom.xml index d889024a5..d125b80fc 100644 --- a/hsweb-datasource/hsweb-datasource-jta/pom.xml +++ b/hsweb-datasource/hsweb-datasource-jta/pom.xml @@ -5,7 +5,7 @@ hsweb-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceConfig.java b/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceConfig.java index 3fb164be8..c91c36cf4 100644 --- a/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceConfig.java +++ b/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceConfig.java @@ -3,9 +3,12 @@ package org.hswebframework.web.datasource.jta; import com.atomikos.jdbc.AtomikosDataSourceBean; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.hswebframework.web.bean.FastBeanCopier; import org.hswebframework.web.datasource.config.DynamicDataSourceConfig; +import javax.sql.XADataSource; import java.sql.SQLException; import java.util.Properties; @@ -15,27 +18,34 @@ import java.util.Properties; @EqualsAndHashCode(callSuper = true) @Slf4j @Data -public class AtomikosDataSourceConfig extends DynamicDataSourceConfig{ - private static final long serialVersionUID = 5588085000663972571L; - private int minPoolSize = 5; - private int maxPoolSize = 200; - private int borrowConnectionTimeout = 60; - private int reapTimeout = 0; - private int maxIdleTime = 60; - private int maintenanceInterval = 60; - private int defaultIsolationLevel = -1; - private String xaDataSourceClassName = null; - private int loginTimeout = 0; - private String testQuery = null; - private int maxLifetime = 0; - private Properties xaProperties = null; +public class AtomikosDataSourceConfig extends DynamicDataSourceConfig { + private static final long serialVersionUID = 5588085000663972571L; + private int minPoolSize = 5; + private int maxPoolSize = 200; + private int borrowConnectionTimeout = 60; + private int reapTimeout = 0; + private int maxIdleTime = 60; + private int maintenanceInterval = 60; + private int defaultIsolationLevel = -1; + private String xaDataSourceClassName = null; + private int loginTimeout = 0; + private String testQuery = null; + private int maxLifetime = 0; + private Properties xaProperties = null; //初始化超时时间 - private int initTimeout = 10; + private int initTimeout = 10; + @SneakyThrows public void putProperties(AtomikosDataSourceBean atomikosDataSourceBean) { + if (null != xaProperties) { xaProperties.entrySet().forEach(entry -> entry.setValue(String.valueOf(entry.getValue()))); } + //fix #87 + XADataSource dataSource = (XADataSource) Class.forName(getXaDataSourceClassName()).newInstance(); + FastBeanCopier.copy(xaProperties, dataSource); + atomikosDataSourceBean.setXaDataSource(dataSource); + atomikosDataSourceBean.setXaDataSourceClassName(getXaDataSourceClassName()); atomikosDataSourceBean.setBorrowConnectionTimeout(getBorrowConnectionTimeout()); if (loginTimeout != 0) { diff --git a/hsweb-datasource/hsweb-datasource-jta/src/test/resources/application.yml b/hsweb-datasource/hsweb-datasource-jta/src/test/resources/application.yml index 6dbba9d08..b8b3b5c93 100644 --- a/hsweb-datasource/hsweb-datasource-jta/src/test/resources/application.yml +++ b/hsweb-datasource/hsweb-datasource-jta/src/test/resources/application.yml @@ -9,6 +9,10 @@ spring: url : jdbc:h2:mem:core;DB_CLOSE_ON_EXIT=FALSE username : sa password : + maxActive: 1000 + initialSize: 5 + minIdle: 5 + maxWait: 50000 max-pool-size: 20 borrow-connection-timeout: 1000 connectionfactory: @@ -31,6 +35,11 @@ hsweb: url: jdbc:h2:mem:test;DB_CLOSE_ON_EXIT=FALSE username: sa password: + filters: stat + maxActive: 1000 + initialSize: 5 + minIdle: 5 + maxWait: 50000 max-pool-size: 20 borrow-connection-timeout: 1000 test_ds2: diff --git a/hsweb-datasource/hsweb-datasource-web/pom.xml b/hsweb-datasource/hsweb-datasource-web/pom.xml index 539536d81..2c9fec927 100644 --- a/hsweb-datasource/hsweb-datasource-web/pom.xml +++ b/hsweb-datasource/hsweb-datasource-web/pom.xml @@ -5,7 +5,7 @@ hsweb-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-datasource/pom.xml b/hsweb-datasource/pom.xml index 3b800651b..b0ca74131 100644 --- a/hsweb-datasource/pom.xml +++ b/hsweb-datasource/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-logging/hsweb-access-logging-aop/pom.xml b/hsweb-logging/hsweb-access-logging-aop/pom.xml index 1fc535192..b47b29d01 100644 --- a/hsweb-logging/hsweb-access-logging-aop/pom.xml +++ b/hsweb-logging/hsweb-access-logging-aop/pom.xml @@ -5,7 +5,7 @@ hsweb-logging org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-logging/hsweb-access-logging-api/pom.xml b/hsweb-logging/hsweb-access-logging-api/pom.xml index c2edfa3a1..32d5b7784 100644 --- a/hsweb-logging/hsweb-access-logging-api/pom.xml +++ b/hsweb-logging/hsweb-access-logging-api/pom.xml @@ -5,7 +5,7 @@ hsweb-logging org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-logging/pom.xml b/hsweb-logging/pom.xml index 8ef2003b0..10508c396 100644 --- a/hsweb-logging/pom.xml +++ b/hsweb-logging/pom.xml @@ -23,7 +23,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-message/hsweb-message-api/pom.xml b/hsweb-message/hsweb-message-api/pom.xml index 3919f2b72..074bec534 100644 --- a/hsweb-message/hsweb-message-api/pom.xml +++ b/hsweb-message/hsweb-message-api/pom.xml @@ -5,7 +5,7 @@ hsweb-message org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-message/hsweb-message-jms/pom.xml b/hsweb-message/hsweb-message-jms/pom.xml index b641038e9..ab23e9b15 100644 --- a/hsweb-message/hsweb-message-jms/pom.xml +++ b/hsweb-message/hsweb-message-jms/pom.xml @@ -5,7 +5,7 @@ hsweb-message org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/JmsMessagerTest.java b/hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/JmsMessagerTest.java index a3b46a9d5..88a646a8c 100644 --- a/hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/JmsMessagerTest.java +++ b/hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/JmsMessagerTest.java @@ -18,8 +18,6 @@ import static org.hswebframework.web.message.builder.StaticMessageSubjectBuilder import static org.hswebframework.web.message.builder.StaticMessageSubjectBuilder.topic; /** - * TODO 完成注释 - * * @author zhouhao */ @RunWith(SpringRunner.class) @@ -50,7 +48,7 @@ public class JmsMessagerTest { for (int i = 0; i < 100; i++) { - Thread.sleep(1000); + Thread.sleep(100); messager.publish(text("hello jms")) .to(queue("test")) .send(); @@ -67,7 +65,7 @@ public class JmsMessagerTest { for (int i = 0; i < 10; i++) { - Thread.sleep(1000); + Thread.sleep(100); messager.publish(text("hello jms")) .to(topic("test")) .send(); diff --git a/hsweb-message/hsweb-message-redis/pom.xml b/hsweb-message/hsweb-message-redis/pom.xml index 6258d0baa..8401981df 100644 --- a/hsweb-message/hsweb-message-redis/pom.xml +++ b/hsweb-message/hsweb-message-redis/pom.xml @@ -5,7 +5,7 @@ hsweb-message org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-message/hsweb-message-websocket/pom.xml b/hsweb-message/hsweb-message-websocket/pom.xml index 0ba1d3e01..34d20f66b 100644 --- a/hsweb-message/hsweb-message-websocket/pom.xml +++ b/hsweb-message/hsweb-message-websocket/pom.xml @@ -5,7 +5,7 @@ hsweb-message org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-message/pom.xml b/hsweb-message/pom.xml index 36a264e43..480bd9431 100644 --- a/hsweb-message/pom.xml +++ b/hsweb-message/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-starter/hsweb-spring-boot-starter/README.md b/hsweb-starter/hsweb-spring-boot-starter/README.md new file mode 100644 index 000000000..d683db30f --- /dev/null +++ b/hsweb-starter/hsweb-spring-boot-starter/README.md @@ -0,0 +1,30 @@ +# 应用基本信息配置 + +```yaml +hsweb: + app: + name: my-application + comment: 我的应用 + version: 1.0.0 + auto-init: true # 启动服务时进行初始化(执行classpath*:/hsweb-starter.js) +``` + +# 跨域设置 +修改application.yml +```yaml +hsweb: + cors: + enable: true + allowed-headers: "*" + allowed-methods: "*" + allowed-origins: "*" + allow-credentials: true + max-age: 14400 +``` + +# json序列化配置 + +```yaml +fastjson: + features: WriteNullListAsEmpty,WriteNullNumberAsZero,WriteNullBooleanAsFalse +``` diff --git a/hsweb-starter/hsweb-spring-boot-starter/pom.xml b/hsweb-starter/hsweb-spring-boot-starter/pom.xml index 5fad78c1b..aab132367 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/pom.xml +++ b/hsweb-starter/hsweb-spring-boot-starter/pom.xml @@ -23,7 +23,7 @@ hsweb-starter org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/AppProperties.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/AppProperties.java index d2c4658aa..122553730 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/AppProperties.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/AppProperties.java @@ -18,13 +18,19 @@ package org.hswebframework.web.starter; +import lombok.Getter; +import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; /** * @author zhouhao */ @ConfigurationProperties(prefix = "hsweb.app") +@Getter +@Setter public class AppProperties { + private boolean autoInit = true; + private String name; private String comment; private String website; @@ -38,36 +44,4 @@ public class AppProperties { systemVersion.setVersion(version); return systemVersion; } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getWebsite() { - return website; - } - - public void setWebsite(String website) { - this.website = website; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } } diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java index 39e12dfe1..a3edfdeab 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java @@ -18,6 +18,7 @@ package org.hswebframework.web.starter; +import lombok.extern.slf4j.Slf4j; import org.hswebframework.ezorm.rdb.executor.SqlExecutor; import org.hswebframework.ezorm.rdb.meta.RDBDatabaseMetaData; import org.hswebframework.ezorm.rdb.meta.parser.H2TableMetaParser; @@ -63,6 +64,7 @@ import java.util.stream.Stream; @Configuration @EnableConfigurationProperties(AppProperties.class) @Order(Ordered.HIGHEST_PRECEDENCE) +@Slf4j public class SystemInitializeAutoConfiguration implements CommandLineRunner, BeanPostProcessor { @Autowired @@ -107,9 +109,14 @@ public class SystemInitializeAutoConfiguration implements CommandLineRunner, Bea @Override public void run(String... args) throws Exception { + + if (!appProperties.isAutoInit()) { + log.debug("app auto init is disabled"); + return; + } DatabaseType type = DataSourceHolder.currentDatabaseType(); SystemVersion version = appProperties.build(); - if(version.getName()==null){ + if (version.getName() == null) { version.setName("unknown"); } Connection connection = null; diff --git a/hsweb-starter/pom.xml b/hsweb-starter/pom.xml index 7ecfac0ce..a8bcad0da 100644 --- a/hsweb-starter/pom.xml +++ b/hsweb-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/README.md b/hsweb-system/hsweb-system-authorization/README.md index ce5b209c1..ccfd8a6e1 100644 --- a/hsweb-system/hsweb-system-authorization/README.md +++ b/hsweb-system/hsweb-system-authorization/README.md @@ -1,9 +1,9 @@ ## 权限功能模块 -1. 提供用户,角色管理,登录授权等功能 +1. 提供用户,角色管理等基础功能 2. 提供统一的多维度,可拓展的权限分配 - 权限设置不再像以往那样和角色,用户直接关联.在hsweb里,权限设置是通用的. + 权限设置不再像以往那样和角色,用户直接关联.在此模块里,权限设置是通用的. 你可以为用户,角色,自己定义的维度比如:机构,部门,岗位等维度进行权限分配. 而且不仅仅支持基本等RBAC权限控制,还可以自定义控制到数据行和列. @@ -19,21 +19,6 @@ ``` - -## 授权登录接口 -http接口: `POST /authorize/login`, 登录接口支持2种`content-type`,`application/json`(Json RequestBody方式)和`application/x-www-form-urlencoded`(表单方式), -请在调用等时候指定对应等`content-type`.必要参数: `username` 和 `password`. - -⚠️注意: 此接口只实现了简单的登录逻辑,不过会通过发布各种事件来实现自定义的逻辑处理. - -1. `AuthorizationDecodeEvent` 在接收到登录请求之后触发,如果在登录前对用户名密码进行里加密,可以通过监听此事件实现对用户名密码的解密操作 -2. `AuthorizationBeforeEvent` 在`AuthorizationDecodeEvent`事件完成后触发,可通过监听此事件并获取请求参数,实现验证码功能 -3. `AuthorizationSuccessEvent` 在授权成功后触发.注意: 权限控制模块也是通过监听此事件来完成授权 -4. `AuthorizationFailedEvent` 授权失败时触发.当发生过程中异常时触发此事件 - -什么? 还不知道如何监听事件? [快看这里](https://github.com/hs-web/hsweb-framework/wiki/事件驱动) - - -## 权限设置 - -TODO +## 结构 + +![uml](./uml.png "uml.png") diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml index 29fd8bed5..a707f30d1 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml index a4f0da8f4..3c8db5d6a 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthenticationManager.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthenticationManager.java index 68465740f..c966cfb72 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthenticationManager.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthenticationManager.java @@ -1,5 +1,7 @@ package org.hswebframework.web.service.authorization.simple; +import lombok.Getter; +import lombok.Setter; import org.hswebframework.web.authorization.Authentication; import org.hswebframework.web.authorization.AuthenticationInitializeService; import org.hswebframework.web.authorization.AuthenticationManager; @@ -25,6 +27,11 @@ public class SimpleAuthenticationManager implements AuthenticationManager { private AuthenticationInitializeService authenticationInitializeService; + + @Setter + @Getter + private AuthenticationManager parent; + @Autowired private UserService userService; @@ -38,6 +45,11 @@ public class SimpleAuthenticationManager implements AuthenticationManager { this.authenticationInitializeService = authenticationInitializeService; } + public SimpleAuthenticationManager(AuthenticationInitializeService authenticationInitializeService, AuthenticationManager parent) { + this.authenticationInitializeService = authenticationInitializeService; + this.parent = parent; + } + @Autowired public void setAuthenticationInitializeService(AuthenticationInitializeService authenticationInitializeService) { this.authenticationInitializeService = authenticationInitializeService; @@ -45,6 +57,16 @@ public class SimpleAuthenticationManager implements AuthenticationManager { @Override public Authentication authenticate(AuthenticationRequest request) { + if (null != parent) { + try { + Authentication authentication = parent.authenticate(request); + if (null != authentication) { + return authentication; + } + } catch (Exception ignore) { + // ignore errors + } + } if (request instanceof PlainTextUsernamePasswordAuthenticationRequest) { String username = ((PlainTextUsernamePasswordAuthenticationRequest) request).getUsername(); String password = ((PlainTextUsernamePasswordAuthenticationRequest) request).getPassword(); diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleUserService.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleUserService.java index d79454df2..7610bc70d 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleUserService.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleUserService.java @@ -25,6 +25,7 @@ import org.springframework.cache.annotation.Caching; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; @@ -78,7 +79,7 @@ public class SimpleUserService extends AbstractService @Override @Transactional(readOnly = true) public UserEntity selectByUsername(String username) { - if (null == username) { + if (!StringUtils.hasLength(username)) { return null; } return createQuery().where("username", username).single(); @@ -87,8 +88,8 @@ public class SimpleUserService extends AbstractService @Override @Transactional(readOnly = true) public UserEntity selectByUserNameAndPassword(String plainUsername, String plainPassword) { - Objects.requireNonNull(plainUsername); - Objects.requireNonNull(plainPassword); + Assert.hasLength(plainUsername, "用户名不能为空"); + Assert.hasLength(plainPassword, "密码不能为空"); return Optional.ofNullable(selectByUsername(plainUsername)) .filter(user -> encodePassword(plainPassword, user.getSalt()).equals(user.getPassword())) diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml index 20db1caf7..3477dd527 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml @@ -22,7 +22,7 @@ hsweb-system-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java index cd478f14a..fbdf3769d 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java @@ -20,16 +20,18 @@ package org.hswebframework.web.authorization.starter; import org.hswebframework.web.authorization.AuthenticationInitializeService; import org.hswebframework.web.authorization.AuthenticationManager; +import org.hswebframework.web.authorization.basic.embed.EmbedAuthenticationManager; import org.hswebframework.web.authorization.simple.DefaultAuthorizationAutoConfiguration; import org.hswebframework.web.service.authorization.simple.SimpleAuthenticationManager; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.AutoConfigureBefore; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Primary; /** * @author zhouhao @@ -41,12 +43,33 @@ import org.springframework.context.annotation.Import; @AutoConfigureBefore(value = { DefaultAuthorizationAutoConfiguration.class }, name = "org.hswebframework.web.authorization.basic.configuration.AuthorizingHandlerAutoConfiguration") -@Import(BasicAuthorizationConfiguration.class) public class AuthorizationAutoConfiguration { - @Bean - public AuthenticationManager authenticationManager(AuthenticationInitializeService authenticationInitializeService) { - return new SimpleAuthenticationManager(authenticationInitializeService); + @ConditionalOnMissingClass("org.hswebframework.web.authorization.basic.embed.EmbedAuthenticationManager") + @Configuration + public static class NoEmbedAuthenticationManagerAutoConfiguration { + @Bean + @Primary + public AuthenticationManager authenticationManager(AuthenticationInitializeService authenticationInitializeService) { + return new SimpleAuthenticationManager(authenticationInitializeService); + } + + } + + @ConditionalOnClass(EmbedAuthenticationManager.class) + @Configuration + public static class EmbedAuthenticationManagerAutoConfiguration { + @Bean + public EmbedAuthenticationManager embedAuthenticationManager() { + return new EmbedAuthenticationManager(); + } + + @Bean + @Primary + public AuthenticationManager authenticationManager(EmbedAuthenticationManager embedAuthenticationManager, + AuthenticationInitializeService authenticationInitializeService) { + return new SimpleAuthenticationManager(authenticationInitializeService, embedAuthenticationManager); + } } @Bean diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationConfiguration.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationConfiguration.java deleted file mode 100644 index 708dee3fc..000000000 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationConfiguration.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.hswebframework.web.authorization.starter; - -import org.hswebframework.web.authorization.basic.web.UserTokenForTypeParser; -import org.hswebframework.web.authorization.token.UserTokenManager; -import org.hswebframework.web.service.authorization.UserService; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author zhouhao - * @since 3.0 - */ -@Configuration -@ConditionalOnProperty(prefix = "hsweb.authorize", name = "basic-authorization", havingValue = "true") -@ConditionalOnClass(UserTokenForTypeParser.class) -public class BasicAuthorizationConfiguration { - - @Bean - public BasicAuthorizationTokenParser basicAuthorizationTokenParser(UserService userService, UserTokenManager tokenManager) { - return new BasicAuthorizationTokenParser(userService, tokenManager); - } - -} diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/FixBug89Test.groovy b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/FixBug89Test.groovy new file mode 100644 index 000000000..a81790926 --- /dev/null +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/FixBug89Test.groovy @@ -0,0 +1,73 @@ +package org.hswebframework.web.authorization.starter + +import com.alibaba.fastjson.JSON +import org.hswebframework.web.entity.authorization.UserEntity +import org.hswebframework.web.service.authorization.UserService +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.context.ConfigurableApplicationContext +import org.springframework.context.annotation.Configuration +import org.springframework.http.MediaType +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.web.WebAppConfiguration +import org.springframework.test.web.servlet.MockMvc +import org.springframework.test.web.servlet.setup.MockMvcBuilders +import spock.lang.Shared +import spock.lang.Specification +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.* + + +@WebAppConfiguration +@ContextConfiguration +@SpringBootTest(classes = [TestApplication.class], properties = ["classpath:application.yml"]) +@Configuration +class FixBug89Test extends Specification { + + @Autowired + private ConfigurableApplicationContext context; + + @Shared + private MockMvc mockMvc; + + @Autowired + private UserService userService; + + + void setup() { + mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); + UserEntity userEntity = userService.createEntity(); + userEntity.setName("test"); + userEntity.setUsername("fix-bug#89"); + userEntity.setPassword("fix-bug#89"); + if (userService.selectByUsername("fix-bug#89") == null) { + userService.insert(userEntity); + } + } + + def doLogin(username, password) { + def response = mockMvc.perform(post("/authorize/login") + .contentType(MediaType.APPLICATION_JSON) + .content("""{"username":"${username}","password":"${password}"}""")) +// .andExpect(status().is(200)) + .andReturn() + .getResponse() + .getContentAsString() + return JSON.parseObject(response).get("status"); + } + + def "测试用户名为空时登录依旧能登录成功问题"() { + given: + def user = userService.selectByUserNameAndPassword("fix-bug#89", "fix-bug#89"); + expect: + user != null + doLogin(username, password) == code + where: + username | password | code + "fix-bug#89" | "fix-bug#89" | 200 + "fix-bug#89" | "" | 400 + "" | "fix-bug#89" | 400 + "" | "" | 400 + + + } +} diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/TestApplication.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/TestApplication.java new file mode 100644 index 000000000..8c2081048 --- /dev/null +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/TestApplication.java @@ -0,0 +1,24 @@ +package org.hswebframework.web.authorization.starter; + +import org.hswebframework.web.authorization.basic.web.AuthorizationController; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.web.WebAppConfiguration; + +/** + * @author zhouhao + * @since 3.0.0-RC + */ +@SpringBootApplication +@WebAppConfiguration +@Configuration +public class TestApplication { + + @Bean + public AuthorizationController authorizationController() { + return new AuthorizationController(); + } + + +} diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy similarity index 92% rename from hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy rename to hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy index 07c6c6a38..41be44131 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/groovy/org/hswebframework/web/authorization/starter/UserSettingControllerTest.groovy @@ -19,6 +19,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders import spock.lang.Shared import spock.lang.Specification +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @@ -62,10 +63,11 @@ class UserSettingControllerTest extends Specification { ] permissions.forEach({ permission -> //添加权限 - mockMvc.perform(post("/permission") + mockMvc.perform(patch("/permission") .contentType(MediaType.APPLICATION_JSON) .content(JSON.toJSONString(permission))) - .andExpect(status().is(201)) + .andDo({ result -> println result.response.contentAsString }) + .andExpect(status().is(200)) }) } @@ -84,6 +86,7 @@ class UserSettingControllerTest extends Specification { } """ )) + .andDo({ result -> println result.response.contentAsString }) .andExpect(status().is(201)) .andReturn() .getResponse() @@ -127,7 +130,8 @@ class UserSettingControllerTest extends Specification { ] ] ]) - )).andExpect(status().is(201)) + )).andDo({ result -> println result.response.contentAsString }) +// .andExpect(status().is(201)) expect: userId != null def autz = initializeService.initUserAuthorization(userId) diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/resources/application.yml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/resources/application.yml index f203b0d9c..a2d76338f 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/resources/application.yml +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/resources/application.yml @@ -12,8 +12,8 @@ hsweb: name: 权限管理测试 version: 3.0.0 authorize: - sync: true - auto-parse: true + sync: false + auto-parse: false logging: level: org.springframework: WARN diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml index fd0fb7e90..684c438db 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-authorization org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/pom.xml b/hsweb-system/hsweb-system-authorization/pom.xml index 66cd9d027..62fb7c645 100644 --- a/hsweb-system/hsweb-system-authorization/pom.xml +++ b/hsweb-system/hsweb-system-authorization/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-authorization/uml.png b/hsweb-system/hsweb-system-authorization/uml.png new file mode 100644 index 000000000..5a18ac480 Binary files /dev/null and b/hsweb-system/hsweb-system-authorization/uml.png differ diff --git a/hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml b/hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml index a2b67bc05..918d2066c 100644 --- a/hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml +++ b/hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml @@ -23,7 +23,7 @@ hsweb-system-config org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml b/hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml index c5c1c2f53..e4c01bee0 100644 --- a/hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml +++ b/hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml @@ -23,7 +23,7 @@ hsweb-system-config org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml b/hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml index deaba3cf7..4610977e6 100644 --- a/hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml +++ b/hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-config org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml b/hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml index 4691fc75a..6317696be 100644 --- a/hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml +++ b/hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml @@ -23,7 +23,7 @@ hsweb-system-config org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-config/pom.xml b/hsweb-system/hsweb-system-config/pom.xml index c38c2745b..15c9080e5 100644 --- a/hsweb-system/hsweb-system-config/pom.xml +++ b/hsweb-system/hsweb-system-config/pom.xml @@ -23,7 +23,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml index 5f5dd944d..f817be5f9 100644 --- a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml +++ b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dashboard org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml index 28ee29f73..1c00e298a 100644 --- a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml +++ b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dashboard org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml index 18abd26be..f7fc7a49f 100644 --- a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml +++ b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dashboard org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml index 5b06435b7..cfea2ee9e 100644 --- a/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml +++ b/hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dashboard org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dashboard/pom.xml b/hsweb-system/hsweb-system-dashboard/pom.xml index 43bab20ca..127a9f089 100644 --- a/hsweb-system/hsweb-system-dashboard/pom.xml +++ b/hsweb-system/hsweb-system-dashboard/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml index 958cf1371..d11ea1919 100644 --- a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml +++ b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-database-manager org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-local/pom.xml b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-local/pom.xml index 956839636..7ecd619b8 100644 --- a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-local/pom.xml +++ b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-database-manager org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-starter/pom.xml b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-starter/pom.xml index 4b9c2f14c..6c6538f75 100644 --- a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-starter/pom.xml +++ b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-database-manager org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-web/pom.xml b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-web/pom.xml index 78c460983..1d998ec5b 100644 --- a/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-web/pom.xml +++ b/hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-database-manager org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-database-manager/pom.xml b/hsweb-system/hsweb-system-database-manager/pom.xml index 3634deffe..70a0c0181 100644 --- a/hsweb-system/hsweb-system-database-manager/pom.xml +++ b/hsweb-system/hsweb-system-database-manager/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-api/pom.xml b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-api/pom.xml index d5eefdd2d..9d0d8c1a3 100644 --- a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-api/pom.xml +++ b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-local/pom.xml b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-local/pom.xml index 4f3bdf1c7..82ee85741 100644 --- a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-local/pom.xml +++ b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-starter/pom.xml b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-starter/pom.xml index 79028a696..fe9915b81 100644 --- a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-starter/pom.xml +++ b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-web/pom.xml b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-web/pom.xml index 2739fc5c9..5a25324da 100644 --- a/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-web/pom.xml +++ b/hsweb-system/hsweb-system-datasource/hsweb-system-datasource-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-datasource org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-datasource/pom.xml b/hsweb-system/hsweb-system-datasource/pom.xml index 0fe872a13..220e839cc 100644 --- a/hsweb-system/hsweb-system-datasource/pom.xml +++ b/hsweb-system/hsweb-system-datasource/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml diff --git a/hsweb-system/hsweb-system-dev-tools/pom.xml b/hsweb-system/hsweb-system-dev-tools/pom.xml index a00c3e461..fa11a10bb 100644 --- a/hsweb-system/hsweb-system-dev-tools/pom.xml +++ b/hsweb-system/hsweb-system-dev-tools/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/pom.xml b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/pom.xml index c99c53fff..1e3d44ac0 100644 --- a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/pom.xml +++ b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dictionary org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-local/pom.xml b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-local/pom.xml index f94a57287..9fbd3ad2b 100644 --- a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-local/pom.xml +++ b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dictionary org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml index 5a195a70f..42d05ff4a 100644 --- a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml +++ b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml @@ -22,7 +22,7 @@ hsweb-system-dictionary org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-web/pom.xml b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-web/pom.xml index de69e4efa..b0217f0be 100644 --- a/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-web/pom.xml +++ b/hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dictionary org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dictionary/pom.xml b/hsweb-system/hsweb-system-dictionary/pom.xml index 248b82645..557d62baf 100644 --- a/hsweb-system/hsweb-system-dictionary/pom.xml +++ b/hsweb-system/hsweb-system-dictionary/pom.xml @@ -22,7 +22,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-api/pom.xml b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-api/pom.xml index 142806cc3..dc88f3244 100644 --- a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-api/pom.xml +++ b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dynamic-form org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/pom.xml b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/pom.xml index 2223e349b..97ae69591 100644 --- a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/pom.xml +++ b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dynamic-form org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 @@ -15,9 +15,8 @@ - javax.el - javax.el-api - 2.2.4 + org.glassfish + javax.el true diff --git a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/pom.xml b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/pom.xml index 625061823..4fa5e2a09 100644 --- a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/pom.xml +++ b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dynamic-form org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/src/test/java/org/hswebframework/web/service/form/simple/SimpleDynamicFormServiceTest.java b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/src/test/java/org/hswebframework/web/service/form/simple/SimpleDynamicFormServiceTest.java index c00e0edc1..505d2f2b9 100644 --- a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/src/test/java/org/hswebframework/web/service/form/simple/SimpleDynamicFormServiceTest.java +++ b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-starter/src/test/java/org/hswebframework/web/service/form/simple/SimpleDynamicFormServiceTest.java @@ -13,6 +13,7 @@ import org.hswebframework.web.tests.SimpleWebApplicationTests; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.sql.Array; @@ -45,7 +46,7 @@ public class SimpleDynamicFormServiceTest extends SimpleWebApplicationTests { private SqlExecutor sqlExecutor; @Test - @Transactional + @Transactional(propagation = Propagation.NOT_SUPPORTED) public void testDeploy() throws SQLException { DynamicFormEntity form = entityFactory.newInstance(DynamicFormEntity.class); form.setName("test"); diff --git a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-web/pom.xml b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-web/pom.xml index f0b0584b0..443811019 100644 --- a/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-web/pom.xml +++ b/hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-dynamic-form org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-dynamic-form/pom.xml b/hsweb-system/hsweb-system-dynamic-form/pom.xml index 3a8c54ed9..2dcd80bd8 100644 --- a/hsweb-system/hsweb-system-dynamic-form/pom.xml +++ b/hsweb-system/hsweb-system-dynamic-form/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/hsweb-system-file-api/pom.xml b/hsweb-system/hsweb-system-file/hsweb-system-file-api/pom.xml index 65b46c6ab..a38bf5582 100644 --- a/hsweb-system/hsweb-system-file/hsweb-system-file-api/pom.xml +++ b/hsweb-system/hsweb-system-file/hsweb-system-file-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-file org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/hsweb-system-file-local/pom.xml b/hsweb-system/hsweb-system-file/hsweb-system-file-local/pom.xml index 0f7aa87ac..3df26c614 100644 --- a/hsweb-system/hsweb-system-file/hsweb-system-file-local/pom.xml +++ b/hsweb-system/hsweb-system-file/hsweb-system-file-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-file org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/hsweb-system-file-oauth2/pom.xml b/hsweb-system/hsweb-system-file/hsweb-system-file-oauth2/pom.xml index 594ec6372..85034f078 100644 --- a/hsweb-system/hsweb-system-file/hsweb-system-file-oauth2/pom.xml +++ b/hsweb-system/hsweb-system-file/hsweb-system-file-oauth2/pom.xml @@ -5,7 +5,7 @@ hsweb-system-file org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/hsweb-system-file-starter/pom.xml b/hsweb-system/hsweb-system-file/hsweb-system-file-starter/pom.xml index 62662ef7f..b88984b37 100644 --- a/hsweb-system/hsweb-system-file/hsweb-system-file-starter/pom.xml +++ b/hsweb-system/hsweb-system-file/hsweb-system-file-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-file org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/hsweb-system-file-web/pom.xml b/hsweb-system/hsweb-system-file/hsweb-system-file-web/pom.xml index a2d898c07..a86b1ce44 100644 --- a/hsweb-system/hsweb-system-file/hsweb-system-file-web/pom.xml +++ b/hsweb-system/hsweb-system-file/hsweb-system-file-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-file org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-file/pom.xml b/hsweb-system/hsweb-system-file/pom.xml index 1d6169709..456f3723f 100644 --- a/hsweb-system/hsweb-system-file/pom.xml +++ b/hsweb-system/hsweb-system-file/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-api/pom.xml b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-api/pom.xml index cd1afb139..eb0142c61 100644 --- a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-api/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-oauth2-client org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-local/pom.xml b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-local/pom.xml index 56851b8bd..7b48cb938 100644 --- a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-local/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-oauth2-client org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-starter/pom.xml b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-starter/pom.xml index 35ab3683b..030dd9cdc 100644 --- a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-starter/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-starter/pom.xml @@ -22,7 +22,7 @@ hsweb-system-oauth2-client org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-web/pom.xml b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-web/pom.xml index 06fa6a9fd..d40945c25 100644 --- a/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-web/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-oauth2-client org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-client/pom.xml b/hsweb-system/hsweb-system-oauth2-client/pom.xml index b7bcbfedc..b4ed57096 100644 --- a/hsweb-system/hsweb-system-oauth2-client/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-client/pom.xml @@ -23,7 +23,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-local/pom.xml b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-local/pom.xml index b22beb1ee..0e23d4584 100644 --- a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-local/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-oauth2-server org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml index 2e1714d90..29591903b 100644 --- a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml @@ -23,7 +23,7 @@ hsweb-system-oauth2-server org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-web/pom.xml b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-web/pom.xml index 9fb47d668..ee0e714b3 100644 --- a/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-web/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-oauth2-server org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-oauth2-server/pom.xml b/hsweb-system/hsweb-system-oauth2-server/pom.xml index 2900a97d4..40205ed48 100644 --- a/hsweb-system/hsweb-system-oauth2-server/pom.xml +++ b/hsweb-system/hsweb-system-oauth2-server/pom.xml @@ -23,7 +23,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/pom.xml b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/pom.xml index b518f3ed9..08b18ec07 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/pom.xml +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-organizational org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/pom.xml b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/pom.xml index d2016d6da..81a2ef586 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/pom.xml +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/pom.xml @@ -5,7 +5,7 @@ hsweb-system-organizational org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-local/pom.xml b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-local/pom.xml index 9b1cef23d..e73cbd9eb 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-local/pom.xml +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-organizational org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml index 502612f1f..12ea2f166 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml @@ -22,7 +22,7 @@ hsweb-system-organizational org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-web/pom.xml b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-web/pom.xml index b48a392d4..4ec6b9829 100644 --- a/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-web/pom.xml +++ b/hsweb-system/hsweb-system-organizational/hsweb-system-organizational-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-organizational org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-organizational/pom.xml b/hsweb-system/hsweb-system-organizational/pom.xml index 4bc57f901..7402b10f2 100644 --- a/hsweb-system/hsweb-system-organizational/pom.xml +++ b/hsweb-system/hsweb-system-organizational/pom.xml @@ -22,7 +22,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-api/pom.xml b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-api/pom.xml index 9f59ebc36..8ea7dccda 100644 --- a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-api/pom.xml +++ b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-schedule org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-local/pom.xml b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-local/pom.xml index b3ec9ed4f..f0cca4acc 100644 --- a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-local/pom.xml +++ b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-schedule org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-starter/pom.xml b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-starter/pom.xml index 24e713704..4a16d8986 100644 --- a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-starter/pom.xml +++ b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-schedule org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-web/pom.xml b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-web/pom.xml index 0aa94cfe9..4361b966d 100644 --- a/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-web/pom.xml +++ b/hsweb-system/hsweb-system-schedule/hsweb-system-schedule-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-schedule org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-schedule/pom.xml b/hsweb-system/hsweb-system-schedule/pom.xml index 1fe2bfeb4..3001a243f 100644 --- a/hsweb-system/hsweb-system-schedule/pom.xml +++ b/hsweb-system/hsweb-system-schedule/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 pom diff --git a/hsweb-system/hsweb-system-script/hsweb-system-script-api/pom.xml b/hsweb-system/hsweb-system-script/hsweb-system-script-api/pom.xml index 3f4a6f13b..ac353a65f 100644 --- a/hsweb-system/hsweb-system-script/hsweb-system-script-api/pom.xml +++ b/hsweb-system/hsweb-system-script/hsweb-system-script-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-script org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-script/hsweb-system-script-local/pom.xml b/hsweb-system/hsweb-system-script/hsweb-system-script-local/pom.xml index ed08f8043..b7c2d5f1a 100644 --- a/hsweb-system/hsweb-system-script/hsweb-system-script-local/pom.xml +++ b/hsweb-system/hsweb-system-script/hsweb-system-script-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-script org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-script/hsweb-system-script-starter/pom.xml b/hsweb-system/hsweb-system-script/hsweb-system-script-starter/pom.xml index 46bb9a46b..e4960d9d2 100644 --- a/hsweb-system/hsweb-system-script/hsweb-system-script-starter/pom.xml +++ b/hsweb-system/hsweb-system-script/hsweb-system-script-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-script org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-script/hsweb-system-script-web/pom.xml b/hsweb-system/hsweb-system-script/hsweb-system-script-web/pom.xml index 0e19e4d0e..31ca0a9ad 100644 --- a/hsweb-system/hsweb-system-script/hsweb-system-script-web/pom.xml +++ b/hsweb-system/hsweb-system-script/hsweb-system-script-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-script org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-script/pom.xml b/hsweb-system/hsweb-system-script/pom.xml index 72b68ebb8..d011606e1 100644 --- a/hsweb-system/hsweb-system-script/pom.xml +++ b/hsweb-system/hsweb-system-script/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-template/hsweb-system-template-api/pom.xml b/hsweb-system/hsweb-system-template/hsweb-system-template-api/pom.xml index 96612295c..939f66d11 100644 --- a/hsweb-system/hsweb-system-template/hsweb-system-template-api/pom.xml +++ b/hsweb-system/hsweb-system-template/hsweb-system-template-api/pom.xml @@ -5,7 +5,7 @@ hsweb-system-template org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-template/hsweb-system-template-local/pom.xml b/hsweb-system/hsweb-system-template/hsweb-system-template-local/pom.xml index b3d6736a7..b3b4a7ab5 100644 --- a/hsweb-system/hsweb-system-template/hsweb-system-template-local/pom.xml +++ b/hsweb-system/hsweb-system-template/hsweb-system-template-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-template org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml b/hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml index 1b6316212..d8d6cc66c 100644 --- a/hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml +++ b/hsweb-system/hsweb-system-template/hsweb-system-template-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-template org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-template/hsweb-system-template-web/pom.xml b/hsweb-system/hsweb-system-template/hsweb-system-template-web/pom.xml index 1df9def3a..fc113258f 100644 --- a/hsweb-system/hsweb-system-template/hsweb-system-template-web/pom.xml +++ b/hsweb-system/hsweb-system-template/hsweb-system-template-web/pom.xml @@ -5,7 +5,7 @@ hsweb-system-template org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-template/pom.xml b/hsweb-system/hsweb-system-template/pom.xml index ccae7454b..3201c4a20 100644 --- a/hsweb-system/hsweb-system-template/pom.xml +++ b/hsweb-system/hsweb-system-template/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/pom.xml b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/pom.xml index 0a23160ca..6d1177234 100644 --- a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/pom.xml +++ b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/pom.xml @@ -5,7 +5,7 @@ hsweb-system-workflow org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-starter/pom.xml b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-starter/pom.xml index 7ab6313d6..49d023d43 100644 --- a/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-starter/pom.xml +++ b/hsweb-system/hsweb-system-workflow/hsweb-system-workflow-starter/pom.xml @@ -5,7 +5,7 @@ hsweb-system-workflow org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/hsweb-system-workflow/pom.xml b/hsweb-system/hsweb-system-workflow/pom.xml index 2b7d73cd5..d208440d3 100644 --- a/hsweb-system/hsweb-system-workflow/pom.xml +++ b/hsweb-system/hsweb-system-workflow/pom.xml @@ -5,7 +5,7 @@ hsweb-system org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-system/pom.xml b/hsweb-system/pom.xml index f806b363c..ed370d94a 100644 --- a/hsweb-system/pom.xml +++ b/hsweb-system/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-tests/pom.xml b/hsweb-tests/pom.xml index 4b756c32a..435d2e180 100644 --- a/hsweb-tests/pom.xml +++ b/hsweb-tests/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 @@ -19,9 +19,8 @@ - javax.el - el-api - 2.2 + org.glassfish + javax.el diff --git a/hsweb-thirdparty/hsweb-thirdparty-ueditor/pom.xml b/hsweb-thirdparty/hsweb-thirdparty-ueditor/pom.xml index 9f5f0be58..2ccca1df1 100644 --- a/hsweb-thirdparty/hsweb-thirdparty-ueditor/pom.xml +++ b/hsweb-thirdparty/hsweb-thirdparty-ueditor/pom.xml @@ -5,7 +5,7 @@ hsweb-thirdparty org.hswebframework.web - 3.0.0 + 3.0.1 ../pom.xml 4.0.0 diff --git a/hsweb-thirdparty/pom.xml b/hsweb-thirdparty/pom.xml index 4f504ffd2..a61d31b33 100644 --- a/hsweb-thirdparty/pom.xml +++ b/hsweb-thirdparty/pom.xml @@ -5,7 +5,7 @@ hsweb-framework org.hswebframework.web - 3.0.0 + 3.0.1 4.0.0 diff --git a/pom.xml b/pom.xml index a698e6c12..aaa1d152d 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.hswebframework.web hsweb-framework - 3.0.0 + 3.0.1 hsweb-starter hsweb-core @@ -232,15 +232,43 @@ + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.6.1 + + + + + addTestSources + + compile + + compileTests + + + + + + + + org.codehaus.groovy + groovy-all + 2.4.15 + + + org.apache.maven.plugins maven-surefire-plugin 2.17 - - **/org/hswebframework/**/*Tests.java - + **/*Test.java + **/*Test.groovy + **/*Tests.java + **/*Test.groovy + **/*Spec.java @@ -252,6 +280,12 @@ + + org.codehaus.groovy + groovy-all + 2.4.15 + pom + org.projectlombok lombok diff --git a/quick-start/AUTZ.md b/quick-start/AUTZ.md index 0818e6826..ab0d1c6f6 100644 --- a/quick-start/AUTZ.md +++ b/quick-start/AUTZ.md @@ -138,3 +138,15 @@ Set canQueryDepartment= authentication.getPermission("test") .orElseThrow(AccessDenyException::new); ``` + +# 使用数据库来维护用户以及权限信息 + +在上述说明中是通过配置文件来进行用户以及权限配置的,在hsweb-system模块中还提供了使用数据库来来进行更灵活的权限信息配置 + +[请看这里](../hsweb-system/hsweb-system-authorization) + +# 会话状态 + +默认使用`sessionId`来作为用户的`token`,你也可以通过拓展来实现自定义的`token`策略: + +[请看这里](https://github.com/hs-web/hsweb-framework/wiki/autz#%E8%87%AA%E5%AE%9A%E4%B9%89token%E7%AD%96%E7%95%A5%E5%AE%9E%E7%8E%B0%E5%89%8D%E5%90%8E%E5%88%86%E7%A6%BB) \ No newline at end of file diff --git a/quick-start/README.md b/quick-start/README.md index afcdc9f7d..385618643 100644 --- a/quick-start/README.md +++ b/quick-start/README.md @@ -6,6 +6,7 @@ 1. [前言](#前言) 2. [创建项目](#创建项目) 3. [增删改查](#增删改查) +4. [更多教程](#更多教程) ## 前言 `hsweb`是基于`java8`,`spring-boot`,`mybatis`开发.所以在开始使用`hsweb`的前,你至少应该掌握以下技术:`java`,`maven`. @@ -380,7 +381,7 @@ public interface TestDao extends CrudDao { - + @@ -552,5 +553,7 @@ class TestControllerTest extends Specification { 一个最简单的通用crud例子完成了!! -更多教程: [通用增删改查使用](USE-CRUD.md) , [权限控制](AUTZ.md) ,[业务功能](SYSTEM.md) , [实用工具包](UTILS.md) +## 更多教程 + +[通用增删改查使用](USE-CRUD.md) , [权限控制](AUTZ.md) ,[业务功能](SYSTEM.md) , [实用工具包](UTILS.md)