mirror of https://github.com/minio/minio.git
Merge pull request #1063 from harshavardhana/trim-inputs
jwt: Trim username and password strings
This commit is contained in:
commit
25cd37b209
3
jwt.go
3
jwt.go
|
@ -18,6 +18,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
jwtgo "github.com/dgrijalva/jwt-go"
|
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.
|
// Authenticate - authenticates incoming username and password.
|
||||||
func (jwt *JWT) Authenticate(userName, password string) bool {
|
func (jwt *JWT) Authenticate(userName, password string) bool {
|
||||||
|
userName = strings.TrimSpace(userName)
|
||||||
|
password = strings.TrimSpace(password)
|
||||||
if !bytes.Equal([]byte(userName), jwt.accessKeyID) {
|
if !bytes.Equal([]byte(userName), jwt.accessKeyID) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue