< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Authentication.AuthOptionsHelper
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Authentication/AuthOptionsHelper.cs
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 27
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 09/12/2025 - 03:43:11 Line coverage: 0% (0/3) Total lines: 27 Tag: Kestrun/Kestrun@d160286e3020330b1eb862d66a37db2e26fc9042

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetAuthOptions(...)100%210%

File(s)

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

#LineLine coverage
 1using Microsoft.AspNetCore.Authentication;
 2using Microsoft.Extensions.Options;
 3
 4namespace Kestrun.Authentication;
 5
 6/// <summary>
 7/// Helper class to retrieve authentication options from the DI container.
 8/// </summary>
 9public static class AuthOptionsHelper
 10{
 11    /// <summary>
 12    /// Retrieve authentication options from the DI container.
 13    /// </summary>
 14    /// <typeparam name="TOptions">The type of authentication options.</typeparam>
 15    /// <param name="ctx">The HTTP context.</param>
 16    /// <param name="scheme">The authentication scheme.</param>
 17    /// <returns>The authentication options for the specified scheme.</returns>
 18    public static TOptions GetAuthOptions<TOptions>(HttpContext ctx, string scheme)
 19        where TOptions : AuthenticationSchemeOptions
 20    {
 021        var monitor = ctx.RequestServices
 022            .GetRequiredService<IOptionsMonitor<TOptions>>();
 23
 024        return monitor.Get(scheme);
 25    }
 26}
 27