ansible / tacacs_plus

A Python-based TACACS+ client that supports authentication, authorization and accounting.
BSD 3-Clause "New" or "Revised" License
79 stars 29 forks source link

Suggestion for adding machine_status to TACACSAuthorizationReply #45

Open en-medina opened 3 years ago

en-medina commented 3 years ago

Hi team, I am not sure if this suggestion could be written in the issue section.

I'm using your package in a python application for authenticate and authorizate users against AAA servers in order to give them access to specific network application as the defined profile for the user in the AAA servers (as a requirement of the company I must use their AAA servers). Following the idea, I finished the application and is in production now (by the way, works great the package), but for retrieving the permissions of the user from the authorize method of the TACACSClient class, I was forced to read the response as string and parse it to dictionary.

I was wondering if could be added like a machine_status method to the TACACSAuthorizationReply class (instance returned by the authorize method of the TACACSClient class), for covering the use of case described above.

Testing the case:

cli = TACACSClient('host', 49, 'secret', timeout=10, family=socket.AF_INET)
authen = cli.authenticate('username', 'password')
author = cli.authorize(username)
print(author.__str__())

string method of the TACACSAuthorizationReply: https://github.com/ansible/tacacs_plus/blob/de0d01372169c8849fa284d75097e57367c8930f/tacacs_plus/authorization.py#L172-L182

crisidev commented 1 year ago

I haven't looked at this package for a while and I would like to address the remaining issues and release a new version. Is this still something you would be interested to see implemented? I have some time right now I could use to work a little on this package.