Class DefaultPasswordHashingService
java.lang.Object
com.svenruppert.jsentinel.credential.password.DefaultPasswordHashingService
- All Implemented Interfaces:
PasswordHashingService
Reference
PasswordHashingService.
Each verify(...) call walks the pipeline in this strict
order:
- acquire limiter permit — one
KdfExecutionLimiterpermit covers the whole call, including any dummy KDF taken on failure; - parse — decode the envelope through
PasswordHashCodec; - validate — gate the envelope through
PasswordHashValidator(rejects out-of-bound parameters cheaply, CWE-400); - resolveProvider — look up the provider that produced the envelope (CWE-693);
- resolvePepper — ask the
PepperServicefor the stored pepper key; Phase 1a'sNoOpPepperServicenever resolves a key, so any peppered envelope correctly fails verification rather than getting silently downgraded; - verify — delegate the constant-time comparison to the provider;
- rehashDecision — on success, compute whether the envelope should be transparently upgraded.
Every failure path executes a comparable
DummyVerificationService call before returning so that
"user does not exist", "envelope is malformed"
and "provider is missing" collapse onto the same
observable timing profile (CWE-203, CWE-208). Every public failure
collapses onto PublicFailureType.INVALID_CREDENTIALS; the
differentiated InternalAuditEventType is preserved for audit
sinks.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThrown byhash(char[])when the limiter is saturated. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPasswordHashingService(PasswordHashCodec codec, PasswordHashValidator validator, PasswordHashProviderRegistry providerRegistry, PepperService pepperService, PasswordHashPolicy policy, RehashDecisionEngine rehashEngine, KdfExecutionLimiter limiter, DummyVerificationService dummyService) -
Method Summary
Modifier and TypeMethodDescriptionhash(char[] password) Produces a fresh hash for the given password under the active policy.needsRehash(String encodedHash) Reports whether the supplied envelope should be rehashed under the active policy.Runs the verification pipeline on the supplied envelope.verifyAgainstNothing(char[] password) Convenience entry point for callers that already know there is no stored envelope to verify against (typically "unknown user" paths).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PasswordHashingService
hash, verify, verifyAgainstNothingModifier and TypeMethodDescriptiondefault PasswordHashResulthash(SecretValue password) SecretValue overload forPasswordHashingService.hash(char[]).default CredentialVerificationResultverify(SecretValue password, String encodedHash) SecretValue overload forPasswordHashingService.verify(char[], String).default CredentialVerificationResultverifyAgainstNothing(SecretValue password) SecretValue overload forPasswordHashingService.verifyAgainstNothing(char[]).
-
Constructor Details
-
DefaultPasswordHashingService
public DefaultPasswordHashingService(PasswordHashCodec codec, PasswordHashValidator validator, PasswordHashProviderRegistry providerRegistry, PepperService pepperService, PasswordHashPolicy policy, RehashDecisionEngine rehashEngine, KdfExecutionLimiter limiter, DummyVerificationService dummyService)
-
-
Method Details
-
hash
Description copied from interface:PasswordHashingServiceProduces a fresh hash for the given password under the active policy.- Specified by:
hashin interfacePasswordHashingService- Parameters:
password- caller-owned character buffer; the implementation must not modify or zero it
-
verify
Description copied from interface:PasswordHashingServiceRuns the verification pipeline on the supplied envelope.- Specified by:
verifyin interfacePasswordHashingService
-
verifyAgainstNothing
Description copied from interface:PasswordHashingServiceConvenience entry point for callers that already know there is no stored envelope to verify against (typically "unknown user" paths). The implementation still performs a comparable KDF call so the response is not distinguishable from a real verification (CWE-203, CWE-208).- Specified by:
verifyAgainstNothingin interfacePasswordHashingService
-
needsRehash
Description copied from interface:PasswordHashingServiceReports whether the supplied envelope should be rehashed under the active policy.- Specified by:
needsRehashin interfacePasswordHashingService
-