crim-ca / weaver

Weaver: Workflow Execution Management Service (EMS); Application, Deployment and Execution Service (ADES); OGC API - Processes; WPS; CWL Application Package
https://pavics-weaver.readthedocs.io
Apache License 2.0
24 stars 6 forks source link

pass session object to client #597

Closed mishaschwartz closed 7 months ago

mishaschwartz commented 7 months ago

Add option to make requests with WeaverClient using a requests.Session instance.

This allows requests to be made with the session cookies that may already be attached to this requests.Session instance.

Useful as an alternative to authenticating with an auth argument when a user has already authenticated and they have access to the session cookie. This is mostly so that we can take advantage of this feature with weaver https://github.com/bird-house/birdhouse-deploy/pull/407

fmigneault commented 7 months ago

@mishaschwartz Why not use the MagpieAuth object directly? https://pavics-weaver.readthedocs.io/en/latest/cli.html#authentication-example

Alternatively, could also use https://pavics-weaver.readthedocs.io/en/latest/autoapi/weaver/cli/index.html#weaver.cli.CookieAuthHandler

mishaschwartz commented 7 months ago

Why not use the MagpieAuth object directly? Alternatively, could also use ... [CookieAuthHandler]

Both of these make a request to a URL to obtain a token/cookie. The session strategy is for the use-case where you already have the session cookies. It's the same use-case that motivated this change (https://github.com/bird-house/birdhouse-deploy/pull/407)