Do not attempt to generate URLToken for anonymous downloads (#5078)

This is a regression since last release - fixes #5076
This commit is contained in:
Harshavardhana 2017-10-17 22:44:27 -07:00 committed by Nitish Tiwari
parent 75865efb0e
commit f25bec6bf1
3 changed files with 58 additions and 45 deletions

View File

@ -149,6 +149,10 @@ export default class Browse extends React.Component {
if (prefix.endsWith('/') || prefix === '') {
if (prefix === currentPath) return
browserHistory.push(utils.pathJoin(currentBucket, encPrefix))
} else {
if (!web.LoggedIn()) {
let url = `${window.location.origin}/minio/download/${currentBucket}/${encPrefix}?token=''`
window.location = url
} else {
// Download the selected file.
web.CreateURLToken()
@ -162,6 +166,7 @@ export default class Browse extends React.Component {
})))
}
}
}
makeBucket(e) {
e.preventDefault()
@ -421,7 +426,11 @@ export default class Browse extends React.Component {
objects: this.props.checkedObjects,
prefix: this.props.currentPath
}
if (!web.LoggedIn()) {
let requestUrl = location.origin + "/minio/zip?token=''"
this.xhr = new XMLHttpRequest()
dispatch(actions.downloadSelected(requestUrl, req, this.xhr))
} else {
web.CreateURLToken()
.then(res => {
let requestUrl = location.origin + "/minio/zip?token=" + res.token
@ -434,6 +443,7 @@ export default class Browse extends React.Component {
message: err.message
})))
}
}
clearSelected() {
const {dispatch} = this.props

File diff suppressed because one or more lines are too long

View File

@ -93,6 +93,9 @@ func keyFuncCallback(jwtToken *jwtgo.Token) (interface{}, error) {
}
func isAuthTokenValid(tokenString string) bool {
if tokenString == "" {
return false
}
var claims jwtgo.StandardClaims
jwtToken, err := jwtgo.ParseWithClaims(tokenString, &claims, keyFuncCallback)
if err != nil {