feat: add auth attribute to common response model
This commit is contained in:
parent
8ec160a436
commit
a3393ae0cb
@ -9,6 +9,7 @@
|
||||
* `enterprise`
|
||||
* Add missing `num_uses` field to `AuthData`
|
||||
* Add `mount_type` attribute to common response model
|
||||
* Add `auth` attribute to common response model
|
||||
|
||||
### Dependencies
|
||||
* Updated Jackson to 2.17.1
|
||||
|
@ -17,11 +17,8 @@
|
||||
package de.stklcode.jvault.connector.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import de.stklcode.jvault.connector.model.response.embedded.AuthData;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Vault response for authentication providing auth info in {@link AuthData} field.
|
||||
*
|
||||
@ -31,30 +28,4 @@ import java.util.Objects;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public final class AuthResponse extends VaultDataResponse {
|
||||
private static final long serialVersionUID = 1628851361067456715L;
|
||||
|
||||
@JsonProperty("auth")
|
||||
private AuthData auth;
|
||||
|
||||
/**
|
||||
* @return Authentication data
|
||||
*/
|
||||
public AuthData getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
} else if (o == null || getClass() != o.getClass() || !super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
AuthResponse that = (AuthResponse) o;
|
||||
return Objects.equals(auth, that.auth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), auth);
|
||||
}
|
||||
}
|
||||
|
@ -30,14 +30,11 @@ import java.util.Objects;
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public final class TokenResponse extends VaultDataResponse {
|
||||
private static final long serialVersionUID = -4053126653764241197L;
|
||||
private static final long serialVersionUID = -4341114947980033457L;
|
||||
|
||||
@JsonProperty("data")
|
||||
private TokenData data;
|
||||
|
||||
@JsonProperty("auth")
|
||||
private Boolean auth;
|
||||
|
||||
/**
|
||||
* @return Token data
|
||||
*/
|
||||
@ -45,12 +42,6 @@ public final class TokenResponse extends VaultDataResponse {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Auth data
|
||||
*/
|
||||
public Boolean getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@ -60,11 +51,11 @@ public final class TokenResponse extends VaultDataResponse {
|
||||
return false;
|
||||
}
|
||||
TokenResponse that = (TokenResponse) o;
|
||||
return Objects.equals(data, that.data) && Objects.equals(auth, that.auth);
|
||||
return Objects.equals(data, that.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), data, auth);
|
||||
return Objects.hash(super.hashCode(), data);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
package de.stklcode.jvault.connector.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import de.stklcode.jvault.connector.model.response.embedded.AuthData;
|
||||
import de.stklcode.jvault.connector.model.response.embedded.WrapInfo;
|
||||
|
||||
import java.util.List;
|
||||
@ -29,7 +30,7 @@ import java.util.Objects;
|
||||
* @since 0.1
|
||||
*/
|
||||
public abstract class VaultDataResponse implements VaultResponse {
|
||||
private static final long serialVersionUID = -6396903229092254181L;
|
||||
private static final long serialVersionUID = 4787715235558510045L;
|
||||
|
||||
@JsonProperty("request_id")
|
||||
private String requestId;
|
||||
@ -49,6 +50,9 @@ public abstract class VaultDataResponse implements VaultResponse {
|
||||
@JsonProperty("wrap_info")
|
||||
private WrapInfo wrapInfo;
|
||||
|
||||
@JsonProperty("auth")
|
||||
private AuthData auth;
|
||||
|
||||
@JsonProperty("mount_type")
|
||||
private String mountType;
|
||||
|
||||
@ -96,6 +100,14 @@ public abstract class VaultDataResponse implements VaultResponse {
|
||||
return wrapInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Authentication information for this response
|
||||
* @since 1.3
|
||||
*/
|
||||
public final AuthData getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Information about the type of mount this secret is from (since Vault 1.17)
|
||||
* @since 1.3
|
||||
@ -117,11 +129,12 @@ public abstract class VaultDataResponse implements VaultResponse {
|
||||
Objects.equals(leaseDuration, that.leaseDuration) &&
|
||||
Objects.equals(warnings, that.warnings) &&
|
||||
Objects.equals(wrapInfo, that.wrapInfo) &&
|
||||
Objects.equals(auth, that.auth) &&
|
||||
Objects.equals(mountType, that.mountType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(requestId, leaseId, renewable, leaseDuration, warnings, wrapInfo, mountType);
|
||||
return Objects.hash(requestId, leaseId, renewable, leaseDuration, warnings, wrapInfo, auth, mountType);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user