forked from loafle/openapi-generator-original
[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:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user