A way to communicate from auth to driver #106
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm writing a bridge between ftp and another multi user service and I'm looking for a way to share credentials with the driver, or better still an authenticated object with the driver
I can see multiple ways of doing this
Passing an Conn to Auth and exposing driver as Driver() on the Conn object
This would permit conn.Driver().(concretetype).dothings() from the auth method
Similar, passing Conn to Auth and exposing a Set(interface{}, interface{}) and Get(interface{})
This would permit conn.Set("upstream", &something.NewClient{Username: user, Password: pass}) which one can later conn.Get
Either of the above options and we can rely on the notifier to do it instead of breaking auth interface
I can sort of do what I want but that would mean relying on a huge map[*conn]*upstreamObject which is would pose some locking contention with enough clients.
by giving access to the underlying Driver object we can set data directly on that individual driver so skipping locks
by giving access to the a Set/Get store then we can contain our locks on the conn
option 3 lets you do it without breaking the api at the cost of probably logging into some service twice
For more flexibility, some break change could be accepted. Please send some PRs, we can discuss more there.
I think #119 fixed this one.