Private/OAuth/Get-AuthorizationHeader.ps1
<# .NOTES Created with: VSCode Created on: 5/05/2017 03:27 PM Edited on: 5/14/2017 Created by: Mark Kraus Organization: Filename: Get-AuthorizationHeader.ps1 .DESCRIPTION Get-AuthorizationHeader Function #> [CmdletBinding()] param() function Get-AuthorizationHeader { [CmdletBinding( HelpUri = 'https://psraw.readthedocs.io/en/latest/PrivateFunctions/Get-AuthorizationHeader' )] [OutputType([System.String])] param ( [Parameter( Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] [PSCredential] [System.Management.Automation.CredentialAttribute()]$Credential ) process { 'Basic {0}' -f ( [System.Convert]::ToBase64String( [System.Text.Encoding]::ASCII.GetBytes( ('{0}:{1}' -f $Credential.UserName, $Credential.GetNetworkCredential().Password) )# End [System.Text.Encoding]::ASCII.GetBytes( )# End [System.Convert]::ToBase64String( )# End 'Basic {0}' -f }# End process }# End Get-AuthorizationHeader |