model: extend AuthMethod model and embedded config (#72)
Introduce MountConfig and UserLockoutConfig models and add some missing fields to AuthMethod.
This commit is contained in:
@@ -34,7 +34,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public final class AuthMethod implements Serializable {
|
||||
private static final long serialVersionUID = -2718660627880077335L;
|
||||
private static final long serialVersionUID = -439987082190917691L;
|
||||
|
||||
private AuthBackend type;
|
||||
private String rawType;
|
||||
@@ -42,11 +42,14 @@ public final class AuthMethod implements Serializable {
|
||||
@JsonProperty("accessor")
|
||||
private String accessor;
|
||||
|
||||
@JsonProperty("deprecation_status")
|
||||
private String deprecationStatus;
|
||||
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
|
||||
@JsonProperty("config")
|
||||
private Map<String, String> config;
|
||||
private MountConfig config;
|
||||
|
||||
@JsonProperty("external_entropy_access")
|
||||
private boolean externalEntropyAccess;
|
||||
@@ -54,6 +57,18 @@ public final class AuthMethod implements Serializable {
|
||||
@JsonProperty("local")
|
||||
private boolean local;
|
||||
|
||||
@JsonProperty("options")
|
||||
private Map<String, String> options;
|
||||
|
||||
@JsonProperty("plugin_version")
|
||||
private String pluginVersion;
|
||||
|
||||
@JsonProperty("running_plugin_version")
|
||||
private String runningPluginVersion;
|
||||
|
||||
@JsonProperty("running_sha256")
|
||||
private String runningSha256;
|
||||
|
||||
@JsonProperty("seal_wrap")
|
||||
private boolean sealWrap;
|
||||
|
||||
@@ -91,6 +106,14 @@ public final class AuthMethod implements Serializable {
|
||||
return accessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Deprecation status
|
||||
* @since 1.2
|
||||
*/
|
||||
public String getDeprecationStatus() {
|
||||
return deprecationStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Description
|
||||
*/
|
||||
@@ -100,8 +123,10 @@ public final class AuthMethod implements Serializable {
|
||||
|
||||
/**
|
||||
* @return Configuration data
|
||||
* @since 0.2
|
||||
* @since 1.2 Returns {@link MountConfig} instead of {@link Map}
|
||||
*/
|
||||
public Map<String, String> getConfig() {
|
||||
public MountConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -120,6 +145,38 @@ public final class AuthMethod implements Serializable {
|
||||
return local;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Options
|
||||
* @since 1.2
|
||||
*/
|
||||
public Map<String, String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Plugin version
|
||||
* @since 1.2
|
||||
*/
|
||||
public String getPluginVersion() {
|
||||
return pluginVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Running plugin version
|
||||
* @since 1.2
|
||||
*/
|
||||
public String getRunningPluginVersion() {
|
||||
return runningPluginVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Running SHA256
|
||||
* @since 1.2
|
||||
*/
|
||||
public String getRunningSha256() {
|
||||
return runningSha256;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Seal wrapping enabled
|
||||
* @since 1.1
|
||||
@@ -150,13 +207,19 @@ public final class AuthMethod implements Serializable {
|
||||
sealWrap == that.sealWrap &&
|
||||
Objects.equals(rawType, that.rawType) &&
|
||||
Objects.equals(accessor, that.accessor) &&
|
||||
Objects.equals(deprecationStatus, that.deprecationStatus) &&
|
||||
Objects.equals(description, that.description) &&
|
||||
Objects.equals(config, that.config) &&
|
||||
Objects.equals(options, that.options) &&
|
||||
Objects.equals(pluginVersion, that.pluginVersion) &&
|
||||
Objects.equals(runningPluginVersion, that.runningPluginVersion) &&
|
||||
Objects.equals(runningSha256, that.runningSha256) &&
|
||||
Objects.equals(uuid, that.uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, rawType, accessor, description, config, externalEntropyAccess, local, sealWrap, uuid);
|
||||
return Objects.hash(type, rawType, accessor, deprecationStatus, description, config, externalEntropyAccess,
|
||||
local, options, pluginVersion, runningPluginVersion, runningSha256, sealWrap, uuid);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,168 @@
|
||||
package de.stklcode.jvault.connector.model.response.embedded;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Embedded mount config output.
|
||||
*
|
||||
* @author Stefan Kalscheuer
|
||||
* @since 1.2
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MountConfig implements Serializable {
|
||||
private static final long serialVersionUID = -8653909672663717792L;
|
||||
|
||||
@JsonProperty("default_lease_ttl")
|
||||
private Integer defaultLeaseTtl;
|
||||
|
||||
@JsonProperty("max_lease_ttl")
|
||||
private Integer maxLeaseTtl;
|
||||
|
||||
@JsonProperty("force_no_cache")
|
||||
private Boolean forceNoCache;
|
||||
|
||||
@JsonProperty("token_type")
|
||||
private String tokenType;
|
||||
|
||||
@JsonProperty("audit_non_hmac_request_keys")
|
||||
private List<String> auditNonHmacRequestKeys;
|
||||
|
||||
@JsonProperty("audit_non_hmac_response_keys")
|
||||
private List<String> auditNonHmacResponseKeys;
|
||||
|
||||
@JsonProperty("listing_visibility")
|
||||
private String listingVisibility;
|
||||
|
||||
@JsonProperty("passthrough_request_headers")
|
||||
private List<String> passthroughRequestHeaders;
|
||||
|
||||
@JsonProperty("allowed_response_headers")
|
||||
private List<String> allowedResponseHeaders;
|
||||
|
||||
@JsonProperty("allowed_managed_keys")
|
||||
private List<String> allowedManagedKeys;
|
||||
|
||||
@JsonProperty("delegated_auth_accessors")
|
||||
private List<String> delegatedAuthAccessors;
|
||||
|
||||
@JsonProperty("user_lockout_config")
|
||||
private UserLockoutConfig userLockoutConfig;
|
||||
|
||||
/**
|
||||
* @return Default lease TTL
|
||||
*/
|
||||
public Integer getDefaultLeaseTtl() {
|
||||
return defaultLeaseTtl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Maximum lease TTL
|
||||
*/
|
||||
public Integer getMaxLeaseTtl() {
|
||||
return maxLeaseTtl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Force no cache?
|
||||
*/
|
||||
public Boolean getForceNoCache() {
|
||||
return forceNoCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Token type
|
||||
*/
|
||||
public String getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Audit non HMAC request keys
|
||||
*/
|
||||
public List<String> getAuditNonHmacRequestKeys() {
|
||||
return auditNonHmacRequestKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Audit non HMAC response keys
|
||||
*/
|
||||
public List<String> getAuditNonHmacResponseKeys() {
|
||||
return auditNonHmacResponseKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Listing visibility
|
||||
*/
|
||||
public String getListingVisibility() {
|
||||
return listingVisibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Passthrough request headers
|
||||
*/
|
||||
public List<String> getPassthroughRequestHeaders() {
|
||||
return passthroughRequestHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Allowed response headers
|
||||
*/
|
||||
public List<String> getAllowedResponseHeaders() {
|
||||
return allowedResponseHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Allowed managed keys
|
||||
*/
|
||||
public List<String> getAllowedManagedKeys() {
|
||||
return allowedManagedKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Delegated auth accessors
|
||||
*/
|
||||
public List<String> getDelegatedAuthAccessors() {
|
||||
return delegatedAuthAccessors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User lockout config
|
||||
*/
|
||||
public UserLockoutConfig getUserLockoutConfig() {
|
||||
return userLockoutConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
} else if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MountConfig that = (MountConfig) o;
|
||||
return Objects.equals(defaultLeaseTtl, that.defaultLeaseTtl) &&
|
||||
Objects.equals(maxLeaseTtl, that.maxLeaseTtl) &&
|
||||
Objects.equals(forceNoCache, that.forceNoCache) &&
|
||||
Objects.equals(tokenType, that.tokenType) &&
|
||||
Objects.equals(auditNonHmacRequestKeys, that.auditNonHmacRequestKeys) &&
|
||||
Objects.equals(auditNonHmacResponseKeys, that.auditNonHmacResponseKeys) &&
|
||||
Objects.equals(listingVisibility, that.listingVisibility) &&
|
||||
Objects.equals(passthroughRequestHeaders, that.passthroughRequestHeaders) &&
|
||||
Objects.equals(allowedResponseHeaders, that.allowedResponseHeaders) &&
|
||||
Objects.equals(allowedManagedKeys, that.allowedManagedKeys) &&
|
||||
Objects.equals(delegatedAuthAccessors, that.delegatedAuthAccessors) &&
|
||||
Objects.equals(userLockoutConfig, that.userLockoutConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(defaultLeaseTtl, maxLeaseTtl, forceNoCache, tokenType, auditNonHmacRequestKeys,
|
||||
auditNonHmacResponseKeys, listingVisibility, passthroughRequestHeaders, allowedResponseHeaders,
|
||||
allowedManagedKeys, delegatedAuthAccessors, userLockoutConfig);
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package de.stklcode.jvault.connector.model.response.embedded;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Embedded user lockout config output.
|
||||
*
|
||||
* @author Stefan Kalscheuer
|
||||
* @since 1.2
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class UserLockoutConfig implements Serializable {
|
||||
private static final long serialVersionUID = -8051060041593140550L;
|
||||
|
||||
@JsonProperty("lockout_threshold")
|
||||
private Integer lockoutThreshold;
|
||||
|
||||
@JsonProperty("lockout_duration")
|
||||
private Integer lockoutDuration;
|
||||
|
||||
@JsonProperty("lockout_counter_reset_duration")
|
||||
private Integer lockoutCounterResetDuration;
|
||||
|
||||
@JsonProperty("lockout_disable")
|
||||
private Boolean lockoutDisable;
|
||||
|
||||
/**
|
||||
* @return Lockout threshold
|
||||
*/
|
||||
public Integer getLockoutThreshold() {
|
||||
return lockoutThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Lockout duration
|
||||
*/
|
||||
public Integer getLockoutDuration() {
|
||||
return lockoutDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Lockout counter reset duration
|
||||
*/
|
||||
public Integer getLockoutCounterResetDuration() {
|
||||
return lockoutCounterResetDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Lockout disabled?
|
||||
*/
|
||||
public Boolean getLockoutDisable() {
|
||||
return lockoutDisable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
} else if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UserLockoutConfig that = (UserLockoutConfig) o;
|
||||
return Objects.equals(lockoutThreshold, that.lockoutThreshold) &&
|
||||
Objects.equals(lockoutDuration, that.lockoutDuration) &&
|
||||
Objects.equals(lockoutCounterResetDuration, that.lockoutCounterResetDuration) &&
|
||||
Objects.equals(lockoutDisable, that.lockoutDisable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(lockoutThreshold, lockoutDuration, lockoutCounterResetDuration, lockoutDisable);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user