forked from loafle/openapi-generator-original
* add bearer auth API to echo-api * run generate-samples.sh * add resttemplate echo-api sample * add bearer auth test * remove @Ignore
5.3 KiB
5.3 KiB
Org.OpenAPITools.Api.AuthApi
All URIs are relative to http://localhost:3000
Method | HTTP request | Description |
---|---|---|
TestAuthHttpBasic | POST /auth/http/basic | To test HTTP basic authentication |
TestAuthHttpBearer | POST /auth/http/bearer | To test HTTP bearer authentication |
TestAuthHttpBasic
string TestAuthHttpBasic ()
To test HTTP basic authentication
To test HTTP basic authentication
Example
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class TestAuthHttpBasicExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
// Configure HTTP basic authorization: http_auth
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";
var apiInstance = new AuthApi(config);
try
{
// To test HTTP basic authentication
string result = apiInstance.TestAuthHttpBasic();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AuthApi.TestAuthHttpBasic: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the TestAuthHttpBasicWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// To test HTTP basic authentication
ApiResponse<string> response = apiInstance.TestAuthHttpBasicWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AuthApi.TestAuthHttpBasicWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
This endpoint does not need any parameter.
Return type
string
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain
HTTP response details
Status code | Description | Response headers |
---|---|---|
200 | Successful operation | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TestAuthHttpBearer
string TestAuthHttpBearer ()
To test HTTP bearer authentication
To test HTTP bearer authentication
Example
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class TestAuthHttpBearerExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
// Configure Bearer token for authorization: http_bearer_auth
config.AccessToken = "YOUR_BEARER_TOKEN";
var apiInstance = new AuthApi(config);
try
{
// To test HTTP bearer authentication
string result = apiInstance.TestAuthHttpBearer();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AuthApi.TestAuthHttpBearer: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the TestAuthHttpBearerWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// To test HTTP bearer authentication
ApiResponse<string> response = apiInstance.TestAuthHttpBearerWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AuthApi.TestAuthHttpBearerWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
This endpoint does not need any parameter.
Return type
string
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: text/plain
HTTP response details
Status code | Description | Response headers |
---|---|---|
200 | Successful operation | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]