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

DIG-1189: Authz user can view datasets #61

Merged
merged 4 commits into from
May 22, 2024
Merged

Conversation

daisieh
Copy link
Member

@daisieh daisieh commented May 22, 2024

If the user token is the same in both the Bearer token and in the body of the request, and that token is valid, you should be able to get the user's authorized datasets.

## opa datasets
curl -X "POST" "http://candig.docker.internal:5080/policy/v1/data/permissions/datasets" \
     -H 'Authorization: Bearer <user token>' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -d $'{
  "input": {
    "token": "<same user token>",
    "body": {
      "path": "/v2/authorized/sample_registrations/",
      "method": "GET"
    }
  }
}'

should give you the user's authorized datasets. If you try to use different tokens, e.g. Bearer token is for user2, and the requested input token is for site_admin, it should fail.

@daisieh daisieh requested a review from OrdiNeu May 22, 2024 04:45
Copy link
Contributor

@OrdiNeu OrdiNeu left a comment

Choose a reason for hiding this comment

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

Works as expected 👍
Note that if a dataset somehow doesn't exist in OPA, Katsu will disallow the request even if you are site admin (is Katsu comparing to a list of allowed datasets?)

@daisieh
Copy link
Member Author

daisieh commented May 22, 2024

Yes, because the list of allowed programs that Katsu is getting is based on the programs that Opa knows about. I think that this is probably a good behavior because it will enforce the need to add program authorizations before ingesting any data.

@daisieh daisieh merged commit a79b3fb into develop May 22, 2024
2 checks passed
@daisieh daisieh deleted the daisieh/idp-token branch May 22, 2024 17:16
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.

2 participants