76 lines
2.6 KiB
C#
76 lines
2.6 KiB
C#
using EonaCat.Json;
|
|
|
|
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
|
|
{
|
|
[JsonProperty("id")]
|
|
public string Id { get; set; } = "";
|
|
|
|
/// <summary>apiKey | http | oauth2 | openIdConnect</summary>
|
|
[JsonProperty("type")]
|
|
public string Type { get; set; } = "apiKey";
|
|
|
|
[JsonProperty("description")]
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>For apiKey: header | query | cookie</summary>
|
|
[JsonProperty("in")]
|
|
public string? In { get; set; }
|
|
|
|
/// <summary>For apiKey: the header/query/cookie name. For http: ignored.</summary>
|
|
[JsonProperty("name")]
|
|
public string? Name { get; set; }
|
|
|
|
/// <summary>For http: bearer | basic | digest</summary>
|
|
[JsonProperty("scheme")]
|
|
public string? Scheme { get; set; }
|
|
|
|
/// <summary>For http bearer: an informational hint such as "JWT".</summary>
|
|
[JsonProperty("bearerFormat")]
|
|
public string? BearerFormat { get; set; }
|
|
|
|
/// <summary>For oauth2: supported flows (clientCredentials, authorizationCode, password, implicit).</summary>
|
|
[JsonProperty("flows")]
|
|
public OAuthFlowsModel? Flows { get; set; }
|
|
}
|
|
|
|
public sealed class OAuthFlowsModel
|
|
{
|
|
[JsonProperty("clientCredentials")]
|
|
public OAuthFlowModel? ClientCredentials { get; set; }
|
|
|
|
[JsonProperty("authorizationCode")]
|
|
public OAuthFlowModel? AuthorizationCode { get; set; }
|
|
|
|
[JsonProperty("password")]
|
|
public OAuthFlowModel? Password { get; set; }
|
|
|
|
[JsonProperty("implicit")]
|
|
public OAuthFlowModel? Implicit { get; set; }
|
|
}
|
|
|
|
public sealed class OAuthFlowModel
|
|
{
|
|
[JsonProperty("authorizationUrl")]
|
|
public string? AuthorizationUrl { get; set; }
|
|
|
|
[JsonProperty("tokenUrl")]
|
|
public string? TokenUrl { get; set; }
|
|
|
|
[JsonProperty("refreshUrl")]
|
|
public string? RefreshUrl { get; set; }
|
|
|
|
[JsonProperty("scopes")]
|
|
public Dictionary<string, string> Scopes { get; set; } = new();
|
|
}
|
|
} |