报错语言适配
This commit is contained in:
@@ -24,6 +24,10 @@ public class UserContext {
|
||||
throw new UnauthorizedException("Gateway token verification failed");
|
||||
}
|
||||
if (!"AIDA".equals(holder.getSource())) {
|
||||
if ("BUYER".equals(holder.getSource())){
|
||||
AuthPrincipalVo buyerHolder = getBuyerHolder();
|
||||
return buyerHolder;
|
||||
}
|
||||
throw new UnauthorizedException("Gateway token verification failed");
|
||||
}
|
||||
return holder;
|
||||
@@ -52,6 +56,19 @@ public class UserContext {
|
||||
}
|
||||
return holder.getId();
|
||||
}
|
||||
public static AuthPrincipalVo getBuyerHolder() {
|
||||
AuthPrincipalVo holder = userHolder.get();
|
||||
if (holder == null) {
|
||||
if (optionalAuth.get()) {
|
||||
return null;
|
||||
}
|
||||
throw new UnauthorizedException("Gateway token verification failed");
|
||||
}
|
||||
if (!"BUYER".equals(holder.getSource())) {
|
||||
throw new UnauthorizedException("Gateway token verification failed");
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
public static Long getBuyerIdSafely() {
|
||||
AuthPrincipalVo holder = userHolder.get();
|
||||
|
||||
Reference in New Issue
Block a user