[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

@@ -42,6 +42,8 @@ public class ApiClient {
RequestInterceptor auth = null;
if ("http_auth".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("http_bearer_auth".equals(authName)) {
auth = new HttpBearerAuth("bearer");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}

View File

@@ -39,4 +39,29 @@ public interface AuthApi extends ApiClient.Api {
ApiResponse<String> testAuthHttpBasicWithHttpInfo();
/**
* To test HTTP bearer authentication
* To test HTTP bearer authentication
* @return String
*/
@RequestLine("POST /auth/http/bearer")
@Headers({
"Accept: text/plain",
})
String testAuthHttpBearer();
/**
* To test HTTP bearer authentication
* Similar to <code>testAuthHttpBearer</code> but it also returns the http response headers .
* To test HTTP bearer authentication
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /auth/http/bearer")
@Headers({
"Accept: text/plain",
})
ApiResponse<String> testAuthHttpBearerWithHttpInfo();
}