-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use share id to identify ocm shares #4630
Conversation
6c5dc17
to
ba6f061
Compare
Now, while our webdav client will send the shared secret when making requests as the ocm share receiver: func (d *driver) webdavClient(ctx context.Context, forUser *userpb.UserId, ref *provider.Reference) (*gowebdav.Client, *ocmpb.ReceivedShare, string, error) {
id, rel := shareInfoFromReference(ref)
share, endpoint, secret, err := d.getWebDAVFromShare(ctx, forUser, id)
if err != nil {
return nil, nil, "", err
}
endpoint, err = url.PathUnescape(endpoint)
if err != nil {
return nil, nil, "", err
}
// FIXME: it's still not clear from the OCM APIs how to use the shared secret
// will use as a token in the bearer authentication as this is the reva implementation
c := gowebdav.NewAuthClient(endpoint, gowebdav.NewPreemptiveAuth(BearerAuthenticator{token: secret}))
if d.c.Insecure {
c.SetTransport(&http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
})
}
return c, share, rel, nil
} reva, when acting as the ocm share provider still needs to actually read the bearer auth ... |
I think some of the confusion comes from comments like cs3org/OCM-API#57 (comment) which do not have a path property in the url that can identify the ocm share. In fact the sharedSecret / token is required to determine what content is to be served under Well, with spaces at least we can finally provide actual URIs ... Anyway, our Actually, GetOCMShare requires a user to be in the context, so we need to use the shared secret as the token to look up the share. |
f3cb227
to
2f85146
Compare
@aduffeck I think this clarifies some of the confusion around authenticating OCM webdav requests. Do you remember how you set this up to test this ... The unit tests don't fully cover this. Needs to be added ... |
@aduffeck shouldn't this condition be inverted: func (s *service) GetOCMShare(ctx context.Context, req *ocm.GetOCMShareRequest) (*ocm.GetOCMShareResponse, error) {
// if the request is by token, the user does not need to be in the ctx
var user *userpb.User
if req.Ref.GetToken() == "" {
user = ctxpkg.ContextMustGetUser(ctx)
} |
I don't think so. If no token is set ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
To fix the ci I had to set up a debuggable environment ... and then I ran into owncloud/ocis#8564: sharingNG does not support OCM, yet. Some ocis graph progress is in owncloud/ocis#8909, but it needs more work. I'll commit the changes I made while dabbling with the setup to continue on it next week... |
70fd84d
to
6100edb
Compare
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
6100edb
to
516ea23
Compare
516ea23
to
14cc2c8
Compare
We now use the share id to correctly identify ocm shares.