summaryrefslogtreecommitdiff
path: root/internal/configuration/decode_hooks.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2022-12-05 09:37:08 +1100
committerGitHub <noreply@github.com>2022-12-05 09:37:08 +1100
commit0aa674505928f1d1d28f70db777710f5c7a4713a (patch)
tree1d1fdacba24dca1368e57c0cab405c8209dd11e3 /internal/configuration/decode_hooks.go
parent87004ccb570eb76b5656bd9cbd617932ab1b0312 (diff)
build(deps): update module github.com/go-crypt/crypt to v0.2.2 (#4452)
Diffstat (limited to 'internal/configuration/decode_hooks.go')
-rw-r--r--internal/configuration/decode_hooks.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/configuration/decode_hooks.go b/internal/configuration/decode_hooks.go
index a5872627f..5f059e8be 100644
--- a/internal/configuration/decode_hooks.go
+++ b/internal/configuration/decode_hooks.go
@@ -12,7 +12,7 @@ import (
"strings"
"time"
- "github.com/go-crypt/crypt"
+ "github.com/go-crypt/crypt/algorithm/plaintext"
"github.com/mitchellh/mapstructure"
"github.com/authelia/authelia/v4/internal/configuration/schema"
@@ -486,7 +486,7 @@ func StringToPrivateKeyHookFunc() mapstructure.DecodeHookFuncType {
}
// StringToPasswordDigestHookFunc decodes a string into a crypt.Digest.
-func StringToPasswordDigestHookFunc(plaintext bool) mapstructure.DecodeHookFuncType {
+func StringToPasswordDigestHookFunc() mapstructure.DecodeHookFuncType {
return func(f reflect.Type, t reflect.Type, data interface{}) (value interface{}, err error) {
var ptr bool
@@ -514,11 +514,11 @@ func StringToPasswordDigestHookFunc(plaintext bool) mapstructure.DecodeHookFuncT
var result *schema.PasswordDigest
if !strings.HasPrefix(dataStr, "$") {
- dataStr = fmt.Sprintf(crypt.StorageFormatSimple, crypt.AlgorithmPrefixPlainText, dataStr)
+ dataStr = fmt.Sprintf(plaintext.EncodingFmt, plaintext.AlgIdentifierPlainText, dataStr)
}
if dataStr != "" {
- if result, err = schema.NewPasswordDigest(dataStr, plaintext); err != nil {
+ if result, err = schema.DecodePasswordDigest(dataStr); err != nil {
return nil, fmt.Errorf(errFmtDecodeHookCouldNotParse, dataStr, prefixType, expectedType.String(), err)
}
}