PowerShell/test
Mark Kraus 7c9bddfa3d Add Authentication Parameter to Web Cmdlets for Basic and OAuth (#5052)
Closes #4274

Adds an -Authentication parameter to Invoke-RestMethod and Invoke-WebRequest
Adds an -Token parameter to Invoke-RestMethod and Invoke-WebRequest
Adds an -AllowUnencryptedAuthentication parameter to Invoke-RestMethod and Invoke-WebRequest
Adds tests for various -Authorization uses
-Authentication Parameter has 3 options: Basic, OAuth, and Bearer
Basic requires -Credential and provides RFC-7617 Basic Authorization credentials to the remote server
OAuth and Bearer require the -Token which is a SecureString containing the bearer token to send to the remote server
If any authentication is provided for any transport scheme other than HTTPS, the request will result in an error. A user may use the -AllowUnencryptedAuthentication switch to bypass this behavior and send their secrets unencrypted at their own risk.
-Authentication does not work with -UseDefaultCredentials and will result in an error.
The existing behavior with -Credential is left untouched. When not supplying -Authentication, A user will not receive an error when using -Credential over unencrypted connections.

Code design choice is meant to accommodate more Authentication types in the future.

Documentation Needed

The 3 new parameters will need to be added to the Invoke-RestMethod and Invoke-WebRequest documentation along with examples. Syntax will need to be updated.
2017-10-17 19:08:06 -07:00
..
common/markdown Update ChangeLog for beta.8 release (#5006) 2017-10-05 16:43:08 -07:00
csharp Build powershell core using the generic RID 'linux-x64' (#4841) 2017-09-18 09:31:07 -07:00
docker/networktest Rename powershell.exe to pwsh.exe (#5101) 2017-10-17 17:25:11 -07:00
powershell Add Authentication Parameter to Web Cmdlets for Basic and OAuth (#5052) 2017-10-17 19:08:06 -07:00
PSReadLine Build powershell core using the generic RID 'linux-x64' (#4841) 2017-09-18 09:31:07 -07:00
shebang Reorganize tests 2016-01-14 17:00:06 -08:00
tools Rename powershell.exe to pwsh.exe (#5101) 2017-10-17 17:25:11 -07:00
README.md Add test/README.md 2016-03-30 23:30:26 -07:00
Test.Common.props Move to the official .NET Core 2.0 (#4603) 2017-08-16 17:32:46 -07:00

Testing

The tests are organized by testing language. Thus Pester tests, which are written in the PowerShell language, are in ./powershell and xUnit tests, written in C#, are in ./csharp. The sanity tests for the Full .NET build of PowerShell are in ./fullclr, and the third-party shebang test is in ./shebang.