You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By server authorization callbacks, I mean the various callbacks listed here on godoc that return the Permissions structure.
I'm writing a SSH server that will check against a database to authorize the user's public key and then it will allow the user various abilities based on their permissions as listed in the database. The permissions are returned with the user. They are a integer type.
The problem is that I cannot pass those permissions from the public key callback straight to my implementation code. Instead, right now, I'm encoding the permissions as a string, putting them into the Extensions field of the Permissions structure and then decoding them in my implementation code. This is janky and will not scale well if I have to add more data that needs to be passed to my implementation code. I could query for the user in the database again in my implementation code, but that would be 2 queries for the exact same thing which is inefficient. Furthermore, I could use a shared map (that has its own set of issues) but I think there is a better solution.
I propose we add a new field to the Permissions structure that will carry arbitrary data. Presently, there exists the Extensions field but that is only a map from a string to a string, but I think we should add a new field that is a interface{} and will carry implementation specific data. I'm unsure of the name but that could be figured out later.
The text was updated successfully, but these errors were encountered:
By
server authorization callbacks
, I mean the various callbacks listed here on godoc that return thePermissions
structure.I'm writing a SSH server that will check against a database to authorize the user's public key and then it will allow the user various abilities based on their permissions as listed in the database. The permissions are returned with the user. They are a integer type.
The problem is that I cannot pass those permissions from the public key callback straight to my implementation code. Instead, right now, I'm encoding the permissions as a string, putting them into the
Extensions
field of thePermissions
structure and then decoding them in my implementation code. This is janky and will not scale well if I have to add more data that needs to be passed to my implementation code. I could query for the user in the database again in my implementation code, but that would be 2 queries for the exact same thing which is inefficient. Furthermore, I could use a shared map (that has its own set of issues) but I think there is a better solution.I propose we add a new field to the
Permissions
structure that will carry arbitrary data. Presently, there exists theExtensions
field but that is only a map from a string to a string, but I think we should add a new field that is ainterface{}
and will carry implementation specific data. I'm unsure of the name but that could be figured out later.The text was updated successfully, but these errors were encountered: