Skip to content

Commit

Permalink
Attempt to support both OCM 1.0 and 1.1 when accessing remote shares
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed May 23, 2024
1 parent d22f762 commit 58a3e8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/ocm/storage/received/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ func (d *driver) webdavClient(ctx context.Context, ref *provider.Reference) (*go
return nil, nil, "", err
}

// use the secret as bearer authentication according to OCM v1.1+
c := gowebdav.NewClient(endpoint, "", "")
// inject the secret as 'username' for OCM v1.0 basic auhentication
parsedURL, err := url.Parse(endpoint)
if err != nil {
return nil, nil, "", err
}
parsedURL.User = url.UserPassword(secret, "")

// and use it as well as bearer authentication according to OCM v1.1+
c := gowebdav.NewClient(parsedURL.String(), "", "")
c.SetHeader("Authorization", "Bearer "+secret)

log := appctx.GetLogger(ctx)
Expand Down

0 comments on commit 58a3e8f

Please sign in to comment.