KutCode.Security.Ldap.DependencyInjection 1.6.6

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

// Install KutCode.Security.Ldap.DependencyInjection as a Cake Tool
#tool nuget:?package=KutCode.Security.Ldap.DependencyInjection&version=1.6.6                

📦 KutCode.Security.Ldap.DependencyInjection

Main package for connection with KutCode.Security.Ldap.WebApi
(API microservice for LDAP auth)

See more info here

❓ Usage

After API deploy, use DependencyInjection to inject LDAP API repository.

🛠️ Configuring:

using KutCode.Security.Ldap.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

var config = builder.Configuration.GetRequiredSection("Ldap");
builder.Services
	.AddKutCodeLdapRepository(config, ServiceLifetime.Scoped);

🔍 appsettings.json example:

{
  "LdapSecurity": {
    "BaseUrl": "http://localhost:9080",
    "RpcBaseUrl": "http://localhost:11080"
  }
}

🏃‍♂️ Usage:

class Worker {
    private readonly IKutCodeLdapRepository _ldap;
    public Worker(IKutCodeLdapRepository ldap) {
        _ldap = ldap;
    }
    
    async Task AuthAsync(CancellationToken ct = default) {
        var authResponse = await _ldap.LoginAsync(default);
    }
}

✨ RPC

If you want ot use gRPC to call Ldap security API just configure WebApplication.
⚠️ Notice!
You can use the same port for gRPC only if connection is TLS secured!
That's because HTTPv2 and HTTPv1 listen on the same port requires TLS.

var builder = WebApplication.CreateBuilder(args);
// ...
var app = builder.Build();

// Just add this
app.MapKutCodeLdapRpc();
// OR you can rewrite RpcBaseUrl from appsettings
app.MapKutCodeLdapRpc("http://ldap.domain.local:9081");
	
app.Run();

And than in any place of your code use:

LdapAuthCommand command = new(login: "test", password: "test");
var response = await command.RemoteExecuteAsync();
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.6 128 10/3/2024
1.5.10 90 10/1/2024
1.5.0 848 2/26/2024
1.2.0 247 2/16/2024
1.1.0 115 2/16/2024