feat: add missing num_uses field to AuthData
This commit is contained in:
parent
936928a4fb
commit
69da6b9f14
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,9 +1,13 @@
|
|||||||
|
## unreleased
|
||||||
|
|
||||||
|
### Improvements
|
||||||
* Simplify JSON parsing in error handler
|
* Simplify JSON parsing in error handler
|
||||||
* Add new fields from Vault 1.16 and 1.17 to `HealthResponse`
|
* Add new fields from Vault 1.16 and 1.17 to `HealthResponse`
|
||||||
* `echo_duration_ms`
|
* `echo_duration_ms`
|
||||||
* `clock_skew_ms`
|
* `clock_skew_ms`
|
||||||
* `replication_primary_canary_age_ms`
|
* `replication_primary_canary_age_ms`
|
||||||
* `enterprise`
|
* `enterprise`
|
||||||
|
* Add missing `num_uses` field to `AuthData`
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
* Updated Jackson to 2.17.1
|
* Updated Jackson to 2.17.1
|
||||||
|
@ -33,7 +33,7 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public final class AuthData implements Serializable {
|
public final class AuthData implements Serializable {
|
||||||
private static final long serialVersionUID = 3067695351664603536L;
|
private static final long serialVersionUID = 5969334512309655317L;
|
||||||
|
|
||||||
@JsonProperty("client_token")
|
@JsonProperty("client_token")
|
||||||
private String clientToken;
|
private String clientToken;
|
||||||
@ -65,6 +65,9 @@ public final class AuthData implements Serializable {
|
|||||||
@JsonProperty("orphan")
|
@JsonProperty("orphan")
|
||||||
private boolean orphan;
|
private boolean orphan;
|
||||||
|
|
||||||
|
@JsonProperty("num_uses")
|
||||||
|
private Integer numUses;
|
||||||
|
|
||||||
@JsonProperty("mfa_requirement")
|
@JsonProperty("mfa_requirement")
|
||||||
private MfaRequirement mfaRequirement;
|
private MfaRequirement mfaRequirement;
|
||||||
|
|
||||||
@ -134,6 +137,14 @@ public final class AuthData implements Serializable {
|
|||||||
return accessor;
|
return accessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return allowed number of uses for the issued token
|
||||||
|
* @since 1.3
|
||||||
|
*/
|
||||||
|
public Integer getNumUses() {
|
||||||
|
return numUses;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Token is orphan
|
* @return Token is orphan
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
@ -169,12 +180,13 @@ public final class AuthData implements Serializable {
|
|||||||
Objects.equals(leaseDuration, authData.leaseDuration) &&
|
Objects.equals(leaseDuration, authData.leaseDuration) &&
|
||||||
Objects.equals(entityId, authData.entityId) &&
|
Objects.equals(entityId, authData.entityId) &&
|
||||||
Objects.equals(tokenType, authData.tokenType) &&
|
Objects.equals(tokenType, authData.tokenType) &&
|
||||||
|
Objects.equals(numUses, authData.numUses) &&
|
||||||
Objects.equals(mfaRequirement, authData.mfaRequirement);
|
Objects.equals(mfaRequirement, authData.mfaRequirement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(clientToken, accessor, policies, tokenPolicies, metadata, leaseDuration, renewable,
|
return Objects.hash(clientToken, accessor, policies, tokenPolicies, metadata, leaseDuration, renewable,
|
||||||
entityId, tokenType, orphan, mfaRequirement);
|
entityId, tokenType, orphan, numUses, mfaRequirement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ class AuthResponseTest extends AbstractModelTest<AuthResponse> {
|
|||||||
private static final String AUTH_ENTITY_ID = "";
|
private static final String AUTH_ENTITY_ID = "";
|
||||||
private static final String AUTH_TOKEN_TYPE = "service";
|
private static final String AUTH_TOKEN_TYPE = "service";
|
||||||
private static final Boolean AUTH_ORPHAN = false;
|
private static final Boolean AUTH_ORPHAN = false;
|
||||||
|
private static final Integer AUTH_NUM_USES = 42;
|
||||||
private static final String MFA_REQUEST_ID = "d0c9eec7-6921-8cc0-be62-202b289ef163";
|
private static final String MFA_REQUEST_ID = "d0c9eec7-6921-8cc0-be62-202b289ef163";
|
||||||
private static final String MFA_KEY = "enforcementConfigUserpass";
|
private static final String MFA_KEY = "enforcementConfigUserpass";
|
||||||
private static final String MFA_METHOD_TYPE = "totp";
|
private static final String MFA_METHOD_TYPE = "totp";
|
||||||
@ -75,6 +76,7 @@ class AuthResponseTest extends AbstractModelTest<AuthResponse> {
|
|||||||
" \"entity_id\": \"" + AUTH_ENTITY_ID + "\",\n" +
|
" \"entity_id\": \"" + AUTH_ENTITY_ID + "\",\n" +
|
||||||
" \"token_type\": \"" + AUTH_TOKEN_TYPE + "\",\n" +
|
" \"token_type\": \"" + AUTH_TOKEN_TYPE + "\",\n" +
|
||||||
" \"orphan\": " + AUTH_ORPHAN + ",\n" +
|
" \"orphan\": " + AUTH_ORPHAN + ",\n" +
|
||||||
|
" \"num_uses\": " + AUTH_NUM_USES + ",\n" +
|
||||||
" \"mfa_requirement\": {\n" +
|
" \"mfa_requirement\": {\n" +
|
||||||
" \"mfa_request_id\": \"" + MFA_REQUEST_ID + "\",\n" +
|
" \"mfa_request_id\": \"" + MFA_REQUEST_ID + "\",\n" +
|
||||||
" \"mfa_constraints\": {\n" +
|
" \"mfa_constraints\": {\n" +
|
||||||
@ -134,6 +136,7 @@ class AuthResponseTest extends AbstractModelTest<AuthResponse> {
|
|||||||
assertEquals(AUTH_ORPHAN, data.isOrphan(), "Incorrect auth orphan flag");
|
assertEquals(AUTH_ORPHAN, data.isOrphan(), "Incorrect auth orphan flag");
|
||||||
assertEquals(AUTH_TOKEN_TYPE, data.getTokenType(), "Incorrect auth token type");
|
assertEquals(AUTH_TOKEN_TYPE, data.getTokenType(), "Incorrect auth token type");
|
||||||
assertEquals(AUTH_ENTITY_ID, data.getEntityId(), "Incorrect auth entity id");
|
assertEquals(AUTH_ENTITY_ID, data.getEntityId(), "Incorrect auth entity id");
|
||||||
|
assertEquals(AUTH_NUM_USES, data.getNumUses(), "Incorrect auth num uses");
|
||||||
assertEquals(2, data.getPolicies().size(), "Incorrect number of policies");
|
assertEquals(2, data.getPolicies().size(), "Incorrect number of policies");
|
||||||
assertTrue(data.getPolicies().containsAll(Set.of(AUTH_POLICY_1, AUTH_POLICY_2)));
|
assertTrue(data.getPolicies().containsAll(Set.of(AUTH_POLICY_1, AUTH_POLICY_2)));
|
||||||
assertEquals(2, data.getTokenPolicies().size(), "Incorrect number of token policies");
|
assertEquals(2, data.getTokenPolicies().size(), "Incorrect number of token policies");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user