Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lbw committed Jan 28, 2024
2 parents 97066e8 + adace3a commit 95e6c45
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,59 +21,62 @@
@EnableConfigurationProperties(GatewayConfigProperties.class)
public class GatewayConfiguration {

/**
* 创建密码解码器过滤器
* @param modifyRequestBodyGatewayFilterFactory 修改请求体网关过滤器工厂
* @param configProperties 配置属性
* @return 密码解码器过滤器
*/
@Bean
public PasswordDecoderFilter passwordDecoderFilter(
ModifyRequestBodyGatewayFilterFactory modifyRequestBodyGatewayFilterFactory,
GatewayConfigProperties configProperties) {
return new PasswordDecoderFilter(modifyRequestBodyGatewayFilterFactory, configProperties);
}
/**
* 创建密码解码器过滤器
*
* @param modifyRequestBodyGatewayFilterFactory 修改请求体网关过滤器工厂
* @param configProperties 配置属性
* @return 密码解码器过滤器
*/
@Bean
public PasswordDecoderFilter passwordDecoderFilter(
ModifyRequestBodyGatewayFilterFactory modifyRequestBodyGatewayFilterFactory,
GatewayConfigProperties configProperties) {
return new PasswordDecoderFilter(modifyRequestBodyGatewayFilterFactory, configProperties);
}

/**
* 创建PigRequest全局过滤器
* @return PigRequest全局过滤器
*/
@Bean
public PigRequestGlobalFilter pigRequestGlobalFilter() {
return new PigRequestGlobalFilter();
}
/**
* 创建PigRequest全局过滤器
*
* @return PigRequest全局过滤器
*/
@Bean
public PigRequestGlobalFilter pigRequestGlobalFilter() {
return new PigRequestGlobalFilter();
}

/**
* 创建验证码网关过滤器
* @param configProperties 配置属性
* @param objectMapper 对象映射器
* @param redisTemplate Redis模板
* @return 验证码网关过滤器
*/
@Bean
public ValidateCodeGatewayFilter validateCodeGatewayFilter(GatewayConfigProperties configProperties,
ObjectMapper objectMapper, RedisTemplate redisTemplate) {
return new ValidateCodeGatewayFilter(configProperties, objectMapper, redisTemplate);
}
/**
* 创建验证码网关过滤器
*
* @param configProperties 配置属性
* @param redisTemplate Redis模板
* @return 验证码网关过滤器
*/
@Bean
public ValidateCodeGatewayFilter validateCodeGatewayFilter(GatewayConfigProperties configProperties, RedisTemplate redisTemplate) {
return new ValidateCodeGatewayFilter(configProperties, redisTemplate);
}

/**
* 创建全局异常处理程序
* @param objectMapper 对象映射器
* @return 全局异常处理程序
*/
@Bean
public GlobalExceptionHandler globalExceptionHandler(ObjectMapper objectMapper) {
return new GlobalExceptionHandler(objectMapper);
}
/**
* 创建全局异常处理程序
*
* @param objectMapper 对象映射器
* @return 全局异常处理程序
*/
@Bean
public GlobalExceptionHandler globalExceptionHandler(ObjectMapper objectMapper) {
return new GlobalExceptionHandler(objectMapper);
}

/**
* 创建图片验证码处理器
* @param redisTemplate Redis模板
* @return 图片验证码处理器
*/
@Bean
public ImageCodeHandler imageCodeHandler(RedisTemplate redisTemplate) {
return new ImageCodeHandler(redisTemplate);
}
/**
* 创建图片验证码处理器
*
* @param redisTemplate Redis模板
* @return 图片验证码处理器
*/
@Bean
public ImageCodeHandler imageCodeHandler(RedisTemplate redisTemplate) {
return new ImageCodeHandler(redisTemplate);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory<Obje

private final GatewayConfigProperties configProperties;

private final ObjectMapper objectMapper;

private final RedisTemplate<String, Object> redisTemplate;

/**
Expand Down Expand Up @@ -89,7 +87,7 @@ public GatewayFilter apply(Object config) {
CharsetUtil.CHARSET_UTF_8);
// 刷新请求跳过,直接向下执行
if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, requestBodyMap.get("grant_type"))) {
return chain.filter(exchange);
return chain.filter(exchange.mutate().request(serverHttpRequest).build());
}

// 根据 randomStr 参数判断验证码是否正常
Expand Down

0 comments on commit 95e6c45

Please sign in to comment.