1

I am building CLI based application in golang for automation purpose for which I will be using cobra. Here user needs to login by supplying id, password and server name then golang will return client object and then that returned object will be used to call its corresponding methods. eg:-

during startup user types:-

app login --username="name" password="pwd" --server="https//someName.com"

now this login I want to retain and for subsequent commands I want to use the current session to run other commands of user

eg:- (here I dont want to authenticate user again)

app create user --username="user2"

If system is restarted then I want user to authenticate first then fire their commands

I want to follow similar behavior as followed in azure-cli

Varun
  • 23
  • 7
  • One way to do it is to start another instance of the program when user authenticates, and communicate with it via rpc through a domain socket. That program will terminate when the user logs out or system restarts. – Burak Serdar Feb 06 '23 at 18:20

0 Answers0