Skip to content
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

Disable auth check to support older clients #10

Merged
merged 3 commits into from
Jul 5, 2018

Conversation

csoni111
Copy link
Member

It disables auth check (so no 401 or 403 status codes are sent) so that older clients do not start throwing errors but if an Authorization header is supplied (by newer clients), then sends appropriate response (ex limiting shares to what that user can see).

@csoni111
Copy link
Member Author

csoni111 commented Jul 3, 2018

To re enable auth check for everyone sometime in future, we only need to remove the isAdmin method and keep only else part in authMiddleware, shareReadAccess and shareWriteAccess in auth.go file.

src/fs/auth.go Outdated
func (service *MercuryFsService) authenticate(writer http.ResponseWriter, request *http.Request) {
// decode and parse json request body
decoder := json.NewDecoder(request.Body)
data := make(map[string]interface{})
err := decoder.Decode(&data)
if err != nil {
panic(err)
Copy link
Member

@cpg cpg Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean that client data in json (malformed) may crash our service?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out. I have corrected it.

@cpg cpg merged commit 8a12c2a into amahi:non-admin-users Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants