• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

me-viper / OpaDotNet / 27121073905

08 Jun 2026 06:54AM UTC coverage: 87.653% (+0.002%) from 87.651%
27121073905

push

github

me-viper
ci: Prepare release

4586 of 5232 relevant lines covered (87.65%)

0.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/Extensions.AspNetCore/src/IHttpRequestPolicyInput.cs
1
using System.Security.Claims;
2
using System.Text.Json;
3
using System.Text.Json.Serialization;
4

5
using Microsoft.AspNetCore.Http;
6

7
namespace OpaDotNet.Extensions.AspNetCore;
8

9
[PublicAPI]
10
public interface IConnectionInput
11
{
12
    string? RemoteIpAddress { get; }
13

14
    string? RemoteIpAddressV6 { get; }
15

16
    int RemotePort { get; }
17

18
    string? LocalIpAddress { get; }
19

20
    string? LocalIpAddressV6 { get; }
21

22
    int LocalPort { get; }
23

24
    string? ClientCertificatePem { get; }
25
}
26

27
[PublicAPI]
28
[JsonConverter(typeof(ClaimPolicyInputJsonSerializer))]
29
public record ClaimPolicyInput(string Type, string Value);
1✔
30

31
internal class ClaimPolicyInputJsonSerializer : JsonConverter<ClaimPolicyInput>
32
{
33
    public override ClaimPolicyInput Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
34
    {
35
        throw new NotSupportedException("Deserialization is not supported");
×
36
    }
37

38
    public override void Write(Utf8JsonWriter writer, ClaimPolicyInput value, JsonSerializerOptions options)
39
    {
40
        var typeProp = options.PropertyNamingPolicy?.ConvertName(nameof(ClaimPolicyInput.Type)) ?? nameof(ClaimPolicyInput.Type);
1✔
41
        var valProp = options.PropertyNamingPolicy?.ConvertName(nameof(ClaimPolicyInput.Value)) ?? nameof(ClaimPolicyInput.Value);
1✔
42

43
        writer.WriteStartObject();
1✔
44
        writer.WriteString(typeProp, value.Type);
1✔
45
        writer.WritePropertyName(valProp);
1✔
46

47
        if (value.Value.Length > 1 && value.Value[0] == '[')
1✔
48
            writer.WriteRawValue(value.Value);
1✔
49
        else
50
            writer.WriteStringValue(value.Value);
1✔
51

52
        writer.WriteEndObject();
1✔
53
    }
1✔
54
}
55

56
[PublicAPI]
57
public interface IHttpRequestPolicyInput
58
{
59
    string Method { get; }
60

61
    string Scheme { get; }
62

63
    string Host { get; }
64

65
    string? PathBase { get; }
66

67
    string? Path { get; }
68

69
    string? QueryString { get; }
70

71
    IQueryCollection Query { get; }
72

73
    string Protocol { get; }
74

75
    IConnectionInput Connection { get; }
76

77
    IDictionary<string, string?> Headers { get; }
78

79
    IEnumerable<ClaimPolicyInput> Claims { get; }
80

81
    static IHttpRequestPolicyInput Build(
82
        HttpRequest request,
83
        IReadOnlySet<string> includedHeaders,
84
        IEnumerable<Claim>? claims)
85
    {
86
        return new HttpRequestPolicyInput(request, includedHeaders, claims);
1✔
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc