Nexttag.Auth 1.1.0

dotnet add package Nexttag.Auth --version 1.1.0
                    
NuGet\Install-Package Nexttag.Auth -Version 1.1.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="Nexttag.Auth" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nexttag.Auth" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Nexttag.Auth" />
                    
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 Nexttag.Auth --version 1.1.0
                    
#r "nuget: Nexttag.Auth, 1.1.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 Nexttag.Auth@1.1.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=Nexttag.Auth&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Nexttag.Auth&version=1.1.0
                    
Install as a Cake Tool

Nexttag.Auth

Contratos universais de autenticação compartilhados pelas libs Nexttag.Auth.*. Hoje: ICurrentUserProvider (quem é o usuário do request atual) — provedor-agnóstico (Jwt, Identity, Keycloak, NextAuth implementam).

ℹ️ v1.1.0: o contrato de emissão de token (IJwtService) saiu desta base e vive em Nexttag.Auth.Jwt — emitir token é mecanismo específico (Keycloak/NextAuth não emitem, só validam). O namespace segue Nexttag.Auth, então o código consumidor não muda, só recompila.

Instalar

dotnet add package Nexttag.Auth

Requer .NET 10.

Registrar (Program.cs)

Este pacote não tem registro próprio — é instalado como dependência transitiva de Nexttag.Auth.Jwt, Nexttag.Auth.Identity, Nexttag.Auth.Keycloak ou Nexttag.Auth.NextAuth. Não é necessário chamá-lo diretamente.

Configurar

Sem configuração obrigatória.

Usar

Para emitir tokens (IJwtService), use o pacote Nexttag.Auth.Jwt (veja o README de lá). Esta base expõe só o contrato universal abaixo.

ICurrentUserProvider

Lê os claims do usuário autenticado no request atual:

public class MeuController(ICurrentUserProvider usuario)
{
    public IActionResult Info()
    {
        var id    = usuario.UsuarioId;   // Guid?
        var nome  = usuario.Nome;        // string?
        var email = usuario.Email;       // string?
        var claim = usuario.GetClaim("tenantId"); // string?
        return Ok(new { id, nome, email });
    }
}

Receitas

Injetar em qualquer serviço de domínio:

public class PedidoService(ICurrentUserProvider usuarioAtual, IPedidoRepository repo)
{
    public async Task CriarPedido(PedidoDto dto)
    {
        var autorId = usuarioAtual.UsuarioId
            ?? throw new UnauthorizedAccessException();
        await repo.AdicionarAsync(new Pedido { AutorId = autorId, ... });
    }
}

Notas

  • ICurrentUserProvider retorna null quando não há usuário autenticado — trate o caso.
  • A implementação concreta (CurrentUserProvider) é registrada automaticamente por AddNexttagJwtAuth.
  • Emissão de token (IJwtService) agora vive em Nexttag.Auth.Jwt (namespace Nexttag.Auth mantido).
Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Nexttag.Auth:

Package Downloads
Nexttag.Auth.Jwt

Implementação JWT: geração de tokens, leitura de cookie HttpOnly, CurrentUserProvider

Nexttag.Auth.Identity.Google

Login social com Google para ASP.NET Identity (Nexttag.Auth.Identity): valida o id_token do Google, acha-ou-cria o usuario e emite JWT local. Sem Firebase.

Nexttag.Auth.Identity

ASP.NET Identity integrado: login, registro, roles — banco local sem serviço externo

Nexttag.Auth.NextAuth

Client HTTP para NextAuth API

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 260 6/17/2026
1.0.0 248 6/7/2026

1.1.0: IJwtService movido para Nexttag.Auth.Jwt (emissao de token e mecanismo especifico, nao contrato universal). O namespace segue Nexttag.Auth — codigo consumidor nao muda, so recompila. A base agora expoe apenas ICurrentUserProvider.