优化权限配置

This commit is contained in:
zhouhao
2018-09-11 19:54:41 +08:00
parent 628eb37779
commit 6b0780f250
3 changed files with 17 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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