Auth0ConnectionEx.psm1
Import-Module Auth0 class Auth0Token { [ValidateNotNullOrEmpty()][string]$access_token [ValidateNotNullOrEmpty()][string]$token_type [int]$expires_in [string[]]$scope } class Auth0Context { [ValidateNotNullOrEmpty()][string]$Domain [ValidateNotNullOrEmpty()][Auth0Token]$Token } function Search-Auth0Connection { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=1)] [Auth0Context] $Context, [parameter(Mandatory=$true, Position=2)] [String] $Name = '' ) $webClient = New-Object System.Net.WebClient $webClient.Headers.Add('Authorization', $Context.Token.token_type + ' ' + $Context.Token.access_token) return $webClient.DownloadString('https://' + $Context.Domain + '/api/v2/connections?per_page=1&page=0&name=' + $Name) | ConvertFrom-Json } |