"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
webdav: add bearer token (Macaroon) support for dCache - fixes #2360
Nick Craig-Woodfa051ff97083
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.goindex d5e1250c3..142345ff3 100644--- a/backend/webdav/webdav.go+++ b/backend/webdav/webdav.go@@ -87,6 +87,10 @@ func init() {Help: "Password.",Optional: true,IsPassword: true,+ }, {+ Name: "bearer_token",+ Help: "Bearer token instead of user/pass (eg a Macaroon)",+ Optional: true,}},})}@@ -270,6 +274,7 @@ func NewFs(name, root string) (fs.Fs, error) {user := config.FileGet(name, "user")pass := config.FileGet(name, "pass")+ bearerToken := config.FileGet(name, "bearer_token")if pass != "" {var err errorpass, err = obscure.Reveal(pass)@@ -290,7 +295,7 @@ func NewFs(name, root string) (fs.Fs, error) {root: root,endpoint: u,endpointURL: u.String(),- srv: rest.NewClient(fshttp.NewClient(fs.Config)).SetRoot(u.String()).SetUserPass(user, pass),+ srv: rest.NewClient(fshttp.NewClient(fs.Config)).SetRoot(u.String()),pacer: pacer.New().SetMinSleep(minSleep).SetMaxSleep(maxSleep).SetDecayConstant(decayConstant),user: user,pass: pass,@@ -299,6 +304,11 @@ func NewFs(name, root string) (fs.Fs, error) {f.features = (&fs.Features{CanHaveEmptyDirectories: true,}).Fill(f)+ if user != "" || pass != "" {+ f.srv.SetUserPass(user, pass)+ } else if bearerToken != "" {+ f.srv.SetHeader("Authorization", "BEARER "+bearerToken)+ }f.srv.SetErrorHandler(errorHandler)err = f.setQuirks(vendor)if err != nil {diff --git a/docs/content/webdav.md b/docs/content/webdav.mdindex 7a314d1ae..090a119f7 100644--- a/docs/content/webdav.md+++ b/docs/content/webdav.md@@ -30,53 +30,17 @@ n/s/q> nname> remoteType of storage to configure.Choose a number from below, or type in your own value- 1 / Amazon Drive- \ "amazon cloud drive"- 2 / Amazon S3 (also Dreamhost, Ceph, Minio)- \ "s3"- 3 / Backblaze B2- \ "b2"- 4 / Box- \ "box"- 5 / Dropbox- \ "dropbox"- 6 / Encrypt/Decrypt a remote- \ "crypt"- 7 / FTP Connection- \ "ftp"- 8 / Google Cloud Storage (this is not Google Drive)- \ "google cloud storage"- 9 / Google Drive- \ "drive"-10 / Hubic- \ "hubic"-11 / Local Disk- \ "local"-12 / Microsoft Azure Blob Storage- \ "azureblob"-13 / Microsoft OneDrive- \ "onedrive"-14 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)- \ "swift"-15 / Pcloud- \ "pcloud"-16 / QingCloud Object Storage- \ "qingstor"-17 / SSH/SFTP Connection- \ "sftp"-18 / WebDAV+[snip]+22 / Webdav\ "webdav"-19 / Yandex Disk- \ "yandex"-20 / http Connection- \ "http"+[snip]Storage> webdavURL of http host to connect toChoose a number from below, or type in your own value1 / Connect to example.com\ "https://example.com"url> https://example.com/remote.php/webdav/-Name of the WebDAV site/service/software you are using+Name of the Webdav site/service/software you are usingChoose a number from below, or type in your own value1 / Nextcloud\ "nextcloud"@@ -98,13 +62,17 @@ Enter the password:password:Confirm the password:password:+Bearer token instead of user/pass (eg a Macaroon)+bearer_token>Remote config--------------------[remote]+type = webdavurl = https://example.com/remote.php/webdav/vendor = nextclouduser = userpass = *** ENCRYPTED ***+bearer_token =--------------------y) Yes this is OKe) Edit this remote@@ -133,6 +101,10 @@ Owncloud or Nextcloud rclone will support modified times.Hashes are not supported.+## Provider notes ##++See below for notes on specific providers.+### Owncloud ###Click on the settings cog in the bottom right of the page and this@@ -149,7 +121,7 @@ Owncloud does. This [may befixed](https://github.com/nextcloud/nextcloud-snap/issues/365) in thefuture.-## Put.io ##+### Put.io ###put.io can be accessed in a read only way using webdav.@@ -174,9 +146,9 @@ mount.For more help see [the put.io webdav docs](http://help.put.io/apps-and-integrations/ftp-and-webdav).-## Sharepoint ##+### Sharepoint ###-Can be used with Sharepoint provided by OneDrive for Business+Rclone can be used with Sharepoint provided by OneDrive for Businessor Office365 Education Accounts.This feature is only needed for a few of these Accounts,mostly Office365 Education ones. These accounts are sometimes not@@ -213,4 +185,21 @@ url = https://[YOUR-DOMAIN]-my.sharepoint.com/personal/[YOUR-EMAIL]/Documentsvendor = otheruser = YourEmailAddresspass = encryptedpassword-```\ No newline at end of file+```++### dCache ###++Configure as normal using the `other` type. Don't enter a username or+password, instead enter your Macaroon as the `bearer_token`.++The config will end up looking something like this.++```+[dcache]+type = webdav+url = https://dcache...+vendor = other+user =+pass =+bearer_token = your-macaroon+```