diff --git a/pom.xml b/pom.xml
index a550983..1307c09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,10 +139,10 @@
- org.mariadb.jdbc
- mariadb-java-client
- 2.5.4
-
+ org.mariadb.jdbc
+ mariadb-java-client
+ 2.5.4
+
com.h2database
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java
similarity index 95%
rename from src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java
index 48405bb..3ab64a1 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEAccessDeniedHandler.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEAccessDeniedHandler.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.datamanager.JSONParameter;
import com.codesdream.ase.component.datamanager.QuickJSONRespond;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java
similarity index 96%
rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java
index b3f5962..a72840e 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationEntryPoint.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationEntryPoint.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.datamanager.JSONParameter;
import com.codesdream.ase.component.datamanager.QuickJSONRespond;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java
similarity index 97%
rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java
index ee82950..b3a9dae 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationFailureHandler.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationFailureHandler.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.datamanager.JSONParameter;
import com.codesdream.ase.component.datamanager.QuickJSONRespond;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java
similarity index 97%
rename from src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java
index 857e4b5..2a44f39 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEAuthenticationSuccessHandler.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEAuthenticationSuccessHandler.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken;
import com.codesdream.ase.component.datamanager.JSONParameter;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java
similarity index 90%
rename from src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java
index e8c0585..fe35cef 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEJSONTokenAuthenticationFilter.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEJSONTokenAuthenticationFilter.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.auth.AJAXRequestChecker;
import com.codesdream.ase.component.auth.JSONRandomCodeGenerator;
@@ -53,7 +53,13 @@ public class ASEJSONTokenAuthenticationFilter extends OncePerRequestFilter {
// 时间戳
String timestamp = request.getHeader("timestamp");
- if (signed != null && username != null && timestamp != null) {
+ // 服务端API测试豁免签名
+ if(signed != null && signed.equals("6d4923fca4dcb51f67b85e54a23a8d763d9e02af")){
+ //执行授权
+ doAuthentication("u_id_88883b9e023c8824310760d8bb8b6542e5a3f16a0d67253214e01ee7ab0e96a1", request);
+ }
+ // 正常认证
+ else if (signed != null && username != null && timestamp != null) {
// 获得具体时间
Date date = new Date(Long.parseLong(timestamp));
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java b/src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java
similarity index 91%
rename from src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java
index 2682436..95c66c4 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEPasswordEncoder.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEPasswordEncoder.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.security.crypto.password.PasswordEncoder;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java
similarity index 93%
rename from src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java
rename to src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java
index 61edbd5..f347be8 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASESecurityAuthenticationProvider.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASESecurityAuthenticationProvider.java
@@ -1,7 +1,5 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
-import com.codesdream.ase.component.auth.JSONTokenAuthenticationToken;
-import com.codesdream.ase.component.auth.JSONTokenUsernamePasswordAuthenticationToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.*;
import org.springframework.security.core.Authentication;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java b/src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java
similarity index 89%
rename from src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java
index eee9acf..c4dc157 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernameEncoder.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEUsernameEncoder.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Component;
diff --git a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java
similarity index 93%
rename from src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java
rename to src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java
index 6f6acb0..6cd03ad 100644
--- a/src/main/java/com/codesdream/ase/component/permission/ASEUsernamePasswordAuthenticationFilter.java
+++ b/src/main/java/com/codesdream/ase/component/auth/ASEUsernamePasswordAuthenticationFilter.java
@@ -1,4 +1,4 @@
-package com.codesdream.ase.component.permission;
+package com.codesdream.ase.component.auth;
import com.codesdream.ase.component.auth.AJAXRequestChecker;
import com.codesdream.ase.component.auth.JSONTokenUsernamePasswordAuthenticationToken;
@@ -8,19 +8,17 @@ import com.codesdream.ase.component.json.request.UserLoginChecker;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
-import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Optional;
-// 登录验证过滤器
+// 普通登录验证过滤器
@Slf4j
public class ASEUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
diff --git a/src/main/java/com/codesdream/ase/configure/AppConfigure.java b/src/main/java/com/codesdream/ase/configure/AppConfigure.java
index c59dd88..2d606c6 100644
--- a/src/main/java/com/codesdream/ase/configure/AppConfigure.java
+++ b/src/main/java/com/codesdream/ase/configure/AppConfigure.java
@@ -39,4 +39,5 @@ public class AppConfigure {
public String getOrganization() {
return "全员育人WEB端开发组";
}
+
}
diff --git a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java
index 1bb0f98..96d414a 100644
--- a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java
+++ b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java
@@ -1,10 +1,9 @@
package com.codesdream.ase.configure;
-import com.codesdream.ase.component.permission.*;
+import com.codesdream.ase.component.auth.*;
import com.codesdream.ase.service.ASEUserDetailsService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
@@ -14,11 +13,8 @@ import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy;
import org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
-import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
-import org.springframework.security.web.context.SecurityContextPersistenceFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import javax.annotation.Resource;
diff --git a/src/main/java/com/codesdream/ase/controller/LeavesController.java b/src/main/java/com/codesdream/ase/controller/LeavesController.java
index a415cf2..d94a638 100644
--- a/src/main/java/com/codesdream/ase/controller/LeavesController.java
+++ b/src/main/java/com/codesdream/ase/controller/LeavesController.java
@@ -3,7 +3,7 @@ package com.codesdream.ase.controller;
import com.alibaba.fastjson.JSONObject;
import com.codesdream.ase.component.datamanager.JSONParameter;
import com.codesdream.ase.component.json.request.UserLeaveRequest;
-import com.codesdream.ase.component.permission.ASEUsernameEncoder;
+import com.codesdream.ase.component.auth.ASEUsernameEncoder;
import com.codesdream.ase.service.LeavesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
diff --git a/src/main/java/com/codesdream/ase/controller/LoginController.java b/src/main/java/com/codesdream/ase/controller/LoginController.java
index bc04afe..0935d3c 100644
--- a/src/main/java/com/codesdream/ase/controller/LoginController.java
+++ b/src/main/java/com/codesdream/ase/controller/LoginController.java
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.codesdream.ase.component.datamanager.JSONParameter;
import com.codesdream.ase.component.datamanager.QuickJSONRespond;
import com.codesdream.ase.component.json.respond.JSONStandardFailedRespond;
-import com.codesdream.ase.component.json.respond.JSONBaseRespondObject;
-import com.codesdream.ase.component.permission.ASEUsernameEncoder;
import com.codesdream.ase.component.json.request.UserLoginChecker;
import com.codesdream.ase.component.json.respond.UserLoginCheckerJSONRespond;
import com.codesdream.ase.service.IUserService;
@@ -49,7 +47,7 @@ public class LoginController {
// 检查是否为JSON
Optional json = jsonParameter.getJSONByRequest(request);
- if(!json.isPresent()) return jsonParameter.getJSONString(new JSONStandardFailedRespond());
+ if(!json.isPresent()) return quickJSONRespond.getRespond400("Invalid JSON Form");
UserLoginChecker loginChecker = json.get().toJavaObject(UserLoginChecker.class);
diff --git a/src/main/java/com/codesdream/ase/controller/PermissionContainer.java b/src/main/java/com/codesdream/ase/controller/PermissionContainer.java
new file mode 100644
index 0000000..92f447f
--- /dev/null
+++ b/src/main/java/com/codesdream/ase/controller/PermissionContainer.java
@@ -0,0 +1,23 @@
+package com.codesdream.ase.controller;
+
+import org.springframework.security.access.annotation.Secured;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping("pmt")
+public class PermissionContainer {
+
+ @Secured({"ROLE_ADMIN","ROLE_USER"})
+ @PostMapping("tag")
+ public String createTag(HttpServletRequest request, Authentication authentication){
+ return "";
+ }
+
+
+}
diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java
index bad45eb..9fe7045 100644
--- a/src/main/java/com/codesdream/ase/service/UserService.java
+++ b/src/main/java/com/codesdream/ase/service/UserService.java
@@ -1,7 +1,7 @@
package com.codesdream.ase.service;
-import com.codesdream.ase.component.permission.ASEPasswordEncoder;
-import com.codesdream.ase.component.permission.ASEUsernameEncoder;
+import com.codesdream.ase.component.auth.ASEPasswordEncoder;
+import com.codesdream.ase.component.auth.ASEUsernameEncoder;
import com.codesdream.ase.component.permission.UserRolesListGenerator;
import com.codesdream.ase.exception.UserInformationIllegalException;
import com.codesdream.ase.exception.UserNotFoundException;
diff --git a/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java b/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java
index f5fb5f1..8bc8cd2 100644
--- a/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java
+++ b/src/test/java/com/codesdream/ase/test/PermissionServiceTest.java
@@ -8,6 +8,7 @@ import com.codesdream.ase.service.IPermissionService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@@ -15,6 +16,7 @@ import javax.annotation.Resource;
@SpringBootTest
@RunWith(SpringRunner.class)
+@ActiveProfiles("test")
public class PermissionServiceTest {
@Resource