mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
MvcCurrentUserAutoConfiguration
This commit is contained in:
parent
fc7c8fd2ef
commit
52bb2bed00
@ -0,0 +1,30 @@
|
|||||||
|
package org.dromara.maxkey.autoconfigure;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.dromara.maxkey.authn.web.CurrentUserMethodArgumentResolver;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@EnableWebMvc
|
||||||
|
@AutoConfiguration
|
||||||
|
public class MvcCurrentUserAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MvcCurrentUserAutoConfiguration.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||||
|
argumentResolvers.add(currentUserMethodArgumentResolver());
|
||||||
|
logger.debug("add currentUserMethodArgumentResolver");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
|
||||||
|
return new CurrentUserMethodArgumentResolver();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -9,8 +9,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
|
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
public class ResourceMvcConfig implements WebMvcConfigurer {
|
public class MvcResourceAutoConfiguration implements WebMvcConfigurer {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ResourceMvcConfig.class);
|
private static final Logger logger = LoggerFactory.getLogger(MvcResourceAutoConfiguration.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
@ -17,8 +17,8 @@ import io.swagger.v3.oas.models.info.Info;
|
|||||||
import io.swagger.v3.oas.models.info.License;
|
import io.swagger.v3.oas.models.info.License;
|
||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
public class SwaggerConfig {
|
public class SwaggerAutoConfiguration {
|
||||||
static final Logger _logger = LoggerFactory.getLogger(SwaggerConfig.class);
|
static final Logger _logger = LoggerFactory.getLogger(SwaggerAutoConfiguration.class);
|
||||||
|
|
||||||
@Value("${maxkey.swagger.title}")
|
@Value("${maxkey.swagger.title}")
|
||||||
String title;
|
String title;
|
||||||
@ -187,14 +187,4 @@ public class MaxKeyMvcConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
||||||
argumentResolvers.add(currentUserMethodArgumentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
|
|
||||||
return new CurrentUserMethodArgumentResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,9 +10,10 @@ org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
|
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.Oauth20AutoConfiguration
|
org.dromara.maxkey.autoconfigure.Oauth20AutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
|
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyMvcConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyMvcConfig
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyConfig
|
||||||
@ -17,21 +17,16 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.autoconfigure;
|
package org.dromara.maxkey.autoconfigure;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
||||||
import org.dromara.maxkey.authn.web.CurrentUserMethodArgumentResolver;
|
|
||||||
import org.dromara.maxkey.authn.web.interceptor.PermissionInterceptor;
|
import org.dromara.maxkey.authn.web.interceptor.PermissionInterceptor;
|
||||||
import org.dromara.maxkey.configuration.ApplicationConfig;
|
import org.dromara.maxkey.configuration.ApplicationConfig;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
||||||
|
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@ -88,15 +83,5 @@ public class MaxKeyMgtMvcConfig implements WebMvcConfigurer {
|
|||||||
logger.debug("add Permission Adapter");
|
logger.debug("add Permission Adapter");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
||||||
argumentResolvers.add(currentUserMethodArgumentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
|
|
||||||
return new CurrentUserMethodArgumentResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,9 +8,10 @@ org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyMgtConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyMgtConfig
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyMgtMvcConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyMgtMvcConfig
|
||||||
|
|||||||
@ -17,10 +17,7 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.autoconfigure;
|
package org.dromara.maxkey.autoconfigure;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
import org.dromara.maxkey.authn.provider.AbstractAuthenticationProvider;
|
||||||
import org.dromara.maxkey.authn.web.CurrentUserMethodArgumentResolver;
|
|
||||||
import org.dromara.maxkey.authn.web.interceptor.PermissionInterceptor;
|
import org.dromara.maxkey.authn.web.interceptor.PermissionInterceptor;
|
||||||
import org.dromara.maxkey.configuration.ApplicationConfig;
|
import org.dromara.maxkey.configuration.ApplicationConfig;
|
||||||
import org.dromara.maxkey.web.interceptor.RestApiPermissionAdapter;
|
import org.dromara.maxkey.web.interceptor.RestApiPermissionAdapter;
|
||||||
@ -28,11 +25,9 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
||||||
|
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@ -105,15 +100,5 @@ public class MaxKeyOpenApiMvcConfig implements WebMvcConfigurer {
|
|||||||
logger.debug("add Rest Api Permission Adapter");
|
logger.debug("add Rest Api Permission Adapter");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
||||||
argumentResolvers.add(currentUserMethodArgumentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
|
|
||||||
return new CurrentUserMethodArgumentResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,12 @@ org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
|
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
|
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiConfig
|
||||||
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiMvcConfig
|
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiMvcConfig
|
||||||
Loading…
x
Reference in New Issue
Block a user