mirror of
https://github.com/freedbygrace/ActiveDirectoryToRestApi.git
synced 2026-08-21 15:16:38 +00:00
Add option to work with ldapS on Linux
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<UserSecretsId>d52504e9-ea6e-4152-a52e-467ca002e47c</UserSecretsId>
|
<UserSecretsId>d52504e9-ea6e-4152-a52e-467ca002e47c</UserSecretsId>
|
||||||
<AssemblyVersion>$(PackageVersion)</AssemblyVersion>
|
<AssemblyVersion>$(PackageVersion)</AssemblyVersion>
|
||||||
<FileVersion>$(PackageVersion)</FileVersion>
|
<FileVersion>$(PackageVersion)</FileVersion>
|
||||||
<Version>1.0.0.3</Version>
|
<Version>1.0.0.4</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
@@ -36,11 +38,15 @@ builder.Services.AddSingleton(provider =>
|
|||||||
{
|
{
|
||||||
AuthType = AuthType.Basic
|
AuthType = AuthType.Basic
|
||||||
};
|
};
|
||||||
if (configs.UseSSL)
|
if (configs.UseSSL && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
ldapConnection.SessionOptions.SecureSocketLayer = true;
|
ldapConnection.SessionOptions.SecureSocketLayer = true;
|
||||||
ldapConnection.SessionOptions.VerifyServerCertificate = (con, cert) => true;
|
ldapConnection.SessionOptions.VerifyServerCertificate = (con, cert) => true;
|
||||||
}
|
}
|
||||||
|
if (configs.UseSSL && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
ldapConnection.SessionOptions.SecureSocketLayer = true;
|
||||||
|
}
|
||||||
ldapConnection.SessionOptions.ReferralChasing = ReferralChasingOptions.None;
|
ldapConnection.SessionOptions.ReferralChasing = ReferralChasingOptions.None;
|
||||||
ldapConnection.Bind();
|
ldapConnection.Bind();
|
||||||
return ldapConnection;
|
return ldapConnection;
|
||||||
|
|||||||
Reference in New Issue
Block a user