diff --git a/LICENSE b/LICENSE
index 2ad5ef8e0..82a23c4ec 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2016 http://hsweb.me
+ Copyright 2019 http://hsweb.me
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index fe4208ea2..9c90de4ae 100644
--- a/README.md
+++ b/README.md
@@ -30,13 +30,12 @@
| 模块 | 说明 | 进度 |
| ------------- |:-------------:| ----|
-|[hsweb-authorization](hsweb-authorization)|权限控制| 90%|
-|[hsweb-commons](hsweb-commons) |基础通用功能| 90%|
+|[hsweb-authorization](hsweb-authorization)|权限控制| 100%|
+|[hsweb-commons](hsweb-commons) |基础通用功能| 100%|
|[hsweb-concurrent](hsweb-concurrent)|并发包,缓存,锁,计数器等| 80%|
-|[hsweb-core](hsweb-core)|框架核心,基础工具类| 90%|
-|[hsweb-datasource](hsweb-datasource)|数据源| 90%|
+|[hsweb-core](hsweb-core)|框架核心,基础工具类| 100%|
+|[hsweb-datasource](hsweb-datasource)|数据源| 100%|
|[hsweb-logging](hsweb-logging)| 日志| 100%|
-|[hsweb-message](hsweb-message)|mq,websocket...| 80%|
-|[hsweb-starter](hsweb-starter)|模块启动器| 90%|
+|[hsweb-starter](hsweb-starter)|模块启动器| 100%|
|[hsweb-system](hsweb-system)|**系统常用功能**| 80%|
|[hsweb-thirdparty](hsweb-thirdparty)| 第三方插件 | 100% |
diff --git a/hsweb-authorization/hsweb-authorization-api/pom.xml b/hsweb-authorization/hsweb-authorization-api/pom.xml
index 481c0d41c..181adb22e 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.4
+ 3.0.5
4.0.0
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authentication.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authentication.java
index 855e27b6f..273ff77db 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authentication.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authentication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationHolder.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationHolder.java
index 6e8c2cc8a..3d2285264 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationHolder.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationInitializeService.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationInitializeService.java
index 835d9c862..d33522141 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationInitializeService.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationInitializeService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationManager.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationManager.java
index 7552b879e..b2edd552d 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationManager.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationSupplier.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationSupplier.java
index 5788f26d4..353e92ac0 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationSupplier.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/AuthenticationSupplier.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/MultiAuthentication.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/MultiAuthentication.java
index c8ef3e464..1fdb69075 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/MultiAuthentication.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/MultiAuthentication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Permission.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Permission.java
index 6e15c124c..f0f39a80c 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Permission.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Permission.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Role.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Role.java
index 19ca0be59..e79df1eed 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Role.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Role.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/User.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/User.java
index 41ec52764..fc219c521 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/User.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/access/DataAccessConfig.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/access/DataAccessConfig.java
index 240dd323e..551ff86a2 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/access/DataAccessConfig.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/access/DataAccessConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Authorize.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Authorize.java
index 491036ddd..e25d70f07 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Authorize.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Authorize.java
@@ -1,6 +1,6 @@
/*
*
- * * Copyright 2016 http://www.hswebframework.org
+ * * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Logical.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Logical.java
index 5fa3383f7..77acb96a3 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Logical.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/Logical.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresDataAccess.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresDataAccess.java
index d62ad822b..ab87fd8ae 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresDataAccess.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresDataAccess.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresExpression.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresExpression.java
index 65815b602..0aec8d9b5 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresExpression.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/RequiresExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/builder/AuthenticationBuilder.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/builder/AuthenticationBuilder.java
index 3f53d40d8..ab8ec6de1 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/builder/AuthenticationBuilder.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/builder/AuthenticationBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/exception/UnAuthorizedException.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/exception/UnAuthorizedException.java
index cdee1a140..a769edfa0 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/exception/UnAuthorizedException.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/exception/UnAuthorizedException.java
@@ -1,6 +1,6 @@
/*
*
- * * Copyright 2016 http://www.hswebframework.org
+ * * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AbstractAuthorizationEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AbstractAuthorizationEvent.java
index db87228d1..907c81f41 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AbstractAuthorizationEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AbstractAuthorizationEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationBeforeEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationBeforeEvent.java
index fbad1997b..1c7672bd8 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationBeforeEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationBeforeEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationDecodeEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationDecodeEvent.java
index d2857e90f..80071046c 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationDecodeEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationDecodeEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationEvent.java
index edf5ed7fa..b3964080c 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationExitEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationExitEvent.java
index c097a8a06..5874ba914 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationExitEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationExitEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationFailedEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationFailedEvent.java
index 603fef98b..cef33618a 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationFailedEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationFailedEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationSuccessEvent.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationSuccessEvent.java
index db7cb6d6a..700a5033c 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationSuccessEvent.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/listener/event/AuthorizationSuccessEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/SimpleAuthentication.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/SimpleAuthentication.java
index 90edfbb85..33092c341 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/SimpleAuthentication.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/SimpleAuthentication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/DefaultUserTokenManager.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/DefaultUserTokenManager.java
index 479080eb5..87e9e832b 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/DefaultUserTokenManager.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/DefaultUserTokenManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/UserTokenManager.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/UserTokenManager.java
index ee19b5b2a..4f0b320ba 100644
--- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/UserTokenManager.java
+++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/token/UserTokenManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-basic/pom.xml b/hsweb-authorization/hsweb-authorization-basic/pom.xml
index 29b9e5455..a0c15efaf 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.4
+ 3.0.5
4.0.0
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java
index 9c39262e5..97b86ecbe 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java
@@ -100,15 +100,13 @@ public AuthorizeDefinition parse(Class target, Method method, MethodInterceptorC
authorizeDefinition.put(expression);
- if (methodAuth != null) {
- authorizeDefinition.put(methodAuth.dataAccess());
- }
authorizeDefinition.put(classDataAccess);
authorizeDefinition.put(methodDataAccess);
if (authorizeDefinition.getPermissionDescription().length == 0) {
if (classAuth != null) {
+ authorizeDefinition.put(classAuth.dataAccess());
String[] desc = classAuth.description();
if (desc.length > 0) {
authorizeDefinition.setPermissionDescription(desc);
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/define/DefaultBasicAuthorizeDefinition.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/define/DefaultBasicAuthorizeDefinition.java
index 7666e63f2..c66f83a38 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/define/DefaultBasicAuthorizeDefinition.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/define/DefaultBasicAuthorizeDefinition.java
@@ -82,6 +82,7 @@ public void put(Authorize authorize) {
}
message = authorize.message();
phased = authorize.phased();
+ put(authorize.dataAccess());
}
public void put(RequiresExpression expression) {
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/CustomDataAccessHandler.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/CustomDataAccessHandler.java
index 40538260a..8b51669cd 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/CustomDataAccessHandler.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/CustomDataAccessHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldFilterDataAccessHandler.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldFilterDataAccessHandler.java
index 99b943422..64201312e 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldFilterDataAccessHandler.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldFilterDataAccessHandler.java
@@ -17,6 +17,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -87,7 +88,7 @@ protected boolean doUpdateAccess(FieldFilterDataAccessConfig accesses, Authorizi
@SuppressWarnings("all")
protected boolean doQueryAccess(FieldFilterDataAccessConfig access, AuthorizingContext context) {
- if (context.getDefinition().getPhased() == Phased.before) {
+ if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
QueryParamEntity entity = context.getParamContext().getParams()
.values().stream()
.filter(QueryParamEntity.class::isInstance)
@@ -97,7 +98,8 @@ protected boolean doQueryAccess(FieldFilterDataAccessConfig access, AuthorizingC
logger.warn("try validate query access, but query entity is null or not instance of org.hswebframework.web.commons.entity.Entity");
return true;
}
- entity.excludes(access.getFields().toArray(new String[access.getFields().size()]));
+ Set denyFields = access.getFields();
+ entity.excludes(denyFields.toArray(new String[denyFields.size()]));
} else {
Object result = InvokeResultUtils.convertRealResult(context.getParamContext().getInvokeResult());
if (result instanceof Collection) {
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldScopeDataAccessHandler.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldScopeDataAccessHandler.java
index 4131da265..351d80a03 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldScopeDataAccessHandler.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/FieldScopeDataAccessHandler.java
@@ -84,7 +84,7 @@ protected boolean doRWAccess(FieldScopeDataAccessConfig access, AuthorizingConte
@SuppressWarnings("all")
protected boolean doQueryAccess(FieldScopeDataAccessConfig access, AuthorizingContext context) {
- if (context.getDefinition().getPhased() == Phased.before) {
+ if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
QueryParamEntity entity = context.getParamContext().getParams()
.values().stream()
.filter(QueryParamEntity.class::isInstance)
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/InvokeResultUtils.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/InvokeResultUtils.java
index b79bd9ead..2256a47aa 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/InvokeResultUtils.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/InvokeResultUtils.java
@@ -1,15 +1,19 @@
package org.hswebframework.web.authorization.basic.handler.access;
+import org.hswebframework.web.commons.entity.PagerResult;
import org.hswebframework.web.controller.message.ResponseMessage;
import org.springframework.http.ResponseEntity;
public class InvokeResultUtils {
public static Object convertRealResult(Object result) {
+ if (result instanceof ResponseEntity) {
+ result = ((ResponseEntity) result).getBody();
+ }
if (result instanceof ResponseMessage) {
- return ((ResponseMessage) result).getResult();
+ result = ((ResponseMessage) result).getResult();
}
- if (result instanceof ResponseEntity) {
- return ((ResponseEntity) result).getBody();
+ if (result instanceof PagerResult) {
+ result = ((PagerResult) result).getData();
}
return result;
}
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/OwnCreatedDataAccessHandler.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/OwnCreatedDataAccessHandler.java
index abe15f47d..4f70701cf 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/OwnCreatedDataAccessHandler.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/handler/access/OwnCreatedDataAccessHandler.java
@@ -99,7 +99,7 @@ protected boolean doRWAccess(OwnCreatedDataAccessConfig access, AuthorizingConte
protected boolean doQueryAccess(OwnCreatedDataAccessConfig access, AuthorizingContext context) {
String userId = context.getAuthentication().getUser().getId();
- if (context.getDefinition().getPhased() == Phased.before) {
+ if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
Entity entity = context.getParamContext().getParams()
.values().stream()
.filter(Entity.class::isInstance)
@@ -144,8 +144,7 @@ protected boolean matchCreatorId(Object result, String userId) {
} else if (result instanceof Collection) {
Collection> collection = ((Collection) result);
//删掉不能访问的对象
- collection.removeAll(collection.stream().filter((Object o) -> !matchCreatorId(o, userId))
- .collect(Collectors.toList()));
+ collection.removeAll(collection.stream().filter((Object o) -> !matchCreatorId(o, userId)).collect(Collectors.toList()));
} else {
try {
return userId.equals(PropertyUtils.getProperty(result, "creatorId"));
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 3bbe0b0b4..5112a3e1c 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java
index 8d651c32b..d08fbb4ea 100644
--- a/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java
+++ b/hsweb-authorization/hsweb-authorization-basic/src/test/groovy/org/hswebframework/web/authorization/AuthorizeTests.java
@@ -194,7 +194,9 @@ public void dynamicQuery(QueryParamEntity paramEntity) {
public interface TestClassSuper {
- @Authorize(action = Permission.ACTION_QUERY, phased = Phased.after, dataAccess = @RequiresDataAccess)
+ @Authorize(action = Permission.ACTION_QUERY,
+ phased = Phased.after,
+ dataAccess = @RequiresDataAccess(phased = Phased.after))
default ResponseMessage queryById(String id) {
return ResponseMessage.ok();
}
diff --git a/hsweb-authorization/hsweb-authorization-jwt/pom.xml b/hsweb-authorization/hsweb-authorization-jwt/pom.xml
index a090778b0..305c0fe02 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.4
+ 3.0.5
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 52cf92526..faae00ba5 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
@@ -1,6 +1,6 @@
4.0.0
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ErrorType.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ErrorType.java
index e0988cb19..0520b2569 100644
--- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ErrorType.java
+++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ErrorType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
@@ -57,6 +57,8 @@ public enum ErrorType {
USER_NOT_EXIST(4041),//客户端不存在
+ STATE_ERROR(4042), //stat错误
+
ACCESS_DENIED(503), //访问被拒绝
OTHER(5001), //其他错误 ;
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/GrantType.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/GrantType.java
index 29dbfb021..c78b380d4 100644
--- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/GrantType.java
+++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/GrantType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/OAuth2Constants.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/OAuth2Constants.java
index d0cea276f..34c5b3504 100644
--- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/OAuth2Constants.java
+++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/OAuth2Constants.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ResponseType.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ResponseType.java
index 835ca0f19..b0a01c878 100644
--- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ResponseType.java
+++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/src/main/java/org/hswebframework/web/oauth2/core/ResponseType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 http://www.hswebframework.org
+ * Copyright 2019 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.
diff --git a/hsweb-authorization/hsweb-authorization-oauth2/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/pom.xml
index 8a3fa8a0e..5c0da7799 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.4
+ 3.0.5
4.0.0
diff --git a/hsweb-authorization/pom.xml b/hsweb-authorization/pom.xml
index f7d5a88e0..e1103cb90 100644
--- a/hsweb-authorization/pom.xml
+++ b/hsweb-authorization/pom.xml
@@ -5,7 +5,7 @@
hsweb-framework
org.hswebframework.web
- 3.0.4
+ 3.0.5
4.0.0
diff --git a/hsweb-boost/hsweb-boost-aop/pom.xml b/hsweb-boost/hsweb-boost-aop/pom.xml
index 53ef1db8d..0f2346b46 100644
--- a/hsweb-boost/hsweb-boost-aop/pom.xml
+++ b/hsweb-boost/hsweb-boost-aop/pom.xml
@@ -1,6 +1,6 @@
-
-
-
-
-
-
- org.hswebframework.web
- hsweb-concurrent-counter-redis
- ${project.version}
- test
-
-
-
- org.hswebframework.web
- hsweb-concurrent-counter-api
- ${project.version}
-
-
-
- org.hswebframework.web
- hsweb-commons-utils
- ${project.version}
-
-
- org.hswebframework.web
- hsweb-message-api
- ${project.version}
-
-
-
- org.springframework.boot
- spring-boot-starter-websocket
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.hswebframework.web
- hsweb-authorization-api
- ${project.version}
-
-
- org.fusesource
- sigar
- 1.6.4
- true
-
-
- com.alibaba
- fastjson
-
-
-
\ No newline at end of file
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/CommandRequest.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/CommandRequest.java
deleted file mode 100644
index b9d59068f..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/CommandRequest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.hswebframework.web.socket;
-
-import org.hswebframework.web.authorization.Authentication;
-import org.springframework.web.socket.WebSocketSession;
-
-import java.util.Map;
-
-/**
- * @author zhouhao
- */
-public interface CommandRequest {
- Authentication getAuthentication();
-
- Map getParameters();
-
- WebSocketSession getSession();
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/WebSocketSessionListener.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/WebSocketSessionListener.java
deleted file mode 100644
index 2a2a980e7..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/WebSocketSessionListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.hswebframework.web.socket;
-
-import org.springframework.web.socket.WebSocketSession;
-
-public interface WebSocketSessionListener {
- /**
- * 当session创建时,调用此方法
- *
- * @param session WebSocketSession 实例
- * @throws Exception
- */
- void onSessionConnect(WebSocketSession session);
-
- /**
- * 当session关闭时,调用此方法
- *
- * @param session WebSocketSession 实例
- * @throws Exception
- */
- void onSessionClose(WebSocketSession session);
-
-}
\ No newline at end of file
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/AuthorizeCommandProcessor.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/AuthorizeCommandProcessor.java
deleted file mode 100644
index af9f46ebf..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/AuthorizeCommandProcessor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.hswebframework.web.socket.authorize;
-
-import org.hswebframework.web.authorization.Authentication;
-import org.hswebframework.web.authorization.token.UserToken;
-import org.hswebframework.web.authorization.token.UserTokenHolder;
-import org.hswebframework.web.authorization.token.UserTokenManager;
-import org.hswebframework.web.socket.CommandRequest;
-import org.hswebframework.web.socket.message.WebSocketMessage;
-import org.hswebframework.web.socket.processor.AbstractCommandProcessor;
-
-public class AuthorizeCommandProcessor extends AbstractCommandProcessor {
-
- private UserTokenManager userTokenManager;
-
- public AuthorizeCommandProcessor(UserTokenManager userTokenManager) {
- this.userTokenManager = userTokenManager;
- }
-
- public void setUserTokenManager(UserTokenManager userTokenManager) {
- this.userTokenManager = userTokenManager;
- }
-
- @Override
- public String getName() {
- return "authorize";
- }
-
- @Override
- public void execute(CommandRequest command) {
- String accessToken = (String) command.getParameters().get("access_token");
- boolean success = false;
-
- if (null != accessToken) {
- UserToken token = userTokenManager.getByToken(accessToken);
- if (token != null) {
- UserTokenHolder.setCurrent(token);
- success = Authentication.current().orElse(null) != null;
- if (success) {
- command.getSession().getAttributes().put("user_token", accessToken);
- }
- }
- sendMessage(command.getSession(), new WebSocketMessage(200, token == null ? "token not exists":"", success));
- }
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/SessionIdWebSocketTokenParser.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/SessionIdWebSocketTokenParser.java
deleted file mode 100644
index a7b21c0b8..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/SessionIdWebSocketTokenParser.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.hswebframework.web.socket.authorize;
-
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.socket.WebSocketSession;
-
-import java.util.*;
-
-public class SessionIdWebSocketTokenParser implements WebSocketTokenParser {
- @Override
- public String parseToken(WebSocketSession session) {
- HttpHeaders headers = session.getHandshakeHeaders();
- List cookies = headers.get("Cookie");
- if (cookies == null || cookies.isEmpty()) {
- return null;
- }
- String[] cookie = cookies.get(0).split("[;]");
- Map> sessionId = new HashMap<>();
- for (String aCookie : cookie) {
- String[] tmp = aCookie.split("[=]");
- if (tmp.length == 2) {
- sessionId.computeIfAbsent(tmp[0].trim().toUpperCase(), k -> new HashSet<>())
- .add(tmp[1].trim());
- }
- }
- return sessionId.getOrDefault("JSESSIONID", sessionId.getOrDefault("SESSIONID", new java.util.HashSet<>())).stream().findFirst().orElse(null);
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/WebSocketTokenParser.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/WebSocketTokenParser.java
deleted file mode 100644
index 69e151801..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/WebSocketTokenParser.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.hswebframework.web.socket.authorize;
-
-import org.springframework.web.socket.WebSocketSession;
-
-public interface WebSocketTokenParser {
- String parseToken(WebSocketSession session);
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/XAccessTokenParser.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/XAccessTokenParser.java
deleted file mode 100644
index b966ebf1f..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/authorize/XAccessTokenParser.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.hswebframework.web.socket.authorize;
-
-import org.springframework.web.socket.WebSocketSession;
-
-import java.util.List;
-
-public class XAccessTokenParser implements WebSocketTokenParser {
- @Override
- public String parseToken(WebSocketSession session) {
- List tokens = session.getHandshakeHeaders().get("x-access-token");
- return tokens == null || tokens.isEmpty() ? null : tokens.get(0);
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/CommandWebSocketMessageDispatcher.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/CommandWebSocketMessageDispatcher.java
deleted file mode 100644
index c4861c4f1..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/CommandWebSocketMessageDispatcher.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.hswebframework.web.socket.handler;
-
-import com.alibaba.fastjson.JSON;
-import com.fasterxml.jackson.core.JsonParseException;
-import org.hswebframework.web.ThreadLocalUtils;
-import org.hswebframework.web.authorization.Authentication;
-import org.hswebframework.web.authorization.AuthenticationHolder;
-import org.hswebframework.web.authorization.exception.AccessDenyException;
-import org.hswebframework.web.authorization.exception.UnAuthorizedException;
-import org.hswebframework.web.authorization.token.UserToken;
-import org.hswebframework.web.authorization.token.UserTokenHolder;
-import org.hswebframework.web.authorization.token.UserTokenManager;
-import org.hswebframework.web.socket.CommandRequest;
-import org.hswebframework.web.socket.WebSocketSessionListener;
-import org.hswebframework.web.socket.authorize.WebSocketTokenParser;
-import org.hswebframework.web.socket.message.WebSocketMessage;
-import org.hswebframework.web.socket.processor.CommandProcessor;
-import org.hswebframework.web.socket.processor.CommandProcessorContainer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
-import org.springframework.web.socket.CloseStatus;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketSession;
-import org.springframework.web.socket.handler.TextWebSocketHandler;
-
-import java.nio.file.AccessDeniedException;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * @author zhouhao
- */
-public class CommandWebSocketMessageDispatcher extends TextWebSocketHandler {
-
- private CommandProcessorContainer processorContainer;
-
- private UserTokenManager userTokenManager;
-
- private List webSocketSessionListeners;
-
- private List tokenParsers;
-
- private Logger logger = LoggerFactory.getLogger(this.getClass());
-
- public void setWebSocketSessionListeners(List webSocketSessionListeners) {
- this.webSocketSessionListeners = webSocketSessionListeners;
- }
-
- public void setTokenParsers(List tokenParsers) {
- this.tokenParsers = tokenParsers;
- }
-
- public void setUserTokenManager(UserTokenManager userTokenManager) {
- this.userTokenManager = userTokenManager;
- }
-
- public void setProcessorContainer(CommandProcessorContainer processorContainer) {
- this.processorContainer = processorContainer;
- }
-
- private static final TextMessage requestFormatErrorMessage = new TextMessage(new WebSocketMessage(400, "message format error!").toString());
-
- private static final TextMessage commandNotFoundMessage = new TextMessage(new WebSocketMessage(404, "command not found!").toString());
-
- @Override
- protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
- String payload = message.getPayload();
- if (StringUtils.isEmpty(payload)) {
- return;
- }
- String cmd = null;
- WebSocketMessage errorMessage = null;
- try {
- WebSocketCommandRequest request = JSON.parseObject(payload, WebSocketCommandRequest.class);
- cmd = request.getCommand();
- CommandRequest command = buildCommand(request, session);
- CommandProcessor processor = processorContainer.getProcessor(request.getCommand());
- if (processor != null) {
- processor.execute(command);
- } else {
- session.sendMessage(commandNotFoundMessage);
- }
- } catch (JsonParseException e) {
- session.sendMessage(requestFormatErrorMessage);
- } catch (UnAuthorizedException e) {
- errorMessage = new WebSocketMessage(401, "un authorized");
- } catch (AccessDenyException e) {
- errorMessage = new WebSocketMessage(403, "access deny");
- } catch (Exception e) {
- logger.warn("handle websocket message error ", e);
- errorMessage = new WebSocketMessage(500, e.getMessage());
- } finally {
- ThreadLocalUtils.clear();
- }
- if (errorMessage != null) {
- errorMessage.setCommand(cmd);
- session.sendMessage(new TextMessage(errorMessage.toString()));
- }
- }
-
- private Authentication getAuthenticationFromSession(WebSocketSession session) {
- if (null == userTokenManager) {
- return null;
- }
- String token = (String) session.getAttributes().get("user_token");
- if(null==token){
- return null;
- }
- UserToken userToken = userTokenManager.getByToken(token);
- if (null == userToken) {
- return null;
- }
- UserTokenHolder.setCurrent(userToken);
- return Authentication.current().orElse(null);
- }
-
- private CommandRequest buildCommand(WebSocketCommandRequest request, WebSocketSession socketSession) {
- Authentication authentication = getAuthenticationFromSession(socketSession);
- return new CommandRequest() {
- @Override
- public Authentication getAuthentication() {
- return authentication;
- }
-
- @Override
- public Map getParameters() {
- return request.getParameters();
- }
-
- @Override
- public WebSocketSession getSession() {
- return socketSession;
- }
- };
- }
-
- @Override
- public void afterConnectionEstablished(WebSocketSession session) throws Exception {
- logger.debug("new WebSocket Session Established,sessionId:{}",session.getId());
- if (tokenParsers != null) {
- String token = tokenParsers.stream()
- .map(parser -> parser.parseToken(session))
- .filter(Objects::nonNull)
- .findFirst()
- .orElse(null);
- if (null != token) {
- UserToken userToken = userTokenManager.getByToken(token);
- if (null != userToken) {
- UserTokenHolder.setCurrent(userToken);
- Authentication authentication = Authentication.current().orElse(null);
- session.getAttributes().put("user_token", token);
-
- if (null != authentication) {
- logger.debug("websocket authentication init ok!");
- } else {
- logger.debug("websocket authentication init fail!");
- }
- }
- }
- }
- if (webSocketSessionListeners != null) {
- webSocketSessionListeners.forEach(webSocketSessionListener ->
- webSocketSessionListener.onSessionConnect(session));
- }
- }
-
- @Override
- public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
- logger.debug("WebSocket Session Closed,sessionId:{}",session.getId());
-
- ThreadLocalUtils.clear();
- if (webSocketSessionListeners != null) {
- webSocketSessionListeners.forEach(webSocketSessionListener ->
- webSocketSessionListener.onSessionClose(session));
- }
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/WebSocketCommandRequest.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/WebSocketCommandRequest.java
deleted file mode 100644
index 414deec44..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/handler/WebSocketCommandRequest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.hswebframework.web.socket.handler;
-
-import java.util.Map;
-
-/**
- * @author zhouhao
- */
-public class WebSocketCommandRequest {
- private String command;
-
- private Map parameters;
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public Map getParameters() {
- return parameters;
- }
-
- public void setParameters(Map parameters) {
- this.parameters = parameters;
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/DefaultWebSocketMessager.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/DefaultWebSocketMessager.java
deleted file mode 100644
index 2f4b50bec..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/DefaultWebSocketMessager.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.hswebframework.web.socket.message;
-
-import lombok.extern.slf4j.Slf4j;
-import org.hswebframework.web.concurrent.counter.Counter;
-import org.hswebframework.web.concurrent.counter.CounterManager;
-import org.hswebframework.web.concurrent.counter.SimpleCounterManager;
-import org.hswebframework.web.message.MessageSubscribe;
-import org.hswebframework.web.message.Messager;
-import org.hswebframework.web.message.support.ObjectMessage;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketSession;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-import static org.hswebframework.web.message.builder.StaticMessageBuilder.object;
-import static org.hswebframework.web.message.builder.StaticMessageSubjectBuilder.*;
-
-/**
- * @author zhouhao
- */
-@Slf4j
-public class DefaultWebSocketMessager implements WebSocketMessager {
-
- private Messager messager;
- private CounterManager counterManager;
-
- public DefaultWebSocketMessager(Messager messager) {
- this(messager, new SimpleCounterManager());
- }
-
- public DefaultWebSocketMessager(Messager messager, CounterManager counterManager) {
- this.messager = messager;
- this.counterManager = counterManager;
- }
-
- // command, type, sessionId
- private final Map>> store = new ConcurrentHashMap<>(32);
-
-
-
- @Override
- public void onSessionConnect(WebSocketSession session) {
-
- }
-
- private String getSubTotalKey(String command, String type) {
- return "sub_".concat(command)
- .concat("_")
- .concat(type)
- .concat("_total");
- }
-
- @Override
- public int getSubscribeTotal(String command, String type) {
- return (int) counterManager.getCounter(getSubTotalKey(command, type)).get();
- }
-
- @Override
- public void onSessionClose(WebSocketSession session) {
- store.values() //command
- .stream().map(Map::values).flatMap(Collection::stream)
- .map(sessionStore -> sessionStore.get(session.getId()))
- .filter(Objects::nonNull)
- .forEach(MessageSubscribeSession::cancel);
- }
-
- @Override
- public void publish(String command, String type, WebSocketMessage message) {
- messager.publish(object(message))
- .to(TYPE_QUEUE.equals(type) ? queue("queue_" + command) : topic("topic_" + command))
- .send();
- }
-
- private Map getSubSession(String command, String type) {
- return store.computeIfAbsent(command, cmd -> new ConcurrentHashMap<>(128))
- .computeIfAbsent(type, t -> new ConcurrentHashMap<>());
- }
-
- @Override
- public boolean subscribe(String command, String type, WebSocketSession socketSession) {
- Map subscribeSessionStore = getSubSession(command, type);
- subscribeSessionStore.computeIfAbsent(socketSession.getId(), sessionId -> {
- MessageSubscribe> subscribe = messager
- .subscribe(TYPE_QUEUE.equals(type) ? queue("queue_" + command) : topic("topic_" + command));
- subscribe.onMessage(message -> {
- try {
- if (!socketSession.isOpen()) {
- deSubscribe(command, type, socketSession);
- return;
- }
- socketSession.sendMessage(new TextMessage(((ObjectMessage) message).getObject().toString()));
- } catch (IOException e) {
- log.error("execute WebSocket command {} error",command,e);
- }
- });
- return new MessageSubscribeSession(subscribe, socketSession) {
- @Override
- public void cancel() {
- super.cancel();
- counterManager.getCounter(getSubTotalKey(command, type)).decrement();
- }
- };
- });
- counterManager.getCounter(getSubTotalKey(command, type)).increment();
- return true;
- }
-
- @Override
- public boolean deSubscribe(String command, String type, WebSocketSession socketSession) {
- Map subscribeSessionStore = getSubSession(command, type);
- MessageSubscribeSession subscribeSession = subscribeSessionStore.get(socketSession.getId());
- if (null != subscribeSession) {
- subscribeSession.getSubscribe().cancel();
- subscribeSessionStore.remove(socketSession.getId());
- counterManager.getCounter(getSubTotalKey(command, type)).decrement();
- return true;
- }
- return false;
- }
-
- public class MessageSubscribeSession {
- private MessageSubscribe> subscribe;
-
- private WebSocketSession session;
-
- public MessageSubscribeSession(MessageSubscribe> subscribe, WebSocketSession session) {
- this.subscribe = subscribe;
- this.session = session;
- }
-
- public MessageSubscribe> getSubscribe() {
- return subscribe;
- }
-
- public void setSubscribe(MessageSubscribe> subscribe) {
- this.subscribe = subscribe;
- }
-
- public WebSocketSession getSession() {
- return session;
- }
-
- public void setSession(WebSocketSession session) {
- this.session = session;
- }
-
- public void cancel() {
- subscribe.cancel();
- }
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessage.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessage.java
deleted file mode 100644
index 72169a005..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessage.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.hswebframework.web.socket.message;
-
-import com.alibaba.fastjson.JSON;
-
-import java.io.Serializable;
-
-/**
- * @author zhouhao
- */
-public class WebSocketMessage implements Serializable {
- private static final long serialVersionUID = -1173161338949028545L;
-
- private String command;
-
- private int status;
-
- private String message;
-
- private Object result;
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Object getResult() {
- return result;
- }
-
- public void setResult(Object result) {
- this.result = result;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- @Override
- public String toString() {
- return JSON.toJSONString(this);
- }
-
- public WebSocketMessage() {
- }
-
- public WebSocketMessage(int status, String message) {
- this.status = status;
- this.message = message;
- }
-
- public WebSocketMessage(int status, String message, Object result) {
- this.status = status;
- this.message = message;
- this.result = result;
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessager.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessager.java
deleted file mode 100644
index f433072d5..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/message/WebSocketMessager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.hswebframework.web.socket.message;
-
-import org.hswebframework.web.socket.WebSocketSessionListener;
-import org.springframework.web.socket.WebSocketSession;
-
-/**
- * @author zhouhao
- */
-public interface WebSocketMessager extends WebSocketSessionListener {
-
- String TYPE_QUEUE = "queue";
-
- String TYPE_TOPIC = "topic";
-
- default void publishQueue(String command, WebSocketMessage message) {
- publish(command, TYPE_QUEUE, message);
- }
-
- default void publishTopic(String command, WebSocketMessage message) {
- publish(command, TYPE_TOPIC, message);
- }
-
- void publish(String command, String type, WebSocketMessage message);
-
- int getSubscribeTotal(String command, String type);
-
- boolean subscribe(String command, String type, WebSocketSession socketSession);
-
- default boolean subscribeQueue(String command, WebSocketSession socketSession) {
- return subscribe(command, TYPE_QUEUE, socketSession);
- }
-
- default boolean subscribeTopic(String command, WebSocketSession socketSession) {
- return subscribe(command, TYPE_TOPIC, socketSession);
- }
-
- boolean deSubscribe(String command, String type, WebSocketSession socketSession);
-
- default boolean deSubscribeQueue(String command, WebSocketSession socketSession) {
- return deSubscribe(command, TYPE_QUEUE, socketSession);
- }
-
- default boolean deSubscribeTopic(String command, WebSocketSession socketSession) {
- return deSubscribe(command, TYPE_TOPIC, socketSession);
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/AbstractCommandProcessor.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/AbstractCommandProcessor.java
deleted file mode 100644
index 8d6ad0312..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/AbstractCommandProcessor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.hswebframework.web.socket.processor;
-
-import org.hswebframework.web.socket.message.WebSocketMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketSession;
-
-import java.io.IOException;
-
-public abstract class AbstractCommandProcessor implements CommandProcessor {
-
- protected Logger logger = LoggerFactory.getLogger(this.getClass());
-
-
- protected void sendMessage(WebSocketSession session, WebSocketMessage message) {
- message.setCommand(getName());
- try {
- session.sendMessage(new TextMessage(message.toString()));
- } catch (IOException e) {
- logger.error("send websocket message to {} error", session.getId(), message.toString(), e);
- }
- }
-
- @Override
- public void init() {
-
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessor.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessor.java
deleted file mode 100644
index d2ec6c7fe..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessor.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.hswebframework.web.socket.processor;
-
-import org.hswebframework.web.socket.CommandRequest;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public interface CommandProcessor {
- String getName();
-
- void execute(CommandRequest command);
-
- default void init() {
- }
-
- default void destroy() {
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessorContainer.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessorContainer.java
deleted file mode 100644
index 377143243..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/CommandProcessorContainer.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.hswebframework.web.socket.processor;
-
-
-import java.util.List;
-
-/**
- * @author zhouhao
- */
-public interface CommandProcessorContainer {
- CommandProcessor install(CommandProcessor command);
-
- CommandProcessor uninstall(String name);
-
- CommandProcessor getProcessor(String name);
-
- List getAllProcessor();
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/DefaultCommandProcessorContainer.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/DefaultCommandProcessorContainer.java
deleted file mode 100644
index e7d27508f..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/processor/DefaultCommandProcessorContainer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hswebframework.web.socket.processor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author zhouhao
- */
-public class DefaultCommandProcessorContainer implements CommandProcessorContainer {
-
- private final ConcurrentMap processorStore = new ConcurrentHashMap<>();
-
- @Override
- public CommandProcessor install(CommandProcessor command) {
- command.init();
- return processorStore.put(command.getName(), command);
- }
-
- @Override
- public CommandProcessor uninstall(String name) {
- CommandProcessor processor = processorStore.remove(name);
- if (null != processor) {
- processor.destroy();
- }
- return processor;
- }
-
- public void destroy() {
- getAllProcessor().forEach(CommandProcessor::destroy);
- processorStore.clear();
- }
-
- @Override
- public CommandProcessor getProcessor(String name) {
- return processorStore.get(name);
- }
-
- @Override
- public List getAllProcessor() {
- return new ArrayList<>(processorStore.values());
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/starter/CommandWebSocketAutoConfiguration.java b/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/starter/CommandWebSocketAutoConfiguration.java
deleted file mode 100644
index 5536746d2..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/java/org/hswebframework/web/socket/starter/CommandWebSocketAutoConfiguration.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.hswebframework.web.socket.starter;
-
-import org.hswebframework.web.authorization.token.UserTokenManager;
-import org.hswebframework.web.concurrent.counter.CounterManager;
-import org.hswebframework.web.message.Messager;
-import org.hswebframework.web.socket.WebSocketSessionListener;
-import org.hswebframework.web.socket.authorize.AuthorizeCommandProcessor;
-import org.hswebframework.web.socket.authorize.SessionIdWebSocketTokenParser;
-import org.hswebframework.web.socket.authorize.WebSocketTokenParser;
-import org.hswebframework.web.socket.authorize.XAccessTokenParser;
-import org.hswebframework.web.socket.handler.CommandWebSocketMessageDispatcher;
-import org.hswebframework.web.socket.message.DefaultWebSocketMessager;
-import org.hswebframework.web.socket.message.WebSocketMessager;
-import org.hswebframework.web.socket.processor.DefaultCommandProcessorContainer;
-import org.hswebframework.web.socket.processor.CommandProcessor;
-import org.hswebframework.web.socket.processor.CommandProcessorContainer;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.socket.config.annotation.WebSocketConfigurationSupport;
-import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
-import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
-
-import java.util.List;
-
-/**
- * @author zhouhao
- */
-@Configuration
-public class CommandWebSocketAutoConfiguration {
-
- @Bean
- public SessionIdWebSocketTokenParser sessionIdWebSocketTokenParser() {
- return new SessionIdWebSocketTokenParser();
- }
-
- @Bean
- public XAccessTokenParser xAccessTokenParser() {
- return new XAccessTokenParser();
- }
-
- @Bean
- @ConditionalOnBean(UserTokenManager.class)
- public AuthorizeCommandProcessor authorizeCommandProcessor(UserTokenManager userTokenManager) {
- return new AuthorizeCommandProcessor(userTokenManager);
- }
-
- @Configuration
- @ConditionalOnMissingBean(CommandProcessorContainer.class)
- public static class WebSocketProcessorContainerConfiguration {
- @Autowired(required = false)
- private List commandProcessors;
-
- @Bean(destroyMethod = "destroy")
- public DefaultCommandProcessorContainer defaultWebSocketProcessorContainer() {
- DefaultCommandProcessorContainer container = new DefaultCommandProcessorContainer();
- if (commandProcessors != null) {
- commandProcessors.forEach(container::install);
- }
- return container;
- }
- }
-
- @Configuration
- @ConditionalOnBean(Messager.class)
- @ConditionalOnMissingBean(WebSocketMessager.class)
- public static class WebSocketMessagerConfiguration {
- @Autowired(required = false)
- private CounterManager counterManager;
-
- @Bean
- public WebSocketMessager webSocketMessager(Messager messager) {
- return new DefaultWebSocketMessager(messager, counterManager);
- }
- }
-
- @Bean
- @ConfigurationProperties(prefix = "hsweb.websocket")
- public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() {
- ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
- container.setMaxTextMessageBufferSize(10 * 1024 * 1024);
- container.setMaxBinaryMessageBufferSize(10 * 1024 * 1024);
- return container;
- }
-
- @Configuration
- @ConfigurationProperties(prefix = "hsweb.websocket")
- public static class HandlerConfiguration extends WebSocketConfigurationSupport {
- private String[] allowedOrigins;
-
- public void setAllowedOrigins(String[] allowedOrigins) {
- this.allowedOrigins = allowedOrigins;
- }
-
- @Autowired(required = false)
- private UserTokenManager userTokenManager;
-
- @Autowired(required = false)
- private List webSocketSessionListeners;
-
- @Autowired(required = false)
- private List webSocketTokenParsers;
-
- @Autowired
- private CommandProcessorContainer commandProcessorContainer;
-
- @Override
- protected void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
- CommandWebSocketMessageDispatcher dispatcher = new CommandWebSocketMessageDispatcher();
- dispatcher.setProcessorContainer(commandProcessorContainer);
- dispatcher.setUserTokenManager(userTokenManager);
- dispatcher.setWebSocketSessionListeners(webSocketSessionListeners);
- dispatcher.setTokenParsers(webSocketTokenParsers);
- registry.addHandler(dispatcher, "/sockjs")
- .setAllowedOrigins(allowedOrigins)
- .withSockJS()
- .setSessionCookieNeeded(true);
- registry.addHandler(dispatcher, "/socket")
- .setAllowedOrigins(allowedOrigins);
- }
- }
-
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/main/resources/META-INF/spring.factories b/hsweb-message/hsweb-message-websocket/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 4f32dafa3..000000000
--- a/hsweb-message/hsweb-message-websocket/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,3 +0,0 @@
-# Auto Configure
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.hswebframework.web.socket.starter.CommandWebSocketAutoConfiguration
\ No newline at end of file
diff --git a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/TestProcessor.java b/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/TestProcessor.java
deleted file mode 100644
index d05dca3d4..000000000
--- a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/TestProcessor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.hswebframework.web.socket;
-
-import org.hswebframework.web.socket.message.WebSocketMessage;
-import org.hswebframework.web.socket.message.WebSocketMessager;
-import org.hswebframework.web.socket.processor.CommandProcessor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.socket.WebSocketSession;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public class TestProcessor implements CommandProcessor, WebSocketSessionListener {
-
- @Autowired
- private WebSocketMessager messager;
-
- @Override
- public String getName() {
- return "test";
- }
-
- private void sub(WebSocketSession socketSession) {
- messager.subscribeQueue(getName(), socketSession);
- }
-
- private void deSub(WebSocketSession socketSession) {
- messager.deSubscribeQueue(getName(), socketSession);
- }
-
- @Override
- public void execute(CommandRequest command) {
- String type = String.valueOf(command.getParameters().get("type"));
- switch (type) {
- case "conn":
- sub(command.getSession());
- break;
- case "close": {
- deSub(command.getSession());
- }
- }
- }
-
- @Override
- public void init() {
- new Thread(() -> {
- long total = 0;
- while (true) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- if (messager.getSubscribeTotal(getName(), WebSocketMessager.TYPE_QUEUE) > 0) {
- messager.publishQueue(getName(), new WebSocketMessage(200, "hello" + total++));
- System.out.println(total);
- }
- }
- }).start();
- }
-
- @Override
- public void onSessionConnect(WebSocketSession session) {
-
- }
-
- @Override
- public void onSessionClose(WebSocketSession session) {
- deSub(session);
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketClientTests.java b/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketClientTests.java
deleted file mode 100644
index d7063e4d6..000000000
--- a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketClientTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.hswebframework.web.socket;
-
-import org.springframework.util.concurrent.ListenableFuture;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketMessage;
-import org.springframework.web.socket.WebSocketSession;
-import org.springframework.web.socket.client.WebSocketClient;
-import org.springframework.web.socket.client.standard.StandardWebSocketClient;
-import org.springframework.web.socket.handler.AbstractWebSocketHandler;
-
-public class WebSocketClientTests {
- public static void main(String[] args) throws Exception {
- WebSocketClient client = new StandardWebSocketClient();
- String url = "ws://localhost:8081/socket";
- ListenableFuture future = client.doHandshake(new AbstractWebSocketHandler() {
- @Override
- public void handleMessage(WebSocketSession session, WebSocketMessage> message) throws Exception {
- System.out.println(message.getPayload());
- }
- }, url);
-
- WebSocketSession socketSession = future.get();
- socketSession.sendMessage(new TextMessage("{\"command\":\"test\",\"parameters\":{\"type\":\"conn\"}}"));
-
- System.in.read();
- }
-}
diff --git a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketServerTests.java b/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketServerTests.java
deleted file mode 100644
index dad78112e..000000000
--- a/hsweb-message/hsweb-message-websocket/src/test/java/org/hswebframework/web/socket/WebSocketServerTests.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.hswebframework.web.socket;
-
-import org.hswebframework.web.concurrent.counter.CounterManager;
-import org.hswebframework.web.concurrent.counter.SimpleCounterManager;
-import org.hswebframework.web.message.Messager;
-import org.hswebframework.web.message.memory.MemoryMessager;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-@Configuration
-@EnableAutoConfiguration
-//@EnableJms
-public class WebSocketServerTests {
-
- static {
- // System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*");
- }
-//
-
-// @Bean(destroyMethod = "shutdown")
-// public RedissonClient redissonClient(){
-// Config config = new Config();
-// config.useSingleServer().setAddress("redis://127.0.0.1:6379");
-// return Redisson.create(config);
-// }
-
- @Bean
- public CounterManager counterManager() {
- return new SimpleCounterManager();
- }
-
- @Bean
- public TestProcessor testProcessor() {
- return new TestProcessor();
- }
-
-// // 使用redis
-// @Bean(destroyMethod = "shutdown")
-// public RedissonClient redissonClient() {
-// Config config = new Config();
-// config.useSingleServer().setAddress("127.0.0.1:6379");
-// return Redisson.create(config);
-// }
-
- public static void main(String[] args) {
- SpringApplication.run(WebSocketServerTests.class);
- }
-}
\ No newline at end of file
diff --git a/hsweb-message/hsweb-message-websocket/src/test/resources/application.yml b/hsweb-message/hsweb-message-websocket/src/test/resources/application.yml
deleted file mode 100644
index cf8667dd5..000000000
--- a/hsweb-message/hsweb-message-websocket/src/test/resources/application.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-spring:
- activemq:
- broker-url: tcp://localhost:61616
- in-memory: false
- jms:
- pub-sub-domain: true
-
-hsweb:
- websocket:
- allowed-origins: "*"
- app:
- name: websocket测试
- version: 3.0.0
-server:
- port: 8081
\ No newline at end of file
diff --git a/hsweb-message/pom.xml b/hsweb-message/pom.xml
deleted file mode 100644
index 17e2beaf2..000000000
--- a/hsweb-message/pom.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- hsweb-framework
- org.hswebframework.web
- 3.0.4
-
- 4.0.0
-
- 消息相关模块(试行)
-
- hsweb-message
- pom
-
- hsweb-message-api
- hsweb-message-jms
- hsweb-message-redis
- hsweb-message-websocket
-
-
-
-
\ No newline at end of file
diff --git a/hsweb-starter/hsweb-spring-boot-starter/pom.xml b/hsweb-starter/hsweb-spring-boot-starter/pom.xml
index cc8cc990f..6bd841821 100644
--- a/hsweb-starter/hsweb-spring-boot-starter/pom.xml
+++ b/hsweb-starter/hsweb-spring-boot-starter/pom.xml
@@ -1,7 +1,7 @@