[Java][resttemplate] Add test for bearer auth (#17081)

* add bearer auth API to echo-api

* run generate-samples.sh

* add resttemplate echo-api sample

* add bearer auth test

* remove @Ignore
This commit is contained in:
Tomohiko Ozawa
2023-11-16 01:38:49 +09:00
committed by GitHub
parent e47e7041f7
commit 37451fa569
133 changed files with 12443 additions and 0 deletions

View File

@@ -76,3 +76,71 @@ function Test-AuthHttpBasic {
}
}
<#
.SYNOPSIS
To test HTTP bearer authentication
.DESCRIPTION
No description available.
.PARAMETER WithHttpInfo
A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response
.OUTPUTS
String
#>
function Test-AuthHttpBearer {
[CmdletBinding()]
Param (
[Switch]
$WithHttpInfo
)
Process {
'Calling method: Test-AuthHttpBearer' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug
$LocalVarAccepts = @()
$LocalVarContentTypes = @()
$LocalVarQueryParameters = @{}
$LocalVarHeaderParameters = @{}
$LocalVarFormParameters = @{}
$LocalVarPathParameters = @{}
$LocalVarCookieParameters = @{}
$LocalVarBodyParameter = $null
$Configuration = Get-Configuration
# HTTP header 'Accept' (if needed)
$LocalVarAccepts = @('text/plain')
$LocalVarUri = '/auth/http/bearer'
if ($Configuration["AccessToken"]) {
$LocalVarHeaderParameters['Authorization'] = "Bearer " + $Configuration["AccessToken"]
Write-Verbose ("Using Bearer authentication in {0}" -f $MyInvocation.MyCommand)
}
$LocalVarResult = Invoke-ApiClient -Method 'POST' `
-Uri $LocalVarUri `
-Accepts $LocalVarAccepts `
-ContentTypes $LocalVarContentTypes `
-Body $LocalVarBodyParameter `
-HeaderParameters $LocalVarHeaderParameters `
-QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters `
-ReturnType "String" `
-IsBodyNullable $false
if ($WithHttpInfo.IsPresent) {
return $LocalVarResult
} else {
return $LocalVarResult["Response"]
}
}
}