-
Notifications
You must be signed in to change notification settings - Fork 1
Use the ocis-proxy URL to make sure auth works correctly #41
Conversation
Since a recent change in ocis-accounts that makes a distinction between user id and user name, the thumbnails cannot properly authenticate against the Reva API endpoint (port 9140) using the provided Bearer token. Since the ocis-proxy is handling authentication correctly, the default setting has been changed here to connect to ocis-proxy.
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
Fixes https://github.com/owncloud/ocis-thumbnails/issues/40 To test, check out owncloud/ocis#409 and the matching go.mod replaces. Before this fix, the issue from https://github.com/owncloud/ocis-thumbnails/issues/40 happens. |
pkg/thumbnail/imgsource/webdav.go
Outdated
req, err := http.NewRequest(http.MethodGet, u.String(), nil) | ||
if err != nil { | ||
return nil, fmt.Errorf("could not get the image \"%s\" error: %s", file, err.Error()) | ||
} | ||
|
||
// FIXME: make this configurable!! | ||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} |
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.
you could add your certificate to your the list of trusted certs
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.
Ideally we should address this before merging
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.
do we have this pattern somewhere, like config switches ? or rely on running debug mode vs non-debug ?
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.
found it, ocis-proxy has some config pattern. I'll use the same.
pkg/thumbnail/imgsource/webdav.go
Outdated
@@ -27,12 +28,17 @@ type WebDav struct { | |||
func (s WebDav) Get(ctx context.Context, file string) (image.Image, error) { | |||
u, _ := url.Parse(s.baseURL) | |||
u.Path = path.Join(u.Path, file) | |||
fmt.Printf("url: %s", u.String()) |
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.
I'd use a logger, not print
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.
perhaps adding a logger to the type: https://github.com/owncloud/ocis-thumbnails/blob/use-ocis-proxy/pkg/thumbnail/imgsource/webdav.go#L23-L25
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.
I'll remove this, it was purely for debugging
@refs PR adjusted. Note that I have made insecure to be true by default to follow the same pattern like in ocis-proxy... |
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
Since a recent change in ocis-accounts that makes a distinction between
user id and user name, the thumbnails cannot properly authenticate
against the Reva API endpoint (port 9140) using the provided Bearer
token.
Since the ocis-proxy is handling authentication correctly, the default
setting has been changed here to connect to ocis-proxy.