|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -package top.continew.starter.security.crypto.autoconfigure; |
| 17 | +package top.continew.starter.encrypt.api.autoconfigure; |
18 | 18 |
|
19 | 19 | import jakarta.annotation.PostConstruct; |
20 | 20 | import jakarta.servlet.DispatcherType; |
|
27 | 27 | import org.springframework.context.annotation.Bean; |
28 | 28 | import top.continew.starter.core.constant.OrderedConstants; |
29 | 29 | import top.continew.starter.core.constant.PropertiesConstants; |
30 | | -import top.continew.starter.security.crypto.filter.ApiCryptoFilter; |
| 30 | +import top.continew.starter.core.constant.StringConstants; |
| 31 | +import top.continew.starter.encrypt.api.filter.ApiEncryptFilter; |
31 | 32 |
|
32 | 33 | /** |
33 | | - * API加/解密自动配置 |
| 34 | + * API 加密自动配置 |
34 | 35 | * |
35 | 36 | * @author lishuyan |
| 37 | + * @author Charles7c |
36 | 38 | * @since 2.14.0 |
37 | 39 | */ |
38 | 40 | @AutoConfiguration |
39 | | -@EnableConfigurationProperties(ApiCryptoProperties.class) |
40 | | -@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_API_CRYPTO, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true) |
41 | | -public class ApiCryptoAutoConfiguration { |
| 41 | +@EnableConfigurationProperties(ApiEncryptProperties.class) |
| 42 | +@ConditionalOnProperty(prefix = PropertiesConstants.ENCRYPT_API, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true) |
| 43 | +public class ApiEncryptAutoConfiguration { |
42 | 44 |
|
43 | | - private static final Logger log = LoggerFactory.getLogger(ApiCryptoAutoConfiguration.class); |
| 45 | + private static final Logger log = LoggerFactory.getLogger(ApiEncryptAutoConfiguration.class); |
44 | 46 |
|
45 | 47 | /** |
46 | | - * API加/解密过滤器 |
47 | | - * |
48 | | - * @param properties 配置 |
49 | | - * @return 过滤器 |
| 48 | + * API 加密过滤器 |
50 | 49 | */ |
51 | 50 | @Bean |
52 | | - public FilterRegistrationBean<ApiCryptoFilter> apiCryptoFilterRegistration(ApiCryptoProperties properties) { |
53 | | - FilterRegistrationBean<ApiCryptoFilter> registration = new FilterRegistrationBean<>(); |
54 | | - registration.setDispatcherTypes(DispatcherType.REQUEST); |
55 | | - registration.setFilter(new ApiCryptoFilter(properties)); |
56 | | - registration.addUrlPatterns("/*"); |
57 | | - registration.setName("apiCryptoFilter"); |
58 | | - registration.setOrder(OrderedConstants.Filter.API_CRYPTO_FILTER); |
59 | | - return registration; |
| 51 | + public FilterRegistrationBean<ApiEncryptFilter> apiEncryptFilter(ApiEncryptProperties properties) { |
| 52 | + FilterRegistrationBean<ApiEncryptFilter> registrationBean = new FilterRegistrationBean<>(); |
| 53 | + registrationBean.setFilter(new ApiEncryptFilter(properties)); |
| 54 | + registrationBean.setOrder(OrderedConstants.Filter.API_ENCRYPT_FILTER); |
| 55 | + registrationBean.addUrlPatterns(StringConstants.PATH_PATTERN_CURRENT_DIR); |
| 56 | + registrationBean.setDispatcherTypes(DispatcherType.REQUEST); |
| 57 | + return registrationBean; |
60 | 58 | } |
61 | 59 |
|
62 | 60 | @PostConstruct |
63 | 61 | public void postConstruct() { |
64 | | - log.debug("[ContiNew Starter] - Auto Configuration 'Security-API-Crypto' completed initialization."); |
| 62 | + log.debug("[ContiNew Starter] - Auto Configuration 'Encrypt-API' completed initialization."); |
65 | 63 | } |
66 | 64 | } |
0 commit comments