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 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 a POLICY_VERSION_OUTDATED rehash.
    • 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

      boolean isAlgorithmAcceptable(String algorithm)
      Returns whether the given algorithm is acceptable for verification under this policy.
    • isProviderAcceptable

      boolean isProviderAcceptable(String providerId)
      Returns whether the given provider identifier is acceptable for verification under this policy.
    • acceptableAlgorithms

      Set<String> acceptableAlgorithms()
      Algorithm identifiers that are still accepted by this policy. The preferred algorithm is always part of this set.
    • acceptableProviderIds

      Set<String> acceptableProviderIds()
      Provider identifiers that are still accepted by this policy. The preferred provider is always part of this set.
    • defaultParameters

      Map<String,String> defaultParameters(String algorithm)
      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

      Map<String,String> minimumParameters(String algorithm)
      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

      Map<String,String> maximumParameters(String algorithm)
      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

      default Set<Integer> rejectedFormatVersions()
      Envelope format versions the operator has explicitly rejected. Envelopes whose formatVersion appears 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

      default Set<Integer> rejectedPolicyVersions()
      Policy versions the operator has explicitly rejected. Envelopes whose policyVersion appears 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).