Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish EntraCP v26.0 #272

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change log for ~~AzureCP~~ EntraCP

## Unreleased

* Fix an NullReferenceException in a very rare scenario where ClaimsPrincipal.Identity is null
* Add helper methods to get/delete a tenant in the configuration
* Update Azure.Identity from 1.11.2 to 1.12.0
* Update Microsoft.Graph from 5.49.0 to 5.56.0

## EntraCP v25.0.20240503.33 enhancements & bug-fixes - Published in May 3, 2024

* Update the global configuration page to give the possibility to update the credentials of tenants already registered - https://github.com/Yvand/EntraCP/pull/248
Expand Down
2 changes: 1 addition & 1 deletion Yvand.EntraCP.Tests/Yvand.EntraCP.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="NUnit.Analyzers">
<Version>4.1.0</Version>
<Version>4.2.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Yvand.EntraCP/Yvand.EntraCP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@
<!-- NuGet packages -->
<ItemGroup>
<PackageReference Include="Azure.Identity">
<Version>1.11.2</Version>
<Version>1.12.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Graph">
<Version>5.49.0</Version>
<Version>5.56.0</Version>
</PackageReference>
<PackageReference Include="StrongNamer">
<Version>0.2.5</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public OperationContext(ClaimsProviderSettings settings, OperationType currentRe
if (httpctx != null)
{
WIF4_5.ClaimsPrincipal cp = httpctx.User as WIF4_5.ClaimsPrincipal;
if (cp != null)
if (cp != null && cp.Identity != null)
{
if (SPClaimProviderManager.IsEncodedClaim(cp.Identity.Name))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public bool UpdateTenantCredentials(string tenantName, string newClientSecret, s
throw new ArgumentNullException(nameof(newClientSecret));
}

EntraIDTenant tenant = this.EntraIDTenants.FirstOrDefault(x => x.Name.Equals(tenantName, StringComparison.InvariantCultureIgnoreCase));
EntraIDTenant tenant = GetTenantConfiguration(tenantName);
if (tenant == null) { return false; }
string clientId = String.IsNullOrWhiteSpace(newClientId) ? tenant.ClientId : newClientId;
return tenant.SetCredentials(clientId, newClientSecret);
Expand All @@ -426,13 +426,46 @@ public bool UpdateTenantCredentials(string tenantName, string newClientCertifica
throw new ArgumentNullException(nameof(tenantName));
}

EntraIDTenant tenant = this.EntraIDTenants.FirstOrDefault(x => x.Name.Equals(tenantName, StringComparison.InvariantCultureIgnoreCase));
EntraIDTenant tenant = GetTenantConfiguration(tenantName);
if (tenant == null) { return false; }

string clientId = String.IsNullOrWhiteSpace(newClientId) ? tenant.ClientId : newClientId;
return tenant.SetCredentials(clientId, newClientCertificatePfxFilePath, newClientCertificatePfxPassword);
}

/// <summary>
/// Gets the tenant configuration
/// </summary>
/// <param name="tenantName">Name of the tenant</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public EntraIDTenant GetTenantConfiguration(string tenantName)
{
if (String.IsNullOrWhiteSpace(tenantName))
{
throw new ArgumentNullException(nameof(tenantName));
}
return this.EntraIDTenants.FirstOrDefault(x => x.Name.Equals(tenantName, StringComparison.OrdinalIgnoreCase));
}

/// <summary>
/// Deletes the tenant configuration
/// </summary>
/// <param name="tenantName">Name of the tenant</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public bool DeleteTenantConfiguration(string tenantName)
{
if (String.IsNullOrWhiteSpace(tenantName))
{
throw new ArgumentNullException(nameof(tenantName));
}

EntraIDTenant tenant = GetTenantConfiguration(tenantName);
if (tenant == null) { return false; }
return this.EntraIDTenants.Remove(tenant);
}

/// <summary>
/// If it is valid, commits the current settings to the SharePoint settings database
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions assembly-bindings.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ The content of this file may change with each version of EntraCP, make sure to u
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral"/>
<bindingRedirect oldVersion="1.37.0.0" newVersion="1.38.0.0"/>
<bindingRedirect oldVersion="1.39.0.0" newVersion="1.40.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Kiota.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="1.7.10.0-1.7.11.0" newVersion="1.8.0.0"/>
<bindingRedirect oldVersion="1.7.10.0-1.7.11.0" newVersion="1.9.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="6.0.0.0" newVersion="6.0.0.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="6.35.0.0" newVersion="7.4.1.0"/>
<bindingRedirect oldVersion="6.35.0.0" newVersion="7.6.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
Expand Down
Loading