mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
jwt: Trim username and password strings
This commit is contained in:
parent
52f00042b4
commit
8af8889a36
3
jwt.go
3
jwt.go
@ -18,6 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
jwtgo "github.com/dgrijalva/jwt-go"
|
||||
@ -65,6 +66,8 @@ func (jwt *JWT) GenerateToken(userName string) (string, *probe.Error) {
|
||||
|
||||
// Authenticate - authenticates incoming username and password.
|
||||
func (jwt *JWT) Authenticate(userName, password string) bool {
|
||||
userName = strings.TrimSpace(userName)
|
||||
password = strings.TrimSpace(password)
|
||||
if !bytes.Equal([]byte(userName), jwt.accessKeyID) {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user