ngetchell / PSGitLab

An interface for administering GitLab from the PowerShell command line.
MIT License
72 stars 42 forks source link

[Feature request] Store connection data using credential manager (if run on Windows) #129

Closed it-praktyk closed 6 years ago

it-praktyk commented 7 years ago

Currently the function Save-GitLabAPIConfiguration store data in the file "$env:appdata\PSGitLab\PSGitLabConfiguration.xml".

I think that better option is to use built-in in Windows credential manager.

Possible Solution https://practical365.com/blog/saving-credentials-for-office-365-powershell-scripts-and-scheduled-tasks/

But it will work only for Windows and (probably) PowerShell 5.x.

it-praktyk commented 7 years ago

Other options that can be used

ngetchell commented 6 years ago

On Windows we use the secure string feature inside of the PowerShell language to serialize the GitLab token to disk. The token can only be de-serialized by the user that created the token.

I have not been able to find any examples of people using the Credential store to get credentials with PowerShell. The example given serializes to disk like Save-GitLabAPIConfiguration currently does.

The Mac and Linux side of the equation is obviously a problem. I'd like to see first-party support as requested in https://github.com/PowerShell/PowerShell/issues/1654. I will look into Protect-CMSMessage for *unix users but I don't believe it would work outside of an enterprise CA env.

Please correct me if my understanding of the technology is wrong.

ngetchell commented 6 years ago

As this would be Windows only I don't believe this would be worth the effort. Smarter developers than I would likely have to solve a x-plat solution.