mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-07 02:57:51 +00:00
feat(cli): add Device Flow data models
This commit is contained in:
parent
dd4f8d8abe
commit
37fd831ce7
4 changed files with 58 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
package com.iflytek.skillhub.auth.device;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DeviceCodeData implements Serializable {
|
||||
private String deviceCode;
|
||||
private String userCode;
|
||||
private DeviceCodeStatus status;
|
||||
private String userId;
|
||||
|
||||
public DeviceCodeData() {}
|
||||
|
||||
public DeviceCodeData(String deviceCode, String userCode,
|
||||
DeviceCodeStatus status, String userId) {
|
||||
this.deviceCode = deviceCode;
|
||||
this.userCode = userCode;
|
||||
this.status = status;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getDeviceCode() { return deviceCode; }
|
||||
public String getUserCode() { return userCode; }
|
||||
public DeviceCodeStatus getStatus() { return status; }
|
||||
public void setStatus(DeviceCodeStatus status) { this.status = status; }
|
||||
public String getUserId() { return userId; }
|
||||
public void setUserId(String userId) { this.userId = userId; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.iflytek.skillhub.auth.device;
|
||||
|
||||
public record DeviceCodeResponse(
|
||||
String deviceCode,
|
||||
String userCode,
|
||||
String verificationUri,
|
||||
int expiresIn,
|
||||
int interval
|
||||
) {}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.iflytek.skillhub.auth.device;
|
||||
|
||||
public enum DeviceCodeStatus {
|
||||
PENDING,
|
||||
AUTHORIZED,
|
||||
USED
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.iflytek.skillhub.auth.device;
|
||||
|
||||
public record DeviceTokenResponse(
|
||||
String accessToken,
|
||||
String tokenType,
|
||||
String error
|
||||
) {
|
||||
public static DeviceTokenResponse pending() {
|
||||
return new DeviceTokenResponse(null, null, "authorization_pending");
|
||||
}
|
||||
|
||||
public static DeviceTokenResponse success(String token) {
|
||||
return new DeviceTokenResponse(token, "Bearer", null);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue