Sage-Bionetworks / schematic

Package for biomedical data model and metadata ingress management
https://schematicpy.readthedocs.io/en/stable/cli_reference.html
MIT License
22 stars 25 forks source link

Test and enhance schematic REST API submission end point #590

Closed milen-sage closed 2 years ago

milen-sage commented 2 years ago

Currently the REST API service uses the credentials provided using schematic's installation. However, different service users may have different credentials. Add a parameters to the submission endpoint that allows authentication information to be passed to it.

milen-sage commented 2 years ago

@linglp you can chat with @afwillia on that. He may have some useful examples for how to pass authentication information.

afwillia commented 2 years ago

@linglp here is a simple example of passing authentication info in a synapse REST API request to get user profile info.

For information on authenticating synapse REST API queries
https://docs.synapse.org/rest/#org.sagebionetworks.auth.controller.AuthenticationController
Authentication to Synapse services requires an access token passed in the
HTTP Authorization header, as per the HTTP bearer authorization standard.
https://datatracker.ietf.org/doc/html/rfc6750#section-2.1

https://docs.synapse.org/rest/#org.sagebionetworks.repo.web.controller.UserProfileController
PAT is the synapse personal access token OR the browser cookie from a logged-in session.

uri <- "https://repo-prod.prod.sagebase.org/repo/v1/userProfile" 
req <- GET(uri, add_headers(Authorization=paste0("Bearer ", pat)))  
content(req)
afwillia commented 2 years ago

@linglp Functions that data curator uses from schematic/store/synapse.py

Additional functions that don't have an API endpoint

ychae commented 2 years ago

Acceptance Criteria: submission of manifest work through the REST API service Passing authentication: input field - get the token string and pass that through

afwillia commented 2 years ago

@linglp @milen-sage The data curator dashboard dashboardFuns.R also uses some schematic and synapseclient functionality.

schematic

synapseclient (unrelated to this ticket, just as a note) synStoreObj$storageFileviewTable syn$get(manifest_id) syn$getUserProfile(manifest["properties"]["modifiedBy"])["userName"]

These are other synapseclient functions the app uses syn_login = syn.login syn_tableQuery = syn.tableQuery syn_is_certified = syn.is_certified

milen-sage commented 2 years ago

@afwillia it sounded like you transitioned most of the needed Synapse client functions below to Syanpse REST API calls?

syn_login = syn.login syn_tableQuery = syn.tableQuery # this may not be needed syn_is_certified = syn.is_certified syn$get(manifest_id) syn$getUserProfile(manifest["properties"]["modifiedBy"])["userName"]

If not, we can track here.

afwillia commented 2 years ago

I did not add tableQuery or get because the app isn't actually using them.

On Tue, Mar 15, 2022 at 7:58 AM milen-sage @.***> wrote:

@afwillia https://github.com/afwillia it sounded like you transitioned most of the needed Synapse client functions below to Syanpse REST API calls?

syn_login = syn.login syn_tableQuery = syn.tableQuery # this may not be needed syn_is_certified = syn.is_certified syn$get(manifest_id) syn$getUserProfile(manifest["properties"]["modifiedBy"])["userName"]

If not, we can track here https://github.com/Sage-Bionetworks/data_curator/issues/298.

— Reply to this email directly, view it on GitHub https://github.com/Sage-Bionetworks/schematic/issues/590#issuecomment-1068085589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6Q2D6CYFDSEYKB2CPRXIDVACQSPANCNFSM5PUTERRA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>