mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
de2c5836fd
* [Buildkite] Introduce CI linting with golangci-lint and reviewdog * Initial pass of golangci-lint * Add gosimple (megacheck) recommendations * Add golint recommendations * [BUGFIX] Migrate authentication traces from v3 mongodb * Add deadcode recommendations * [BUGFIX] Fix ShortTimeouts suite when run in dev workflow * Add unused recommendations * Add unparam recommendations * Disable linting on unfixable errors instead of skipping files * Adjust nolint notation for unparam * Fix ineffectual assignment to err raised by linter. * Export environment variable in agent hook * Add ineffassign recommendations * Add staticcheck recommendations * Add gocyclo recommendations * Adjust ineffassign recommendations Co-authored-by: Clement Michaud <clement.michaud34@gmail.com>
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package authentication
|
|
|
|
// Level is the type representing a level of authentication
|
|
type Level int
|
|
|
|
const (
|
|
// NotAuthenticated if the user is not authenticated yet
|
|
NotAuthenticated Level = iota
|
|
// OneFactor if the user has passed first factor only
|
|
OneFactor Level = iota
|
|
// TwoFactor if the user has passed two factors
|
|
TwoFactor Level = iota
|
|
)
|
|
|
|
const (
|
|
// TOTP Method using Time-Based One-Time Password applications like Google Authenticator
|
|
TOTP = "totp"
|
|
// U2F Method using U2F devices like Yubikeys
|
|
U2F = "u2f"
|
|
// Push Method using Duo application to receive push notifications
|
|
Push = "mobile_push"
|
|
)
|
|
|
|
// PossibleMethods is the set of all possible 2FA methods
|
|
var PossibleMethods = []string{TOTP, U2F, Push}
|
|
|
|
const (
|
|
//Argon2id Hash Identifier
|
|
HashingAlgorithmArgon2id = "argon2id"
|
|
//SHA512 Hash Identifier
|
|
HashingAlgorithmSHA512 = "6"
|
|
)
|
|
|
|
// These are the default values from the upstream crypt module, we use them to for GetInt, and they need to be checked when updating github.com/simia-tech/crypt
|
|
const (
|
|
HashingDefaultArgon2idTime = 1
|
|
HashingDefaultArgon2idMemory = 32 * 1024
|
|
HashingDefaultArgon2idParallelism = 4
|
|
HashingDefaultArgon2idKeyLength = 32
|
|
HashingDefaultSHA512Iterations = 5000
|
|
)
|
|
|
|
// HashingPossibleSaltCharacters represents valid hashing runes
|
|
var HashingPossibleSaltCharacters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/")
|