feat(api): integrates drupal7 hash verifier from passwap (#10918)

# Which Problems Are Solved

- Integrates the Drupal 7 hash verifier from passwap

# Additional Changes

- The docs inform about the option to use the Drupal 7 hash verifier
- Updates passwap to version v0.10.0

# Additional Context

- Follow-up for PR
[#passwap/pull/70](https://github.com/zitadel/passwap/pull/70)

Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
lennartzellmer
2025-10-28 16:26:48 +00:00
committed by GitHub
co-authored by Marco A.
parent 39a29f534a
commit f4503e07cd
3 changed files with 23 additions and 2 deletions
+7 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/zitadel/passwap"
"github.com/zitadel/passwap/argon2"
"github.com/zitadel/passwap/bcrypt"
"github.com/zitadel/passwap/drupal7"
"github.com/zitadel/passwap/md5"
"github.com/zitadel/passwap/md5plain"
"github.com/zitadel/passwap/md5salted"
@@ -57,6 +58,7 @@ const (
HashNameSha2 HashName = "sha2" // hash and verify
HashNameScrypt HashName = "scrypt" // hash and verify
HashNamePBKDF2 HashName = "pbkdf2" // hash and verify
HashNameDrupal7 HashName = "drupal7" // verify only, Drupal 7 legacy hashes
)
type HashMode string
@@ -137,6 +139,10 @@ var knowVerifiers = map[HashName]prefixVerifier{
prefixes: []string{phpass.IdentifierP, phpass.IdentifierH},
verifier: phpass.Verifier,
},
HashNameDrupal7: {
prefixes: []string{drupal7.Identifier},
verifier: drupal7.Verifier,
},
}
func (c *HashConfig) buildVerifiers() (verifiers []verifier.Verifier, prefixes []string, err error) {
@@ -174,7 +180,7 @@ func (c *HasherConfig) buildHasher() (hasher passwap.Hasher, prefixes []string,
return c.sha2()
case "":
return nil, nil, fmt.Errorf("missing hasher algorithm")
case HashNameArgon2, HashNameMd5, HashNameMd5Plain, HashNameMd5Salted, HashNamePHPass:
case HashNameArgon2, HashNameMd5, HashNameMd5Plain, HashNameMd5Salted, HashNamePHPass, HashNameDrupal7:
fallthrough
default:
return nil, nil, fmt.Errorf("invalid algorithm %q", c.Algorithm)