< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Authentication.OidcEvents
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Authentication/OidcEvents.cs
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 36
Line coverage: 100%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 11/19/2025 - 02:25:56 Line coverage: 100% (11/11) Branch coverage: 87.5% (7/8) Total lines: 36 Tag: Kestrun/Kestrun@98ff905e5605a920343154665980a71211a03c6d 11/19/2025 - 02:25:56 Line coverage: 100% (11/11) Branch coverage: 87.5% (7/8) Total lines: 36 Tag: Kestrun/Kestrun@98ff905e5605a920343154665980a71211a03c6d

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
AuthorizationCodeReceived(...)87.5%88100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Authentication/OidcEvents.cs

#LineLine coverage
 1
 2using Microsoft.AspNetCore.Authentication.OpenIdConnect;
 3
 4namespace Kestrun.Authentication;
 5/// <summary>
 6/// OpenID Connect events to handle client assertion injection.
 7/// </summary>
 8/// <remarks>
 9/// Initializes a new instance of the <see cref="OidcEvents"/> class.
 10/// </remarks>
 11/// <param name="assertionService">The assertion service used to create client assertions. </param>
 212public class OidcEvents(AssertionService assertionService) : OpenIdConnectEvents
 13{
 214    private readonly AssertionService _assertionService = assertionService;
 15
 16    /// <summary>
 17    /// Handles the AuthorizationCodeReceived event to inject client assertions.
 18    /// </summary>
 19    /// <param name="context">The context for the AuthorizationCodeReceived event.</param>
 20    /// <returns>A completed task.</returns>
 21    public override Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext context)
 22    {
 223        var tokenEndpoint =
 224            context.Options.Configuration?.TokenEndpoint
 225            ?? (context.Options.Authority?.TrimEnd('/') + "/connect/token");
 226        if (context.TokenEndpointRequest is not null)
 27        {
 128            context.TokenEndpointRequest.ClientAssertionType =
 129                "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
 30
 131            context.TokenEndpointRequest.ClientAssertion =
 132                _assertionService.CreateClientAssertion(tokenEndpoint);
 33        }
 234        return Task.CompletedTask;
 35    }
 36}