-
Notifications
You must be signed in to change notification settings - Fork 475
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
Authentication support #95
Comments
We recently published the hook system which allows you to run custom authentication checks if you are using the tusd binary. Please have a look at it and tell us whether that supports your use case: #88 |
I'm using a custom implementation. I will use OAuth to authenticate but I'm going to change the default mux for this. This issue is just an idea of what could be done if possible. |
IMO, adding an additional layer which is flexible enough to fully support different authentication and authorization is not an easy undertaking and I am currently a bit too busy to take such a feature on. Therefore, my recommended approach is the same as you took by hooking into the corresponding mux. However, thank you for bringing this discussion up :) |
Here is a small example of what I've done. mux.Handle("/files/", func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, ok := ValidateUserToken(r)
if ok {
next.ServeHTTP(w, r)
} else {
w.WriteHeader(http.StatusUnauthorized)
}
})
}(http.StripPrefix("/files/", tusHandler))) This is a good example for anyone looking something similar. |
Closing this issue, as I believe the question has been answered. |
It would be nice to have a mechanism of authentication. For example, using OAuth to grant access for uploading.
There's no code for this on tusd, but it can be done wrapping the handler.
My question here is to build something like
UseCore
, orUseLocker
in the composer. It could have a new method calledUseAuthotization
for example.The text was updated successfully, but these errors were encountered: