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

Authorization for Queue and Token Endpoints #22

Merged
merged 33 commits into from
Apr 2, 2022
Merged

Conversation

aneeshsharma
Copy link
Contributor

Implemented authorization for queue -

  • Any authenticated user can create a queue (anonymous or bearer)
  • The queue's owner is set to the authenticated user's uid
  • Only the queue's owner can perform any operations on the queue including ReadQueue
  • This is ensured by a middleware which is applied to all /queue/{id} endpoints

Implemented authorization for token -

  • Any user can create a token
  • Any user can read a token
  • Only the owner of the queue that the token belongs to can delete a token

As discussed with @daltonfury42 we might need a shallow ReadQueue later which any user can read basic information about the queue from.

aneeshsharma and others added 30 commits February 12, 2022 16:06
* Made gh action trigger on PRs also to get around stuck status checks (#19)

* Made gh action trigger on PRs also to get around stuck status checks

* Modified to trigger only on PRs

* Renamed check

* Add Token to Queue (#18)

* implemented add token for queue store

* implemented create token route

* Fix code style issues with gofmt

* read tokens in the queue in readqueue

* Fix code style issues with gofmt

* implemented token number

* Fix code style issues with gofmt

* added read token route

* Fix code style issues with gofmt

* separated name length constants

* log insert error for add token

* Fix code style issues with gofmt

* refactoring mongo store

* Fix code style issues with gofmt

Co-authored-by: Lint Action <[email protected]>

Co-authored-by: Nithin <[email protected]>
Co-authored-by: Lint Action <[email protected]>
daltonfury42
daltonfury42 previously approved these changes Mar 28, 2022
@@ -123,9 +122,26 @@ func DeleteQueue(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}

func QueueCtx(next http.Handler) http.Handler {
func QueueMiddlware(next http.Handler) http.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was trying to think of a good name for this middleware. QueueOwnerAuthMiddleware?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok
Then I'll also rename TokenMiddleware to TokenOwnerAuthMiddleware

@aneeshsharma aneeshsharma merged commit eeb8401 into main Apr 2, 2022
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.

3 participants