Commit 49ae7bd5 authored by liqin's avatar liqin 💬

bug fixed

parent 7df89db1
......@@ -47,14 +47,10 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
LOGGER.info("isAccessAllowed");
if (isLoginAttempt(request, response)) {
//if (!isLoginAttempt(request, response) || !executeLogin(request,response)) {
//if (!isLoginAttempt(request, response) || !executeLogin(request,response)) {
try {
executeLogin(request, response);
} catch (UnauthorizedException e) {
// response403(request,response);
return true;
} catch (AuthenticationException ae) {
// response401(request, response);
} catch (UnauthorizedException | AuthenticationException e) {
return true;
}
}
......@@ -100,7 +96,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
try {
HttpServletResponse response = (HttpServletResponse) resp;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=utf-8");
response.setContentType("application/json;charset=utf-8");
response.setStatus(1109);
response.getWriter().write("{\"resultCode\":1109,\"message\":\"账号认证失败!\"}");
} catch (IOException e) {
......@@ -112,15 +108,15 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
* 将非法请求返回401
*/
private void response403(ServletRequest req, ServletResponse resp) {
try {
HttpServletResponse response = (HttpServletResponse) resp;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=utf-8");
response.setStatus(403);
response.getWriter().write("{\"status\":403,\"message\":Unauthorized!}");
} catch (IOException e) {
LOGGER.error(e.getMessage());
}
try {
HttpServletResponse response = (HttpServletResponse) resp;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=utf-8");
response.setStatus(403);
response.getWriter().write("{\"status\":403,\"message\":Unauthorized!}");
} catch (IOException e) {
LOGGER.error(e.getMessage());
}
}
}
......@@ -8,7 +8,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MyExceptionResolver implements HandlerExceptionResolver {
public class MyHandlerExceptionResolver implements HandlerExceptionResolver {
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
......
......@@ -94,7 +94,6 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/loginByQrCode", "anon");
filterChainDefinitionMap.put("/doc.html", "anon");
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
filterChainDefinitionMap.put("/asset/download1", "anon");
filterChainDefinitionMap.put("/404", "anon");
filterChainDefinitionMap.put("/500", "anon");
......
......@@ -52,7 +52,7 @@ import java.util.Set;
@Slf4j
@RestController
@RequestMapping("/asset")
@Api(tags = {"文件资产操作接口"})
@Api(tags = {"视频文件汇出接口"})
public class AssetController extends BaseController {
private static final String BASE_STRING = "1234567890abcdef";
......@@ -102,7 +102,7 @@ public class AssetController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "idList", value = "视频文件标识ID集合", dataType = "String", paramType = "path")
})
@PostMapping("/download")
@GetMapping("/download")
@RequiresAuthentication
public void download(@RequestParam("idList") List<String> idList, HttpServletResponse response) throws IOException {
response.setContentType("application/octet-stream");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment