summaryrefslogtreecommitdiff
path: root/internal/authentication/file_user_provider.go
diff options
context:
space:
mode:
authorAmir Zarrinkafsh <nightah@me.com>2020-05-03 02:20:40 +1000
committerGitHub <noreply@github.com>2020-05-02 18:20:40 +0200
commitbe0cc72473d30f66aabb1aab4f20e06ae6a44053 (patch)
tree7ae60e894c34da99d48aa5491c1254e5daee43e8 /internal/authentication/file_user_provider.go
parent310c5dc09b1ae00373f710a60bb63d59f5c91dbc (diff)
[CI] Add goconst linter (#961)
* [CI] Add goconst linter * Implement goconst recommendations * Rename defaultPolicy to denyPolicy * Change order for test constants Co-authored-by: Clément Michaud <clement.michaud34@gmail.com>
Diffstat (limited to 'internal/authentication/file_user_provider.go')
-rw-r--r--internal/authentication/file_user_provider.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/authentication/file_user_provider.go b/internal/authentication/file_user_provider.go
index c0e0c8600..5d442ee5f 100644
--- a/internal/authentication/file_user_provider.go
+++ b/internal/authentication/file_user_provider.go
@@ -54,7 +54,7 @@ func NewFileUserProvider(configuration *schema.FileAuthenticationBackendConfigur
// TODO: Remove this. This is only here to temporarily fix the username enumeration security flaw in #949.
// This generates a hash that should be usable to do a fake CheckUserPassword
algorithm := configuration.Password.Algorithm
- if configuration.Password.Algorithm == "sha512" {
+ if configuration.Password.Algorithm == sha512 {
algorithm = HashingAlgorithmSHA512
}
settings := getCryptSettings(utils.RandomString(configuration.Password.SaltLength, HashingPossibleSaltCharacters),
@@ -143,7 +143,7 @@ func (p *FileUserProvider) UpdatePassword(username string, newPassword string) e
var algorithm string
if p.configuration.Password.Algorithm == "argon2id" {
algorithm = HashingAlgorithmArgon2id
- } else if p.configuration.Password.Algorithm == "sha512" {
+ } else if p.configuration.Password.Algorithm == sha512 {
algorithm = HashingAlgorithmSHA512
} else {
return errors.New("Invalid algorithm in configuration. It should be `argon2id` or `sha512`")