diff options
| author | Amir Zarrinkafsh <nightah@me.com> | 2020-05-06 10:52:06 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-06 10:52:06 +1000 |
| commit | cc06ab6c18acbf8d2d1b33d8af15d77b7b31f216 (patch) | |
| tree | b5fe01668346258dd6dab620931108bb0b973913 /internal/authentication/file_user_provider.go | |
| parent | 50f12bc4a488195277f6c51131a6e50969c05edc (diff) | |
[CI] Add gocritic linter (#977)
* [CI] Add gocritic linter
* Implement gocritic recommendations
The outstanding recommendations are due to be addressed in #959 and #971 respectively.
* Fix implementation tests
* Fix remaining linting issues.
* Fix tests.
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.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/authentication/file_user_provider.go b/internal/authentication/file_user_provider.go index bbfa9da90..90b2083d6 100644 --- a/internal/authentication/file_user_provider.go +++ b/internal/authentication/file_user_provider.go @@ -149,11 +149,13 @@ func (p *FileUserProvider) UpdatePassword(username string, newPassword string) e } var algorithm CryptAlgo - if p.configuration.Password.Algorithm == "argon2id" { + + switch p.configuration.Password.Algorithm { + case argon2id: algorithm = HashingAlgorithmArgon2id - } else if p.configuration.Password.Algorithm == sha512 { + case sha512: algorithm = HashingAlgorithmSHA512 - } else { + default: return errors.New("Invalid algorithm in configuration. It should be `argon2id` or `sha512`") } |
