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

me-viper / OpaDotNet / 13788540723

11 Mar 2025 12:54PM UTC coverage: 82.096% (-0.03%) from 82.124%
13788540723

push

github

me-viper
chore: Update public APIs

2059 of 2668 branches covered (77.17%)

Branch coverage included in aggregate %.

4003 of 4716 relevant lines covered (84.88%)

8029.75 hits per line

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

80.0
/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

25
[PublicAPI]
26
[JsonConverter(typeof(ClaimPolicyInputJsonSerializer))]
27
public record ClaimPolicyInput(string Type, string Value);
105✔
28

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

36
    public override void Write(Utf8JsonWriter writer, ClaimPolicyInput value, JsonSerializerOptions options)
37
    {
38
        var typeProp = options.PropertyNamingPolicy?.ConvertName(nameof(ClaimPolicyInput.Type)) ?? nameof(ClaimPolicyInput.Type);
21!
39
        var valProp = options.PropertyNamingPolicy?.ConvertName(nameof(ClaimPolicyInput.Value)) ?? nameof(ClaimPolicyInput.Value);
21!
40

41
        writer.WriteStartObject();
21✔
42
        writer.WriteString(typeProp, value.Type);
21✔
43
        writer.WritePropertyName(valProp);
21✔
44

45
        if (value.Value.Length > 1 && value.Value[0] == '[')
21✔
46
            writer.WriteRawValue(value.Value);
2✔
47
        else
48
            writer.WriteStringValue(value.Value);
19✔
49

50
        writer.WriteEndObject();
21✔
51
    }
21✔
52
}
53

54
[PublicAPI]
55
public interface IHttpRequestPolicyInput
56
{
57
    string Method { get; }
58

59
    string Scheme { get; }
60

61
    string Host { get; }
62

63
    string? PathBase { get; }
64

65
    string? Path { get; }
66

67
    string? QueryString { get; }
68

69
    IQueryCollection Query { get; }
70

71
    string Protocol { get; }
72

73
    IConnectionInput Connection { get; }
74

75
    IDictionary<string, string?> Headers { get; }
76

77
    IEnumerable<ClaimPolicyInput> Claims { get; }
78

79
    static IHttpRequestPolicyInput Build(
80
        HttpRequest request,
81
        IReadOnlySet<string> includedHeaders,
82
        IEnumerable<Claim>? claims)
83
    {
84
        return new HttpRequestPolicyInput(request, includedHeaders, claims);
9✔
85
    }
86
}
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