Add Support for Null Usernames in Web Cmdlet Basic Auth#9536
Conversation
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
…Cmdlet/Common/WebRequestPSCmdlet.Common.cs Style fix Co-Authored-By: markekraus <github@markekraus.com>
|
@SteveL-MSFT CodeFactor helped us with such formatting issues. Is it possible to bring it back? |
|
@iSazonov seems odd that Codacy wouldn't also catch such an issue |
|
@markekraus Thank you for your contribution. |
|
@SteveL-MSFT > seems odd that Codacy wouldn't also catch such an issue Sorry, I don't understand that you mean. |
|
Without CodeFactor, we will begin again to collect formatting errors and fall into discussions of this. |
PR Summary
It is possible to construct PSCredential objects with null or empty usernames. However, doing so makes it impossible to retrieve the plain-text password from the PSCredential.GetNetworkCredential() API. There are some Web APIs which may require a null or empty username. This PR changes the way the password is parsed from the Credential parameter such that a null or empty username will not impact conversion to plain-text.
PR Context
Closes #9017
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.