sassoftware / pyviyatools

Python command-line tools that call the SAS Viya REST APIs - for SAS administrators.
Apache License 2.0
38 stars 31 forks source link

createdomain.py cannot add a token authentication domain #124

Closed janklaverstijn closed 1 year ago

janklaverstijn commented 1 year ago

We have the need to add authentication domains of type token. Currently only password and connection are supported types. Can this be implemented?

Our local version was updated such that it allows for type=oauth2.0 with the desired result. It's a very simple mod. Just allowing the new type, the REST API will take it from there.

This is the diff that made it work for us in case you'd be interested/willing to incorporate this change in the master:

46c46 < parser.add_argument("-t","--type", help="Type of the domain: password or connection (passwordless).",required=True, choices=['password','connection'])

parser.add_argument("-t","--type", help="Type of the domain: password, oauth2.0 (token) or connection (passwordless).",required=True, choices=['password','connection','oauth2.0'])

gerrynelson63 commented 1 year ago

@janklaverstijn That seems fairly simple. We can certainly do that. I will try to get to it soon.

bruno-mueller-sas commented 1 year ago

Jan, for the sas-viya command there is the credentials plugin that allows to create domains.

Do not know whether it will support what you need, but it is worth a try sas-viya credentials domains create -h

gerrynelson63 commented 1 year ago

Bruno is correct, the new credentials plugin was added relatively recently perhaps (finally!) making this tool less necessary. It looks like it supports "password" and "oauth2.0". Nevertheless, I will still update the tool with your request. That way you can choose the one that best suits your needs.

gerrynelson63 commented 1 year ago

I have made the change. Thanks.

janklaverstijn commented 1 year ago

Thanks for so quickly following up on this! With regards to the CLI approach: we are still on 3.5 so we're missing out on some of the good stuff.