A way to communicate from auth to driver #106

Closed
opened 2020-03-31 09:47:12 +00:00 by freman · 2 comments

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

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
lunny added the
question
label 2020-03-31 10:29:17 +00:00
Owner

For more flexibility, some break change could be accepted. Please send some PRs, we can discuss more there.

For more flexibility, some break change could be accepted. Please send some PRs, we can discuss more there.
Owner

I think #119 fixed this one.

I think https://gitea.com/goftp/server/pulls/119 fixed this one.
lunny closed this issue 2020-10-30 11:00:56 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: goftp/server#106
No description provided.