< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.WebApi.Security.UnconfiguredGoogleIdTokenVerifier
Assembly: ArturRios.Heimdall.WebApi
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Security/UnconfiguredGoogleIdTokenVerifier.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 30
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
0%
Covered methods: 0
Fully covered methods: 0
Total methods: 2
Method coverage: 0%
Full method coverage: 0%

Metrics

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

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Security/UnconfiguredGoogleIdTokenVerifier.cs

#LineLine coverage
 1using ArturRios.Heimdall.Command.Services;
 2
 3namespace ArturRios.Heimdall.WebApi.Security;
 4
 5/// <summary>
 6///     The <see cref="IGoogleIdTokenVerifier" /> a deployment with no Google client configured runs
 7///     with: it refuses every token, so UC-25 answers <c>401</c> (AF-25a) rather than accepting one
 8///     no one checked.
 9/// </summary>
 10/// <remarks>
 11///     The refusing default is the point. Verification needs an audience to check against (NFR-13),
 12///     and a verifier with no configured client ID could only either reject everything or trust
 13///     everything — so it rejects. This differs from the email fallback, which degrades to logging
 14///     because a missing verification mail is an inconvenience; a missing token check is an open
 15///     door. Failing start-up instead was the alternative, and it would take the whole API down over
 16///     one optional feature that a scope must also switch on (FR-GO-01) before it is reachable.
 17/// </remarks>
 018public class UnconfiguredGoogleIdTokenVerifier(ILogger<UnconfiguredGoogleIdTokenVerifier> logger)
 19    : IGoogleIdTokenVerifier
 20{
 21    public Task<GoogleIdTokenPayload?> VerifyAsync(string idToken)
 22    {
 023        logger.LogWarning(
 024            "Google sign-in attempted but no Google client is configured ({Variable}); the token " +
 025            "cannot be verified and is refused",
 026            GoogleSignInOptions.ClientIdsVariable);
 27
 028        return Task.FromResult<GoogleIdTokenPayload?>(null);
 29    }
 30}