Interface PasswordHashPolicy
- All Known Implementing Classes:
DefaultPasswordHashPolicy
public interface PasswordHashPolicy
Active password-hashing policy.
The policy is the single source of truth for which algorithm, provider and parameters are used for newly produced hashes and which envelope shapes are accepted on verify. It also defines the minimum and maximum parameter bounds that the validator enforces before any KDF runs.
The policy is intentionally adapter-neutral: it never references Vaadin, HTTP, JPA or specific provider implementations.
-
Method Summary
Modifier and TypeMethodDescriptionAlgorithm identifiers that are still accepted by this policy.Provider identifiers that are still accepted by this policy.defaultParameters(String algorithm) Default parameters the policy emits when producing a fresh hash with the given algorithm.booleanisAlgorithmAcceptable(String algorithm) Returns whether the given algorithm is acceptable for verification under this policy.booleanisProviderAcceptable(String providerId) Returns whether the given provider identifier is acceptable for verification under this policy.maximumParameters(String algorithm) Upper bound for each parameter value.minimumParameters(String algorithm) Lower bound for each parameter value.intMonotonically increasing version of this policy.Algorithm identifier the policy emits for new hashes.Envelope wire format the policy emits for new hashes.Provider identifier the policy emits for new hashes.Envelope format versions the operator has explicitly rejected.Policy versions the operator has explicitly rejected.
-
Method Details
-
policyVersion
int policyVersion()Monotonically increasing version of this policy. Stored in every envelope. A mismatch between the active policy version and the version embedded in an envelope is one of the triggers for aPOLICY_VERSION_OUTDATEDrehash. -
preferredFormatVersion
PasswordHashFormatVersion preferredFormatVersion()Envelope wire format the policy emits for new hashes. Older known format versions remain readable but may be flagged for rehash. -
preferredAlgorithm
String preferredAlgorithm()Algorithm identifier the policy emits for new hashes. -
preferredProviderId
String preferredProviderId()Provider identifier the policy emits for new hashes. -
isAlgorithmAcceptable
Returns whether the given algorithm is acceptable for verification under this policy. -
isProviderAcceptable
Returns whether the given provider identifier is acceptable for verification under this policy. -
acceptableAlgorithms
-
acceptableProviderIds
-
defaultParameters
Default parameters the policy emits when producing a fresh hash with the given algorithm.- Throws:
PasswordHashValidationException- if the algorithm is unknown to this policy
-
minimumParameters
Lower bound for each parameter value. Validation rejects envelopes whose parameters fall below these values.- Throws:
PasswordHashValidationException- if the algorithm is unknown to this policy
-
maximumParameters
Upper bound for each parameter value. Validation rejects envelopes whose parameters exceed these values; this is the primary defence against parameter-driven resource exhaustion (CWE-400).- Throws:
PasswordHashValidationException- if the algorithm is unknown to this policy
-
rejectedFormatVersions
Envelope format versions the operator has explicitly rejected. Envelopes whoseformatVersionappears here fail validation outright; older versions that are not in this set remain verifiable and are flagged for rehash by the rehash engine.Default: empty (no formats explicitly rejected).
-
rejectedPolicyVersions
Policy versions the operator has explicitly rejected. Envelopes whosepolicyVersionappears here fail validation outright; older versions that are not in this set remain verifiable (and are flagged for rehash if they are below the active policy version).Default: empty (no policy versions explicitly rejected).
-