Added authentication
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiDocument
|
||||
{
|
||||
[JsonPropertyName("info")]
|
||||
@@ -15,5 +18,13 @@ namespace EonaCat.DoxaApi.Models
|
||||
|
||||
[JsonPropertyName("schemas")]
|
||||
public Dictionary<string, SchemaModel> Schemas { get; set; } = new();
|
||||
|
||||
/// <summary>All security schemes available for this API (keyed by scheme id).</summary>
|
||||
[JsonPropertyName("securitySchemes")]
|
||||
public Dictionary<string, SecuritySchemeModel> SecuritySchemes { get; set; } = new();
|
||||
|
||||
/// <summary>Which optional DoxaApi server-side features are enabled, for UI feature detection.</summary>
|
||||
[JsonPropertyName("features")]
|
||||
public ApiFeatureFlags Features { get; set; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiEndpoint
|
||||
{
|
||||
[JsonPropertyName("operationId")]
|
||||
@@ -33,5 +36,12 @@ namespace EonaCat.DoxaApi.Models
|
||||
|
||||
[JsonPropertyName("responses")]
|
||||
public List<ResponseModel> Responses { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Ids of security schemes that apply to this endpoint (referencing ApiDocument.SecuritySchemes).
|
||||
/// Empty means the endpoint is unauthenticated (or uses the document-wide default, if any).
|
||||
/// </summary>
|
||||
[JsonPropertyName("security")]
|
||||
public List<string> Security { get; set; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiFeatureFlags
|
||||
{
|
||||
[JsonPropertyName("mockServer")]
|
||||
public bool MockServer { get; set; }
|
||||
|
||||
[JsonPropertyName("console")]
|
||||
public bool Console { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiGroup
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiInfo
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ApiParameter
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class RequestBodyModel
|
||||
{
|
||||
[JsonPropertyName("required")]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class ResponseModel
|
||||
{
|
||||
[JsonPropertyName("statusCode")]
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public sealed class SchemaModel
|
||||
{
|
||||
[JsonPropertyName("type")]
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EonaCat.DoxaApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
/// <summary>
|
||||
/// Describes how a single security scheme authenticates requests.
|
||||
/// Mirrors the relevant parts of the OpenAPI "securityScheme" object so it can be
|
||||
/// losslessly exported to OpenAPI/Swagger, while also carrying enough information
|
||||
/// for the DoxaApi UI to render a live "Try it" authorization form.
|
||||
/// </summary>
|
||||
public sealed class SecuritySchemeModel
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; } = "";
|
||||
|
||||
/// <summary>apiKey | http | oauth2 | openIdConnect</summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type { get; set; } = "apiKey";
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>For apiKey: header | query | cookie</summary>
|
||||
[JsonPropertyName("in")]
|
||||
public string? In { get; set; }
|
||||
|
||||
/// <summary>For apiKey: the header/query/cookie name. For http: ignored.</summary>
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>For http: bearer | basic | digest</summary>
|
||||
[JsonPropertyName("scheme")]
|
||||
public string? Scheme { get; set; }
|
||||
|
||||
/// <summary>For http bearer: an informational hint such as "JWT".</summary>
|
||||
[JsonPropertyName("bearerFormat")]
|
||||
public string? BearerFormat { get; set; }
|
||||
|
||||
/// <summary>For oauth2: supported flows (clientCredentials, authorizationCode, password, implicit).</summary>
|
||||
[JsonPropertyName("flows")]
|
||||
public OAuthFlowsModel? Flows { get; set; }
|
||||
}
|
||||
|
||||
public sealed class OAuthFlowsModel
|
||||
{
|
||||
[JsonPropertyName("clientCredentials")]
|
||||
public OAuthFlowModel? ClientCredentials { get; set; }
|
||||
|
||||
[JsonPropertyName("authorizationCode")]
|
||||
public OAuthFlowModel? AuthorizationCode { get; set; }
|
||||
|
||||
[JsonPropertyName("password")]
|
||||
public OAuthFlowModel? Password { get; set; }
|
||||
|
||||
[JsonPropertyName("implicit")]
|
||||
public OAuthFlowModel? Implicit { get; set; }
|
||||
}
|
||||
|
||||
public sealed class OAuthFlowModel
|
||||
{
|
||||
[JsonPropertyName("authorizationUrl")]
|
||||
public string? AuthorizationUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("tokenUrl")]
|
||||
public string? TokenUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("refreshUrl")]
|
||||
public string? RefreshUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("scopes")]
|
||||
public Dictionary<string, string> Scopes { get; set; } = new();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user