Pre Merge pull request !434 from zvae/5.X

This commit is contained in:
zvae 2023-10-25 03:30:25 +00:00 committed by Gitee
commit b0978133da
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 36 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import me.zhyd.oauth.utils.AuthStateUtils;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginBody;
import org.dromara.common.core.domain.model.RegisterBody;
import org.dromara.common.core.enums.ClientStatus;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.MessageUtils;
import org.dromara.common.core.utils.StreamUtils;
@ -78,6 +79,9 @@ public class AuthController {
if (ObjectUtil.isNull(client) || !StringUtils.contains(client.getGrantType(), grantType)) {
log.info("客户端id: {} 认证类型:{} 异常!.", clientId, grantType);
return R.fail(MessageUtils.message("auth.grant.type.error"));
} else if (!ClientStatus.OK.getCode().equals(client.getStatus())) {
log.info("客户端id: {} 认证类型:{} 客户端状态: {} 异常!.", clientId, grantType, client.getStatus());
return R.fail(MessageUtils.message("auth.client.status.error"));
}
// 校验租户
loginService.checkTenant(loginBody.getTenantId());

View File

@ -31,6 +31,7 @@ user.unknown.error=未知错误,请重新登录
auth.grant.type.error=认证权限类型错误
auth.grant.type.not.blank=认证权限类型不能为空
auth.clientid.not.blank=认证客户端id不能为空
auth.client.status.error=认证客户端状态错误
##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符

View File

@ -31,6 +31,7 @@ user.unknown.error=Unknown error, please login again
auth.grant.type.error=Auth grant type error
auth.grant.type.not.blank=Auth grant type cannot be blank
auth.clientid.not.blank=Auth clientid cannot be blank
auth.client.status.error=Auth client status error
##文件上传消息
upload.exceed.maxSize=The uploaded file size exceeds the limit file size<br/>the maximum allowed file size is{0}MB
upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters

View File

@ -31,6 +31,7 @@ user.unknown.error=未知错误,请重新登录
auth.grant.type.error=认证权限类型错误
auth.grant.type.not.blank=认证权限类型不能为空
auth.clientid.not.blank=认证客户端id不能为空
auth.client.status.error=认证客户端状态错误
##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符

View File

@ -0,0 +1,29 @@
package org.dromara.common.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 客户端状态
*
* @author lsh
*/
@Getter
@AllArgsConstructor
public enum ClientStatus {
/**
* 正常
*/
OK("0", "正常"),
/**
* 停用
*/
DISABLE("1", "停用"),
/**
* 删除
*/
DELETED("2", "删除");
private final String code;
private final String info;
}