zhouhao 6 rokov pred
rodič
commit
6b0780f250

+ 10 - 0
hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java

@@ -90,6 +90,16 @@ public class AuthorizingHandlerAutoConfiguration {
         return new UserTokenAutoExpiredListener(userTokenManager);
     }
 
+    @Bean
+    public AuthorizationController authorizationController() {
+        return new AuthorizationController();
+    }
+
+    @Bean
+    public UserTokenController userTokenController() {
+        return new UserTokenController();
+    }
+
     @Configuration
     public static class DataAccessHandlerProcessor implements BeanPostProcessor {
 

+ 3 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java

@@ -38,12 +38,13 @@ import org.springframework.context.annotation.Import;
 @ComponentScan({"org.hswebframework.web.service.authorization.simple"
         , "org.hswebframework.web.authorization.controller"})
 @MapperScan("org.hswebframework.web.authorization.dao")
-@AutoConfigureBefore(DefaultAuthorizationAutoConfiguration.class)
+@AutoConfigureBefore(value = {
+        DefaultAuthorizationAutoConfiguration.class
+}, name = "org.hswebframework.web.authorization.basic.configuration.AuthorizingHandlerAutoConfiguration")
 @Import(BasicAuthorizationConfiguration.class)
 public class AuthorizationAutoConfiguration {
 
     @Bean
-    @ConditionalOnMissingBean(AuthenticationManager.class)
     public AuthenticationManager authenticationManager(AuthenticationInitializeService authenticationInitializeService) {
         return new SimpleAuthenticationManager(authenticationInitializeService);
     }

+ 4 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/authorization/starter/LoginTests.java

@@ -18,21 +18,23 @@
 package org.hswebframework.web.authorization.starter;
 
 import com.alibaba.fastjson.JSONObject;
+import org.hswebframework.web.authorization.basic.configuration.EnableAopAuthorize;
 import org.hswebframework.web.entity.authorization.UserEntity;
 import org.hswebframework.web.service.authorization.UserService;
 import org.hswebframework.web.tests.SimpleWebApplicationTests;
 import org.junit.After;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.http.MediaType;
 
 import java.sql.SQLException;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
+@Configuration
+@EnableAopAuthorize
 public class LoginTests extends SimpleWebApplicationTests {
 
     @Autowired