mirror of
https://github.com/minio/minio.git
synced 2026-12-01 23:41:49 +00:00
prep: Initialization should wait instead of exit the servers. (#2872)
- Servers do not exit for invalid credentials instead they print and wait. - Servers do not exit for version mismatch instead they print and wait. - Servers do not exit for time differences between nodes they print and wait.
This commit is contained in:
1 parent
e53a9f6cab
commit
f1bc9343a1
16 files changed
+161
-32
No files matched your search
@@ -78,6 +78,10 @@ func (jwt *JWT) GenerateToken(accessKey string) (string, error) {
|
||||
return token.SignedString([]byte(jwt.SecretAccessKey))
|
||||
}
|
||||
|
||||
var errInvalidAccessKeyID = errors.New("The access key ID you provided does not exist in our records.")
|
||||
|
||||
var errAuthentication = errors.New("Authentication failed, check your access credentials.")
|
||||
|
||||
// Authenticate - authenticates incoming access key and secret key.
|
||||
func (jwt *JWT) Authenticate(accessKey, secretKey string) error {
|
||||
// Trim spaces.
|
||||
@@ -91,13 +95,12 @@ func (jwt *JWT) Authenticate(accessKey, secretKey string) error {
|
||||
}
|
||||
|
||||
if accessKey != jwt.AccessKeyID {
|
||||
return errors.New("Access key does not match")
|
||||
return errInvalidAccessKeyID
|
||||
}
|
||||
|
||||
hashedSecretKey, _ := bcrypt.GenerateFromPassword([]byte(jwt.SecretAccessKey), bcrypt.DefaultCost)
|
||||
|
||||
if bcrypt.CompareHashAndPassword(hashedSecretKey, []byte(secretKey)) != nil {
|
||||
return errors.New("Authentication failed")
|
||||
return errAuthentication
|
||||
}
|
||||
|
||||
// Success.
|
||||
|
||||
Reference in new issue
Block a user