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

This is a regression since last release - fixes #5076
master
Harshavardhana 7 years ago committed by Nitish Tiwari
parent 75865efb0e
commit f25bec6bf1
  1. 12
      browser/app/js/components/Browse.js
  2. 48
      browser/ui-assets.go
  3. 3
      cmd/jwt.go

@ -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

@ -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 {

Loading…
Cancel
Save