Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Sep 19, 2024
1 parent 80fa4bc commit e83e1e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Yvand.LDAPCPSE/Yvand.LdapClaimsProvider/LdapEntityProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,15 @@ protected string AddLdapAttributeToFilter(bool exactSearch, string input, ClaimT

protected List<LdapEntityProviderResult> QueryLDAPServers(OperationContext currentContext)
{
if (this.Settings.LdapConnections == null || this.Settings.LdapConnections.Count == 0) { return null; }
if (currentContext.LdapConnections == null || currentContext.LdapConnections.Count == 0) { return null; }
object lockResults = new object();
List<LdapEntityProviderResult> results = new List<LdapEntityProviderResult>();
Stopwatch globalStopWatch = new Stopwatch();
globalStopWatch.Start();

string ldapFilter = this.BuildFilter(currentContext.CurrentClaimTypeConfigList, currentContext.Input, currentContext.ExactSearch, null);
//foreach (var ldapConnection in this.Settings.LdapConnections.Where(x => x.LdapEntry != null))
Parallel.ForEach(this.Settings.LdapConnections.Where(x => x.LdapEntry != null), ldapConnection =>
//foreach (var ldapConnection in currentContext.LdapConnections.Where(x => x.LdapEntry != null))
Parallel.ForEach(currentContext.LdapConnections.Where(x => x.LdapEntry != null), ldapConnection =>
{
if (!String.IsNullOrWhiteSpace(ldapConnection.CustomFilter))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using Microsoft.SharePoint.Administration;
using System;
using Yvand.LdapClaimsProvider;
using Yvand.LdapClaimsProvider.Configuration;
using Yvand.LdapClaimsProvider.Logging;

namespace LDAPCPSE_basic
{
Expand All @@ -10,7 +12,7 @@ public class LDAPCPSE_Custom : LDAPCPSE
/// Sets the name of the claims provider, also set in (Get-SPTrustedIdentityTokenIssuer).ClaimProviderName property
/// </summary>
public new const string ClaimsProviderName = "LDAPCPSE_Custom";

/// <summary>
/// Do not remove or change this property
/// </summary>
Expand All @@ -31,8 +33,10 @@ public override void ValidateRuntimeSettings(OperationContext operationContext)
{
Uri currentSite = operationContext.UriContext;
string currentUser = operationContext.UserInHttpContext?.Value;
Logger.Log($"New request with input {operationContext.Input} from URL {currentSite} and user {currentUser}", TraceSeverity.High, EventSeverity.Information, TraceCategory.Custom);
if (currentSite.Port == 6000)
{
Logger.Log($"Apply custom LDAP filter \"(telephoneNumber=00110011)\"", TraceSeverity.High, EventSeverity.Information, TraceCategory.Custom);
operationContext.LdapConnections[0].CustomFilter = "(telephoneNumber=00110011)";
}
}
Expand Down

0 comments on commit e83e1e6

Please sign in to comment.