< Summary

Information
Class: ArturRios.Util.WebApi.Security.Authentication.GoogleTokenVerifier
Assembly: ArturRios.Util.WebApi
File(s): D:\Repositories\dotnet-webapi-util\src\Security\Authentication\GoogleTokenVerifier.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 30
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage
0%
Covered methods: 0
Fully covered methods: 0
Total methods: 1
Method coverage: 0%
Full method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
VerifyAsync()0%4260%

File(s)

D:\Repositories\dotnet-webapi-util\src\Security\Authentication\GoogleTokenVerifier.cs

#LineLine coverage
 1using ArturRios.Util.WebApi.Security.Interfaces;
 2using ArturRios.Util.WebApi.Security.Records;
 3using Google.Apis.Auth;
 4
 5namespace ArturRios.Util.WebApi.Security.Authentication;
 6
 7/// <summary>Default <see cref="IGoogleTokenVerifier"/> backed by <see cref="GoogleJsonWebSignature"/>, which fetches an
 8public class GoogleTokenVerifier : IGoogleTokenVerifier
 9{
 10    /// <inheritdoc />
 11    public async Task<GoogleTokenPayload?> VerifyAsync(string token, IEnumerable<string> audiences)
 012    {
 013        if (string.IsNullOrWhiteSpace(token))
 014        {
 015            return null;
 16        }
 17
 18        try
 019        {
 020            var settings = new GoogleJsonWebSignature.ValidationSettings { Audience = audiences };
 021            var payload = await GoogleJsonWebSignature.ValidateAsync(token, settings);
 22
 023            return new GoogleTokenPayload(payload.Email ?? string.Empty, payload.Subject ?? string.Empty, payload.EmailV
 24        }
 025        catch (InvalidJwtException)
 026        {
 027            return null;
 28        }
 029    }
 30}

Methods/Properties

VerifyAsync()