✨ Introducing new features. closed #3013 【重构】重构前端index.vue 的刷新逻辑抽取成对应的方法

This commit is contained in:
wjie committed 2021-08-05 17:54:27 +08:00
1 parent db7bc750d7
commit cbf8fb0da9
2 files changed
+48 -2

No files matched your search

@@ -76,11 +76,11 @@ public class PigxWebResponseExceptionTranslator implements WebResponseExceptionT
return handleOAuth2Exception(new MethodNotAllowedException(ase.getMessage(), ase));
}
// 处理不合法的令牌错误 401 返回
// 处理不合法的令牌错误 427 返回
ase = (InvalidTokenException) throwableAnalyzer.getFirstThrowableOfType(InvalidTokenException.class,
causeChain);
if (ase != null) {
return handleOAuth2Exception(new UnauthorizedException(ase.getMessage(), ase));
return handleOAuth2Exception(new TokenInvalidException(ase.getMessage(), ase));
}
ase = (OAuth2Exception) throwableAnalyzer.getFirstThrowableOfType(OAuth2Exception.class, causeChain);
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.common.security.exception;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pig4cloud.pigx.common.security.component.PigxAuth2ExceptionSerializer;
/**
* @author lengleng
* @date 2021-08-05
* <p>
* 令牌不合法
*/
@JsonSerialize(using = PigxAuth2ExceptionSerializer.class)
public class TokenInvalidException extends PigxAuth2Exception {
public TokenInvalidException(String msg, Throwable t) {
super(msg);
}
@Override
public String getOAuth2ErrorCode() {
return "invalid_token";
}
@Override
public int getHttpErrorCode() {
return 427;
}
}