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
<PackageReference Include="KutCode.Security.Ldap.DependencyInjection" Version="1.6.6" />
paket add KutCode.Security.Ldap.DependencyInjection --version 1.6.6
#r "nuget: KutCode.Security.Ldap.DependencyInjection, 1.6.6"
// 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)
❓ 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 | Versions 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. |
-
net8.0
- FastEndpoints.Messaging.Remote (>= 5.30.0)
- KutCode.Security.Ldap (>= 1.6.6)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.