Skip to content

Commit

Permalink
Bug fixes to improve augmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Jul 7, 2016
1 parent 6c723e6 commit d47f381
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions LDAPCP/LDAPCP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ protected override void FillClaimValueTypes(List<string> claimValueTypes)

protected override void FillClaimsForEntity(Uri context, SPClaim entity, List<SPClaim> claims)
{
throw new NotImplementedException();
Augment(context, entity, null, claims);
}

protected override void FillClaimsForEntity(Uri context, SPClaim entity, SPClaimProviderContext claimProviderContext, List<SPClaim> claims)
Expand All @@ -1044,8 +1044,8 @@ protected override void FillClaimsForEntity(Uri context, SPClaim entity, SPClaim
/// Perform augmentation of entity supplied
/// </summary>
/// <param name="context"></param>
/// <param name="entity"></param>
/// <param name="claimProviderContext"></param>
/// <param name="entity">entity to augment</param>
/// <param name="claimProviderContext">Can be null</param>
/// <param name="claims"></param>
protected virtual void Augment(Uri context, SPClaim entity, SPClaimProviderContext claimProviderContext, List<SPClaim> claims)
{
Expand All @@ -1057,7 +1057,7 @@ protected virtual void Augment(Uri context, SPClaim entity, SPClaimProviderConte
this.Lock_Config.EnterReadLock();
try
{
LdapcpLogging.LogDebug(String.Format("[{0}] AugmentationEnabledProp: {1}.", ProviderInternalName, CurrentConfiguration.AugmentationEnabledProp.ToString()));
LdapcpLogging.LogDebug(String.Format("[{0}] Original entity to augment: '{1}', augmentation enabled: {2}.", ProviderInternalName, entity.Value, CurrentConfiguration.AugmentationEnabledProp));
if (!this.CurrentConfiguration.AugmentationEnabledProp) return;
if (String.IsNullOrEmpty(this.CurrentConfiguration.AugmentationClaimTypeProp))
{
Expand All @@ -1074,17 +1074,22 @@ protected virtual void Augment(Uri context, SPClaim entity, SPClaimProviderConte
}

SPClaim decodedEntity;
//SPClaimProviderManager cpm = SPClaimProviderManager.Local;
//if (!SPClaimProviderManager.IsEncodedClaim(entity.Value)) decodedEntity = entity;
//else decodedEntity = cpm.DecodeClaimFromFormsSuffix(entity.Value);
if (SPClaimProviderManager.IsUserIdentifierClaim(entity))
decodedEntity = SPClaimProviderManager.DecodeUserIdentifierClaim(entity);
else
decodedEntity = SPClaimProviderManager.Local.DecodeClaim(entity.Value);
{
if (SPClaimProviderManager.IsEncodedClaim(entity.Value))
decodedEntity = SPClaimProviderManager.Local.DecodeClaim(entity.Value);
else
decodedEntity = entity;
}

SPOriginalIssuerType loginType = SPOriginalIssuers.GetIssuerType(decodedEntity.OriginalIssuer);
if (loginType != SPOriginalIssuerType.TrustedProvider && loginType != SPOriginalIssuerType.ClaimProvider)
{
LdapcpLogging.LogDebug(String.Format("[{0}] Not trying to augment '{1}' because OriginalIssuer is '{2}'.", ProviderInternalName, decodedEntity.Value, decodedEntity.OriginalIssuer));
return;
}

RequestInformation infos = new RequestInformation(CurrentConfiguration, RequestType.Augmentation, ProcessedAttributes, null, decodedEntity, context, null, null, Int32.MaxValue);
DirectoryEntry[] directories = GetLDAPServers(infos);
Expand Down
2 changes: 1 addition & 1 deletion LDAPCP/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("5")]
[assembly: AssemblyFileVersion("5.1")]

0 comments on commit d47f381

Please sign in to comment.