Merge pull request #17865 from abpframework/ldaps

Add `LDAP over SSL` setting.
pull/17905/head
Engincan VESKE 1 year ago committed by GitHub
commit 191ea65d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,12 +14,13 @@ public class AbpBlazorMessageLocalizerHelper<T>
this.stringLocalizer = stringLocalizer;
}
public string Localize(string message, IEnumerable<string>? arguments)
public string Localize(string message, IEnumerable<string>? arguments = null)
{
try
{
return arguments?.Count() > 0
? stringLocalizer[message, LocalizeMessageArguments(arguments)?.ToArray()!]
var argumentsList = arguments?.ToList();
return argumentsList?.Count > 0
? stringLocalizer[message, LocalizeMessageArguments(argumentsList)]
: stringLocalizer[message];
}
catch
@ -28,7 +29,7 @@ public class AbpBlazorMessageLocalizerHelper<T>
}
}
private IEnumerable<string> LocalizeMessageArguments(IEnumerable<string> arguments)
private IEnumerable<string> LocalizeMessageArguments(List<string> arguments)
{
foreach (var argument in arguments)
{

@ -4,6 +4,8 @@ namespace Volo.Abp.Ldap;
public interface ILdapSettingProvider
{
public Task<bool> GetLdapOverSsl();
public Task<string?> GetServerHostAsync();
public Task<int> GetServerPortAsync();

@ -2,6 +2,8 @@
public static class LdapSettingNames
{
public const string Ldaps = "Abp.Ldap.Ldaps";
public const string ServerHost = "Abp.Ldap.ServerHost";
public const string ServerPort = "Abp.Ldap.ServerPort";

@ -1,6 +1,8 @@
{
"culture": "ar",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP عبر SSL",
"Description:Abp.Ldap.Ldaps": "LDAP عبر SSL",
"DisplayName:Abp.Ldap.ServerHost": "اسم الخادم",
"Description:Abp.Ldap.ServerHost": "اسم الخادم",
"DisplayName:Abp.Ldap.ServerPort": "منفذ الخادم",

@ -1,6 +1,8 @@
{
"culture": "cs",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP přes SSL",
"Description:Abp.Ldap.Ldaps": "LDAP přes SSL",
"DisplayName:Abp.Ldap.ServerHost": "Hostitel serveru",
"Description:Abp.Ldap.ServerHost": "Hostitel serveru",
"DisplayName:Abp.Ldap.ServerPort": "Port serveru",

@ -1,6 +1,8 @@
{
"culture": "de-DE",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP über SSL",
"Description:Abp.Ldap.Ldaps": "LDAP über SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server-Host",
"Description:Abp.Ldap.ServerHost": "Server-Host",
"DisplayName:Abp.Ldap.ServerPort": "Server-Port",

@ -1,6 +1,8 @@
{
"culture": "el",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP μέσω SSL",
"Description:Abp.Ldap.Ldaps": "LDAP μέσω SSL",
"DisplayName:Abp.Ldap.ServerHost": "Κεντρικός διακομιστής",
"Description:Abp.Ldap.ServerHost": "Κεντρικός διακομιστής",
"DisplayName:Abp.Ldap.ServerPort": "Θύρα",

@ -1,6 +1,8 @@
{
"culture": "en-GB",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP over SSL",
"Description:Abp.Ldap.Ldaps": "LDAP over SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Server port",

@ -1,6 +1,8 @@
{
"culture": "en",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP over SSL",
"Description:Abp.Ldap.Ldaps": "LDAP over SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Server port",

@ -1,6 +1,8 @@
{
"culture": "es",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP sobre SSL",
"Description:Abp.Ldap.Ldaps": "LDAP sobre SSL",
"DisplayName:Abp.Ldap.ServerHost": "Host del servidor",
"Description:Abp.Ldap.ServerHost": "Host del servidor",
"DisplayName:Abp.Ldap.ServerPort": "Puerto del servidor",

@ -1,6 +1,8 @@
{
"culture": "fa",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP از طریق SSL",
"Description:Abp.Ldap.Ldaps": "LDAP از طریق SSL",
"DisplayName:Abp.Ldap.ServerHost": "میزبان سرور",
"Description:Abp.Ldap.ServerHost": "میزبان سرور",
"DisplayName:Abp.Ldap.ServerPort": "پورت سرور",

@ -1,6 +1,8 @@
{
"culture": "fi",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP SSL:n kautta",
"Description:Abp.Ldap.Ldaps": "LDAP SSL:n kautta",
"DisplayName:Abp.Ldap.ServerHost": "Palvelimen isäntä",
"Description:Abp.Ldap.ServerHost": "Palvelimen isäntä",
"DisplayName:Abp.Ldap.ServerPort": "Palvelimen portti",

@ -1,17 +1,19 @@
{
"culture": "fr",
"texts": {
"DisplayName:Abp.Ldap.ServerHost": "Hôte du serveur",
"Description:Abp.Ldap.ServerHost": "Hôte du serveur",
"DisplayName:Abp.Ldap.ServerPort": "Port de serveur",
"Description:Abp.Ldap.ServerPort": "Port de serveur",
"DisplayName:Abp.Ldap.BaseDc": "Composant de domaine de base",
"Description:Abp.Ldap.BaseDc": "Composant de domaine de base",
"DisplayName:Abp.Ldap.Domain": "Domaine",
"Description:Abp.Ldap.Domain": "Domaine",
"DisplayName:Abp.Ldap.UserName": "Nom d'utilisateur",
"Description:Abp.Ldap.UserName": "Nom d'utilisateur",
"DisplayName:Abp.Ldap.Password": "Mot de passe",
"Description:Abp.Ldap.Password": "Mot de passe"
"DisplayName:Abp.Ldap.Ldaps": "LDAP sur SSL",
"Description:Abp.Ldap.Ldaps": "LDAP sur SSL",
"DisplayName:Abp.Ldap.ServerHost": "Hôte du serveur",
"Description:Abp.Ldap.ServerHost": "Hôte du serveur",
"DisplayName:Abp.Ldap.ServerPort": "Port de serveur",
"Description:Abp.Ldap.ServerPort": "Port de serveur",
"DisplayName:Abp.Ldap.BaseDc": "Composant de domaine de base",
"Description:Abp.Ldap.BaseDc": "Composant de domaine de base",
"DisplayName:Abp.Ldap.Domain": "Domaine",
"Description:Abp.Ldap.Domain": "Domaine",
"DisplayName:Abp.Ldap.UserName": "Nom d'utilisateur",
"Description:Abp.Ldap.UserName": "Nom d'utilisateur",
"DisplayName:Abp.Ldap.Password": "Mot de passe",
"Description:Abp.Ldap.Password": "Mot de passe"
}
}

@ -1,6 +1,8 @@
{
"culture": "hi",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "एसएसएल पर एलडीएपी",
"Description:Abp.Ldap.Ldaps": "एसएसएल पर एलडीएपी",
"DisplayName:Abp.Ldap.ServerHost": "सर्वर होस्ट",
"Description:Abp.Ldap.ServerHost": "सर्वर होस्ट",
"DisplayName:Abp.Ldap.ServerPort": "सर्वर पोर्ट",

@ -1,6 +1,8 @@
{
"culture": "hu",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP SSL-n keresztül",
"Description:Abp.Ldap.Ldaps": "LDAP SSL-n keresztül",
"DisplayName:Abp.Ldap.ServerHost": "Szerver host",
"Description:Abp.Ldap.ServerHost": "Az LDAP ksizolgáló szerver hostneve vagy IP címe",
"DisplayName:Abp.Ldap.ServerPort": "Szerver port",

@ -1,6 +1,8 @@
{
"culture": "is",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP yfir SSL",
"Description:Abp.Ldap.Ldaps": "LDAP yfir SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Server port",

@ -1,6 +1,8 @@
{
"culture": "it",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP su SSL",
"Description:Abp.Ldap.Ldaps": "LDAP su SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Porta del server",

@ -1,6 +1,8 @@
{
"culture": "nl",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP via SSL",
"Description:Abp.Ldap.Ldaps": "LDAP via SSL",
"DisplayName:Abp.Ldap.ServerHost": "Serverhost",
"Description:Abp.Ldap.ServerHost": "Serverhost",
"DisplayName:Abp.Ldap.ServerPort": "Server poort",

@ -1,6 +1,8 @@
{
"culture": "pl-PL",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP przez SSL",
"Description:Abp.Ldap.Ldaps": "LDAP przez SSL",
"DisplayName:Abp.Ldap.ServerHost": "Host serwera",
"Description:Abp.Ldap.ServerHost": "Host serwera",
"DisplayName:Abp.Ldap.ServerPort": "Port serwera",

@ -1,6 +1,8 @@
{
"culture": "pt-BR",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP sobre SSL",
"Description:Abp.Ldap.Ldaps": "LDAP sobre SSL",
"DisplayName:Abp.Ldap.ServerHost": "Host do servidor",
"Description:Abp.Ldap.ServerHost": "Host do servidor",
"DisplayName:Abp.Ldap.ServerPort": "Porta do servidor",

@ -1,6 +1,8 @@
{
"culture": "ro-RO",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP peste SSL",
"Description:Abp.Ldap.Ldaps": "LDAP peste SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Server port",

@ -1,6 +1,8 @@
{
"culture": "ru",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP через SSL",
"Description:Abp.Ldap.Ldaps": "LDAP через SSL",
"DisplayName:Abp.Ldap.ServerHost": "Хост сервера",
"Description:Abp.Ldap.ServerHost": "Хост сервера",
"DisplayName:Abp.Ldap.ServerPort": "Порт сервера",

@ -1,6 +1,8 @@
{
"culture": "sk",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP cez SSL",
"Description:Abp.Ldap.Ldaps": "LDAP cez SSL",
"DisplayName:Abp.Ldap.ServerHost": "Server host",
"Description:Abp.Ldap.ServerHost": "Server host",
"DisplayName:Abp.Ldap.ServerPort": "Server port",

@ -1,6 +1,8 @@
{
"culture": "sl",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP preko SSL",
"Description:Abp.Ldap.Ldaps": "LDAP preko SSL",
"DisplayName:Abp.Ldap.ServerHost": "Gostitelj strežnika",
"Description:Abp.Ldap.ServerHost": "Gostitelj strežnika",
"DisplayName:Abp.Ldap.ServerPort": "Vrata strežnika",

@ -1,6 +1,8 @@
{
"culture": "tr",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "SSL üzerinden LDAP",
"Description:Abp.Ldap.Ldaps": "SSL üzerinden LDAP",
"DisplayName:Abp.Ldap.ServerHost": "Sunucu Ana Bilgisayarı",
"Description:Abp.Ldap.ServerHost": "Sunucu Ana Bilgisayarı",
"DisplayName:Abp.Ldap.ServerPort": "Sunucu portu",

@ -1,6 +1,8 @@
{
"culture": "vi",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "LDAP qua SSL",
"Description:Abp.Ldap.Ldaps": "LDAP qua SSL",
"DisplayName:Abp.Ldap.ServerHost": "Máy chủ lưu trữ",
"Description:Abp.Ldap.ServerHost": "Máy chủ lưu trữ",
"DisplayName:Abp.Ldap.ServerPort": "Cổng máy chủ",

@ -1,6 +1,8 @@
{
"culture": "zh-Hans",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "基于SSL的LDAP",
"Description:Abp.Ldap.Ldaps": "基于SSL的LDAP",
"DisplayName:Abp.Ldap.ServerHost": "服务器主机",
"Description:Abp.Ldap.ServerHost": "服务器主机",
"DisplayName:Abp.Ldap.ServerPort": "服务器端口",

@ -1,6 +1,8 @@
{
"culture": "zh-Hant",
"texts": {
"DisplayName:Abp.Ldap.Ldaps": "基於SSL的LDAP",
"Description:Abp.Ldap.Ldaps": "基於SSL的LDAP",
"DisplayName:Abp.Ldap.ServerHost": "服務器主機",
"Description:Abp.Ldap.ServerHost": "服務器主機",
"DisplayName:Abp.Ldap.ServerPort": "服務器端口",

@ -9,6 +9,12 @@ public class LdapSettingDefinitionProvider : SettingDefinitionProvider
public override void Define(ISettingDefinitionContext context)
{
context.Add(
new SettingDefinition(
LdapSettingNames.Ldaps,
"false",
L("DisplayName:Abp.Ldap.Ldaps"),
L("Description:Abp.Ldap.Ldaps")),
new SettingDefinition(
LdapSettingNames.ServerHost,
"",

@ -14,32 +14,37 @@ public class LdapSettingProvider : ILdapSettingProvider, ITransientDependency
SettingProvider = settingProvider;
}
public async Task<string?> GetServerHostAsync()
public virtual async Task<bool> GetLdapOverSsl()
{
return (await SettingProvider.GetOrNullAsync(LdapSettingNames.Ldaps))?.To<bool>() ?? default;
}
public virtual async Task<string?> GetServerHostAsync()
{
return await SettingProvider.GetOrNullAsync(LdapSettingNames.ServerHost);
}
public async Task<int> GetServerPortAsync()
public virtual async Task<int> GetServerPortAsync()
{
return (await SettingProvider.GetOrNullAsync(LdapSettingNames.ServerPort))?.To<int>() ?? default;
}
public async Task<string?> GetBaseDcAsync()
public virtual async Task<string?> GetBaseDcAsync()
{
return await SettingProvider.GetOrNullAsync(LdapSettingNames.BaseDc);
}
public async Task<string?> GetDomainAsync()
public virtual async Task<string?> GetDomainAsync()
{
return await SettingProvider.GetOrNullAsync(LdapSettingNames.Domain);
}
public async Task<string?> GetUserNameAsync()
public virtual async Task<string?> GetUserNameAsync()
{
return await SettingProvider.GetOrNullAsync(LdapSettingNames.UserName);
}
public async Task<string?> GetPasswordAsync()
public virtual async Task<string?> GetPasswordAsync()
{
return await SettingProvider.GetOrNullAsync(LdapSettingNames.Password);
}

Loading…
Cancel
Save