|
|
@ -42,7 +42,7 @@ import ( |
|
|
|
// isJWTReqAuthenticated validates if any incoming request to be a
|
|
|
|
// isJWTReqAuthenticated validates if any incoming request to be a
|
|
|
|
// valid JWT authenticated request.
|
|
|
|
// valid JWT authenticated request.
|
|
|
|
func isJWTReqAuthenticated(req *http.Request) bool { |
|
|
|
func isJWTReqAuthenticated(req *http.Request) bool { |
|
|
|
jwt, err := newJWT(defaultWebTokenExpiry) |
|
|
|
jwt, err := newJWT(defaultJWTExpiry) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
errorIf(err, "unable to initialize a new JWT") |
|
|
|
errorIf(err, "unable to initialize a new JWT") |
|
|
|
return false |
|
|
|
return false |
|
|
@ -290,14 +290,9 @@ type LoginRep struct { |
|
|
|
UIVersion string `json:"uiVersion"` |
|
|
|
UIVersion string `json:"uiVersion"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Default JWT for minio browser expires in 24hrs.
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
|
|
|
defaultWebTokenExpiry time.Duration = time.Hour * 24 // 24Hrs.
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Login - user login handler.
|
|
|
|
// Login - user login handler.
|
|
|
|
func (web *webAPIHandlers) Login(r *http.Request, args *LoginArgs, reply *LoginRep) error { |
|
|
|
func (web *webAPIHandlers) Login(r *http.Request, args *LoginArgs, reply *LoginRep) error { |
|
|
|
jwt, err := newJWT(defaultWebTokenExpiry) |
|
|
|
jwt, err := newJWT(defaultJWTExpiry) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
} |
|
|
|
} |
|
|
@ -362,7 +357,7 @@ func (web *webAPIHandlers) SetAuth(r *http.Request, args *SetAuthArgs, reply *Se |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
jwt, err := newJWT(defaultWebTokenExpiry) // JWT Expiry set to 24Hrs.
|
|
|
|
jwt, err := newJWT(defaultJWTExpiry) // JWT Expiry set to 24Hrs.
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
} |
|
|
|
} |
|
|
@ -447,7 +442,7 @@ func (web *webAPIHandlers) Download(w http.ResponseWriter, r *http.Request) { |
|
|
|
object := vars["object"] |
|
|
|
object := vars["object"] |
|
|
|
tokenStr := r.URL.Query().Get("token") |
|
|
|
tokenStr := r.URL.Query().Get("token") |
|
|
|
|
|
|
|
|
|
|
|
jwt, err := newJWT(defaultWebTokenExpiry) // Expiry set to 24Hrs.
|
|
|
|
jwt, err := newJWT(defaultJWTExpiry) // Expiry set to 24Hrs.
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
errorIf(err, "error in getting new JWT") |
|
|
|
errorIf(err, "error in getting new JWT") |
|
|
|
return |
|
|
|
return |
|
|
|