Pinqponq.Auth.Sso.Abstractions 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Pinqponq.Auth.Sso.Abstractions --version 1.0.0
                    
NuGet\Install-Package Pinqponq.Auth.Sso.Abstractions -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pinqponq.Auth.Sso.Abstractions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pinqponq.Auth.Sso.Abstractions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Pinqponq.Auth.Sso.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pinqponq.Auth.Sso.Abstractions --version 1.0.0
                    
#r "nuget: Pinqponq.Auth.Sso.Abstractions, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pinqponq.Auth.Sso.Abstractions@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pinqponq.Auth.Sso.Abstractions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Pinqponq.Auth.Sso.Abstractions&version=1.0.0
                    
Install as a Cake Tool

Pinqponq.Auth.Sso.Abstractions

Shared contract for external identity providers (Google, and future providers): IExternalAuthProvider and its supporting models. This is a contracts-only package — no dependency injection, no implementation, no AddPinqponqXxx(...) extension. It exists so provider packages (e.g. Pinqponq.Auth.Sso.Google) and the applications that consume them can share one normalized surface instead of each provider inventing its own shapes.

Install

dotnet add package Pinqponq.Auth.Sso.Abstractions

In practice you rarely install this package directly — a provider package such as Pinqponq.Auth.Sso.Google already depends on it and brings it in transitively. Install it directly only if you are writing your own provider implementation or need the contract types in a project that doesn't reference a concrete provider (e.g. a shared interfaces/contracts project).

Requirements

  • .NET 8.0, 9.0, or 10.0
  • No third-party dependencies — this package has zero PackageReference entries

Quick start

This package has no services to register; it only ships types. A typical consumer depends on it indirectly through a provider package and codes against the interface, optionally resolving a specific provider by name when more than one is registered:

using Pinqponq.Auth.Sso.Abstractions;

public sealed class ExternalLoginEndpoint(IEnumerable<IExternalAuthProvider> providers)
{
    public async Task<IResult> HandleAsync(
        string providerName,
        string idToken,
        CancellationToken cancellationToken)
    {
        var provider = providers.FirstOrDefault(p =>
            string.Equals(p.ProviderName, providerName, StringComparison.OrdinalIgnoreCase));

        if (provider is null)
        {
            return Results.BadRequest($"Unknown provider '{providerName}'.");
        }

        var request = ExternalAuthRequest.FromIdToken(idToken);
        var result = await provider.AuthenticateAsync(request, cancellationToken);

        if (!result.Succeeded)
        {
            return Results.Unauthorized();
        }

        var user = result.User!;
        // Look up or create a local account keyed by (Provider, Subject) — see
        // "Notes / behavior" below for why Email alone is not a safe join key.
        return Results.Ok(new { user.Subject, user.Provider, user.Email, user.Name });
    }
}

Implementing your own provider (the pattern followed by Pinqponq.Auth.Sso.Google):

using Pinqponq.Auth.Sso.Abstractions;

public sealed class MyProviderAuthProvider : IExternalAuthProvider
{
    public string ProviderName => "MyProvider";

    public async Task<ExternalAuthResult> AuthenticateAsync(
        ExternalAuthRequest request,
        CancellationToken cancellationToken = default)
    {
        if (string.IsNullOrWhiteSpace(request.IdToken))
        {
            return ExternalAuthResult.Failure("An id_token is required.");
        }

        // Validate the token against the provider's public keys / introspection endpoint...
        var payload = await ValidateTokenAsync(request.IdToken, cancellationToken);

        return ExternalAuthResult.Success(new ExternalUserInfo
        {
            Subject = payload.Subject,
            Provider = ProviderName,
            Email = payload.Email,
            EmailVerified = payload.EmailVerified,
            Name = payload.Name,
        });
    }
}

Configuration

There is nothing to configure here and no AddPinqponqXxx(...) extension in this package — it is a pure contract with no options and no DI registration. Configuration (client IDs, hosted domain, nonce requirements, etc.) lives in the concrete provider package. See Pinqponq.Auth.Sso.Google for a working example.

Main types

Type Description
IExternalAuthProvider The contract every provider implements: ProviderName and AuthenticateAsync(ExternalAuthRequest, ct).
ExternalAuthRequest Input to an authentication attempt. Supports the id-token flow (FromIdToken(idToken, nonce?)) and the authorization-code flow (FromAuthorizationCode(code, redirectUri)); a provider uses whichever field(s) apply and may not support both flows.
ExternalAuthResult Outcome of an attempt: Succeeded, User (populated on success via Success(user)), Error (populated on failure via Failure(error)).
ExternalUserInfo Normalized external profile: Subject, Provider, Email, EmailVerified, Name, GivenName, FamilyName, Picture.

Notes / behavior

  • This package has no DI extension. There is no AddPinqponqXxx(...) method to call — it only defines types. Register a concrete IExternalAuthProvider implementation from a provider package instead, e.g. services.AddPinqponqGoogleSso(...).
  • ExternalAuthRequest covers two flows, but a given provider may support only one. For example, Pinqponq.Auth.Sso.Google's current implementation only supports the id-token flow and returns a failure result if AuthorizationCode is supplied instead.
  • Do not trust Email/EmailVerified for account linking without checking EmailVerified. ExternalUserInfo.Subject (the provider's stable user id, e.g. Google's sub) is the only safe key for identifying "the same external account across logins". Joining local accounts purely by Email risks account takeover if a provider allows unverified emails or a different provider reuses the same address.
  • Target frameworks: net8.0, net9.0, net10.0.
  • Pinqponq.Auth.Sso.Google — the first concrete IExternalAuthProvider implementation (Google OAuth2/OIDC id_token validation).
  • Pinqponq.Identity — issue your own JWT/refresh tokens once an external sign-in succeeds.

Samples

Try this package in the browser via Pinqponq.Playground — see samples/README.md.

Repository

https://github.com/pinqponq/pinqnuqets

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Pinqponq.Auth.Sso.Abstractions:

Package Downloads
Pinqponq.Auth.Sso.Google

Sign-in implementation via Google OAuth2/OIDC id_token validation (IExternalAuthProvider).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 207 8/7/2026
1.0.0 142 8/7/2026