api key功能开发
This commit is contained in:
1 parent
e6ad3bd85c
commit
bc772b8b15
8 files changed
+109
-37
No files matched your search
@@ -2,6 +2,7 @@ package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -29,7 +30,7 @@ public class AppApiKeys extends BaseEntity
|
||||
private Long userId;
|
||||
|
||||
/** 密钥 */
|
||||
@Excel(name = "密钥")
|
||||
@JsonIgnore
|
||||
private String apiSecret;
|
||||
|
||||
/** 状态 */
|
||||
@@ -142,7 +143,7 @@ public class AppApiKeys extends BaseEntity
|
||||
.append("id", getId())
|
||||
.append("appId", getAppId())
|
||||
.append("userId", getUserId())
|
||||
.append("apiSecret", getApiSecret())
|
||||
.append("apiSecret", "<redacted>")
|
||||
.append("status", getStatus())
|
||||
.append("expiredAt", getExpiredAt())
|
||||
.append("createdAt", getCreatedAt())
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -33,7 +34,7 @@ public class AppApiKeysPlus implements Serializable
|
||||
@Excel(name = "用户")
|
||||
private Long userId;
|
||||
/** 密钥 */
|
||||
@Excel(name = "密钥")
|
||||
@JsonIgnore
|
||||
private String apiSecret;
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
@@ -140,7 +141,7 @@ public class AppApiKeysPlus implements Serializable
|
||||
.append("id", getId())
|
||||
.append("appId", getAppId())
|
||||
.append("userId", getUserId())
|
||||
.append("apiSecret", getApiSecret())
|
||||
.append("apiSecret", "<redacted>")
|
||||
.append("status", getStatus())
|
||||
.append("expiredAt", getExpiredAt())
|
||||
.append("createdAt", getCreatedAt())
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
/** API Key 创建结果。apiSecret 只在创建成功响应中返回一次。 */
|
||||
public class AppApiKeyCreateResult {
|
||||
private final Long id;
|
||||
private final Long appId;
|
||||
private final String apiSecret;
|
||||
|
||||
public AppApiKeyCreateResult(Long id, Long appId, String apiSecret) {
|
||||
this.id = id;
|
||||
this.appId = appId;
|
||||
this.apiSecret = apiSecret;
|
||||
}
|
||||
public Long getId() { return id; }
|
||||
public Long getAppId() { return appId; }
|
||||
public String getApiSecret() { return apiSecret; }
|
||||
}
|
||||
Reference in new issue
Block a user