可正常运行,尝试修改convert到service

This commit is contained in:
dengqichen 2024-11-28 13:02:58 +08:00
parent fa66642718
commit a157e66e38
3 changed files with 4 additions and 5 deletions

View File

@ -19,7 +19,7 @@ public class TenantInterceptor implements HandlerInterceptor {
// 不需要进行租户隔离的路径
private final List<String> excludePaths = Arrays.asList(
// "/api/v1/users/login",
"/api/v1/users/login",
"/api/v1/tenant/list",
"/swagger-ui/**",
"/v3/api-docs/**"

View File

@ -3,7 +3,6 @@ package com.qqchen.deploy.backend.common.security.filter;
import com.qqchen.deploy.backend.common.context.TenantContext;
import com.qqchen.deploy.backend.common.security.util.JwtTokenUtil;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
@ -13,10 +12,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

View File

@ -6,6 +6,7 @@ import com.qqchen.deploy.backend.common.enums.ResponseCode;
import com.qqchen.deploy.backend.common.utils.MessageUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InsufficientAuthenticationException;
@ -18,6 +19,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
@Component
@Slf4j
public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {
private final ObjectMapper objectMapper = new ObjectMapper();
@ -36,7 +38,7 @@ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint
} else {
result = Response.error(ResponseCode.UNAUTHORIZED, MessageUtils.getMessage(ResponseCode.UNAUTHORIZED.getMessageKey()));
}
log.error("Custom authentication entry point error", authException);
response.getWriter().write(objectMapper.writeValueAsString(result));
}
}