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