Franz.Common.Http.Identity 1.2.62

dotnet add package Franz.Common.Http.Identity --version 1.2.62                
NuGet\Install-Package Franz.Common.Http.Identity -Version 1.2.62                
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="Franz.Common.Http.Identity" Version="1.2.62" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Http.Identity --version 1.2.62                
#r "nuget: Franz.Common.Http.Identity, 1.2.62"                
#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.
// Install Franz.Common.Http.Identity as a Cake Addin
#addin nuget:?package=Franz.Common.Http.Identity&version=1.2.62

// Install Franz.Common.Http.Identity as a Cake Tool
#tool nuget:?package=Franz.Common.Http.Identity&version=1.2.62                

Franz.Common.Http.Identity

A utility library within the Franz Framework that enhances ASP.NET Core identity management for HTTP-based applications. This package provides tools for accessing and managing identity context in a consistent and efficient manner.


Features

  • Identity Context Access:
    • IdentityContextAccessor for simplified access to the current user's identity information in HTTP requests.
  • Dependency Injection:
    • ServiceCollectionExtensions for seamless integration of identity-related services.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • Microsoft.AspNetCore.Mvc.Core (2.2.5): Core MVC functionalities for identity and authentication.
  • Franz.Common.Identity: Core identity utilities and extensions.
  • Franz.Common.Http: HTTP utilities and middleware extensions.
  • Franz.Common.Headers: Header management utilities for HTTP applications.

Installation

From Private Azure Feed

Since this package is hosted privately, configure your NuGet client:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Install the package:

dotnet add package Franz.Common.Http.Identity --version 1.2.62

Usage

1. Access Identity Context

Leverage IdentityContextAccessor to access the current user's identity information:

using Franz.Common.Http.Identity;

public class MyService
{
    private readonly IdentityContextAccessor _identityContextAccessor;

    public MyService(IdentityContextAccessor identityContextAccessor)
    {
        _identityContextAccessor = identityContextAccessor;
    }

    public string GetUserId()
    {
        return _identityContextAccessor.User?.FindFirst("sub")?.Value;
    }
}

2. Register Identity Utilities

Use ServiceCollectionExtensions to register identity-related services:

using Franz.Common.Http.Identity.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddIdentityContext(); // Registers identity context utilities
    }
}

3. Use Identity Context in Controllers

Access identity data directly in controllers:

[ApiController]
[Route("api/[controller]")]
public class UserController : ControllerBase
{
    private readonly IdentityContextAccessor _identityContextAccessor;

    public UserController(IdentityContextAccessor identityContextAccessor)
    {
        _identityContextAccessor = identityContextAccessor;
    }

    [HttpGet("me")]
    public IActionResult GetCurrentUser()
    {
        var userId = _identityContextAccessor.User?.FindFirst("sub")?.Value;
        return Ok(new { UserId = userId });
    }
}

Integration with Franz Framework

The Franz.Common.Http.Identity package integrates seamlessly with:

  • Franz.Common.Identity: Provides foundational identity utilities.
  • Franz.Common.Http: Enhances HTTP functionality for identity-based applications.
  • Franz.Common.Headers: Simplifies header-based identity management.

Ensure these dependencies are installed to fully leverage the library's capabilities.


Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository.
  2. Create a feature branch.
  3. Submit a pull request for review.

License

This library is licensed under the MIT License. See the LICENSE file for more details.


Changelog

Version 1.2.62

  • Introduced IdentityContextAccessor for streamlined identity access.
  • Added ServiceCollectionExtensions for identity service registration.
  • Full compatibility with Franz.Common.Identity, Franz.Common.Http, and Franz.Common.Headers.
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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Franz.Common.Http.Identity:

Package Downloads
Franz.Common.Http.Bootstrap

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.62 31 1/8/2025