Merge remote-tracking branch 'origin/master'
# Conflicts: # system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsYunPianPlatform.java
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.Map;
|
||||
public interface AdminService {
|
||||
|
||||
/**
|
||||
* 用户认证。认证成功后,返回认证信息
|
||||
* 管理员认证。认证成功后,返回认证信息
|
||||
*
|
||||
* 实际上,就是用户名 + 密码登陆
|
||||
*
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.iocoder.mall.admin.api.bo.oauth2.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.admin.api.bo.oauth2.OAuth2AuthenticationBO;
|
||||
import cn.iocoder.mall.admin.api.dto.oauth2.OAuth2CreateTokenDTO;
|
||||
import cn.iocoder.mall.admin.api.dto.oauth2.OAuth2GetTokenDTO;
|
||||
import cn.iocoder.mall.admin.api.dto.oauth2.OAuth2RefreshTokenDTO;
|
||||
import cn.iocoder.mall.admin.api.dto.oauth2.OAuth2RemoveTokenByUserDTO;
|
||||
|
||||
/**
|
||||
* Oauth2 服务接口
|
||||
@@ -18,7 +20,20 @@ public interface OAuth2Service {
|
||||
*/
|
||||
OAuth2AccessTokenBO createToken(OAuth2CreateTokenDTO oauth2CreateTokenDTO);
|
||||
|
||||
// TODO @see 刷新 token
|
||||
/**
|
||||
* 基于用户移除 accessToken
|
||||
*
|
||||
* @param oauth2RemoveTokenDTO accessToken 信息
|
||||
*/
|
||||
void removeToken(OAuth2RemoveTokenByUserDTO oauth2RemoveTokenDTO);
|
||||
|
||||
/**
|
||||
* 刷新令牌,获得新的 accessToken 信息
|
||||
*
|
||||
* @param oauth2RefreshTokenDTO refreshToken 信息
|
||||
* @return accessToken 信息
|
||||
*/
|
||||
OAuth2AccessTokenBO refreshToken(OAuth2RefreshTokenDTO oauth2RefreshTokenDTO);
|
||||
|
||||
/**
|
||||
* 通过 accessToken 获得身份信息
|
||||
|
||||
@@ -5,16 +5,20 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("管理员授权 BO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminAuthorizationBO {
|
||||
public class AdminAuthorizationBO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "登陆账号", required = true, example = "1")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "角色编号数组", required = true, example = "1")
|
||||
private Set<Integer> roleIds;
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("OAUTH2 认证 BO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2AuthenticationBO {
|
||||
public class OAuth2AuthenticationBO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer userId;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package cn.iocoder.mall.admin.api.bo.oauth2;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* OAUTH2 认证 BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2AuthenticationOldBO implements Serializable {
|
||||
|
||||
/**
|
||||
* 管理员编号
|
||||
*/
|
||||
private Integer adminId;
|
||||
/**
|
||||
* 角色编号数组
|
||||
*/
|
||||
private Set<Integer> roleIds;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,14 @@ package cn.iocoder.mall.admin.api.constant;
|
||||
|
||||
public class AdminConstants {
|
||||
|
||||
/**
|
||||
* 账号 - 管理员
|
||||
*/
|
||||
public static final String USERNAME_ADMIN = "admin";
|
||||
|
||||
}
|
||||
/**
|
||||
* 账号 - 演示账号
|
||||
*/
|
||||
public static final String USERNAME_DEMO = "yudaoyuanma";
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ public enum AdminErrorCodeEnum {
|
||||
OAUTH2_INVALID_TOKEN_INVALID(1002001013, "访问令牌已失效"),
|
||||
OAUTH2_NOT_LOGIN(1002001015, "账号未登陆"),
|
||||
OAUTH2_INVALID_TOKEN_ERROR_USER_TYPE(1002001016, "访问令牌用户类型不正确"),
|
||||
|
||||
OAUTH_INVALID_TOKEN(1002001020, ""), // 预留
|
||||
OAUTH_INVALID_REFRESH_TOKEN_NOT_FOUND(1002001017, "刷新令牌不存在"),
|
||||
OAUTH_INVALID_REFRESH_TOKEN_EXPIRED(1002001018, "访问令牌已过期"),
|
||||
OAUTH_INVALID_REFRESH_TOKEN_INVALID(1002001019, "刷新令牌已失效"),
|
||||
|
||||
// ========== 管理员模块 1002002000 ==========
|
||||
ADMIN_USERNAME_NOT_REGISTERED(1002002000, "账号不存在"),
|
||||
@@ -30,6 +31,8 @@ public enum AdminErrorCodeEnum {
|
||||
ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"),
|
||||
ADMIN_ASSIGN_ROLE_NOT_EXISTS(1002002006, "分配员工角色时,有角色不存在"),
|
||||
ADMIN_INVALID_PERMISSION(1002002007, "没有该操作权限"),
|
||||
ADMIN_ADMIN_CAN_NOT_UPDATE(1002002008, "管理员的账号不允许变更"),
|
||||
ADMIN_DEMO_CAN_NOT_WRITE(1002002009, "演示账号,暂不允许写操作。欢迎加入我们的交流群:http://t.cn/EKEr5WE"),
|
||||
|
||||
// ========== 资源模块 1002003000 ==========
|
||||
RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"),
|
||||
|
||||
@@ -8,11 +8,12 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("OAuth2 创建 Token DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2CreateTokenDTO {
|
||||
public class OAuth2CreateTokenDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
|
||||
@@ -9,11 +9,12 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("OAuth2 身份验证 DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2GetTokenDTO {
|
||||
public class OAuth2GetTokenDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "accessToken", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
|
||||
@NotEmpty(message = "accessToken 不能为空")
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.admin.api.dto.oauth2;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.admin.api.constant.ResourceTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("OAuth2 刷新 Token DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2RefreshTokenDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "refreshToken", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
|
||||
@NotEmpty(message = "refreshToken 不能为空")
|
||||
private String refreshToken;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", required = true, example = "1", notes = "参见 ResourceTypeEnum 枚举")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
@InEnum(value = ResourceTypeEnum.class, message = "用户类型必须是 {value}")
|
||||
private Integer userType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.mall.admin.api.dto.oauth2;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.admin.api.constant.ResourceTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("OAuth2 移除 Token DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OAuth2RemoveTokenByUserDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", required = true, example = "1", notes = "参见 ResourceTypeEnum 枚举")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
@InEnum(value = ResourceTypeEnum.class, message = "用户类型必须是 {value}")
|
||||
private Integer userType;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user