完成 OAuth2 的客户端模块

This commit is contained in:
YunaiV
2022-05-12 01:09:16 +08:00
parent 1f36af8e6a
commit 97db4586a8
34 changed files with 511 additions and 104 deletions

View File

@ -44,6 +44,6 @@ public interface OAuth2TokenApi {
* @param clientId 客户端编号
* @return 访问令牌的信息
*/
OAuth2AccessTokenRespDTO refreshAccessToken(String refreshToken, Long clientId);
OAuth2AccessTokenRespDTO refreshAccessToken(String refreshToken, String clientId);
}

View File

@ -30,6 +30,6 @@ public class OAuth2AccessTokenCreateReqDTO implements Serializable {
* 客户端编号
*/
@NotNull(message = "客户端编号不能为空")
private Long clientId;
private String clientId;
}

View File

@ -125,5 +125,6 @@ public interface ErrorCodeConstants {
// ========== 系统敏感词 1002020000 =========
ErrorCode OAUTH2_CLIENT_NOT_EXISTS = new ErrorCode(1002020000, "OAuth2 客户端不存在");
ErrorCode OAUTH2_CLIENT_EXISTS = new ErrorCode(1002020001, "OAuth2 客户端编号已存在");
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.system.enums.auth;
/**
* OAuth2.0 客户端的通用枚举
*
* @author 芋道源码
*/
public interface OAuth2ClientConstants {
String CLIENT_ID_DEFAULT = "default";
}

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.system.enums.auth;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* OAuth2.0 客户端的编号枚举
*/
@AllArgsConstructor
@Getter
public enum OAuth2ClientIdEnum {
DEFAULT(1L); // 系统默认
private final Long id;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.system.enums.auth;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* OAuth2 授权类型(模式)的枚举
*
* @author 芋道源码
*/
@AllArgsConstructor
@Getter
public enum OAuth2GrantTypeEnum {
PASSWORD("password"), // 密码模式
AUTHORIZATION_CODE("authorization_code"), // 授权码模式
IMPLICIT("implicit"), // 简化模式
CLIENT_CREDENTIALS("client_credentials"), // 客户端模式
REFRESH_TOKEN("refresh_token"), // 刷新模式
;
private final String grantType;
}