neilberkman / docusign_elixir

Unofficial DocuSign Elixir Library used to interact with the eSign REST API
MIT License
14 stars 20 forks source link

Feature request: ability to have multiple users impersonated #28

Closed frahugo closed 3 years ago

frahugo commented 3 years ago

Currently, the library is designed to authenticate with DocuSign using one USER_ID. The JWT token that gets generated is tied to that user ID. Our application needs to create enveloppes under different DocuSign users, for security reasons.

The JWT OAuth token is persisted in a GenServer (DocuSign.APIClient). When establishing a new connection, we can provide the API client to use. It would then be just a matter of starting up a client for a given user and use it. We could also add a client registry to manage the lifecycle of those GenServers. Of course, we would need to modify DocuSign.OAuth to accept a user_id as a parameter (or option) instead of fetching if from the configuration.

Any suggestions/ideas/comments?

neilberkman commented 3 years ago

Hey @frahugo I don't have the bandwidth to do much beyond reviewing a PR but if you want to contribute this, that would be great. I'd be fine with breaking backwards compatibility a bit. We can bump the major version number.

frahugo commented 3 years ago

Ok cool. I will work on that. I will try to stay backward compatible and simply add functionality.

frahugo commented 3 years ago

@neilberkman Can you have a quick review of the commits so far in my branch: https://github.com/frahugo/docusign_elixir/commits/multiple-user-ids

I want to decouple the OAuth adapter as much as possible from the configuration when creating a client. To be backward compatible, if no user_id is provided, it would use a "default" user id from the configuration. Anyhow, let me know if you are OK with such big changes.

neilberkman commented 3 years ago

@frahugo definitely, looks great so far! 👍

neilberkman commented 3 years ago

Closed by #30