From e1c3b37bd100c9754c829a36d6a24db319775996 Mon Sep 17 00:00:00 2001 From: AlexFlatow Date: Wed, 15 Jan 2025 13:46:07 +1100 Subject: [PATCH 01/10] Add TenantId to the Microsoft SCIM package - Add TenantId to the Resource.cs and related classes (IResourceIdentifier.cs and IQueryParameters.cs) - Add TenantId to the IProviderAdapter.cs - Expose the TenantId in the ProviderAdapterTemplate.cs - Update to Net 7.0 --- .../Microsoft.SCIM.WebHostSample.csproj | 2 +- .../Microsoft.SCIM.csproj | 25 ++++++++++++------- .../Protocol/IQueryParameters.cs | 1 + .../Protocol/IResourceIdentifier.cs | 1 + .../Protocol/ProtocolExtensions.cs | 3 ++- .../Protocol/QueryParameters.cs | 13 +++++++++- .../Protocol/ResourceIdentifier.cs | 17 +++++++++++-- .../Protocol/ResourceRetrievalParameters.cs | 10 +++++--- .../Schemas/Resource.cs | 7 ++++++ .../Service/IProviderAdapter.cs | 2 +- .../Service/ProviderAdapterTemplate.cs | 18 +++++++++---- .../Service/RootProviderAdapter .cs | 2 +- 12 files changed, 77 insertions(+), 24 deletions(-) diff --git a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj index 15a8edcb..3ac56dcc 100644 --- a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj +++ b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net7.0 diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index aac203c9..4637ffe5 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -1,24 +1,31 @@ - netcoreapp3.1 + Microsoft SCIM + net7.0 + true + Microsoft SCIM + 1.0.1 + 1.0.1 + 1.0.1 + 1.0.1 en - - - - - + + + + + - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQueryParameters.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQueryParameters.cs index 98df52d8..7519d666 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQueryParameters.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQueryParameters.cs @@ -10,5 +10,6 @@ public interface IQueryParameters : IRetrievalParameters { IReadOnlyCollection AlternateFilters { get; } IPaginationParameters PaginationParameters { get; set; } + string TenantId { get; } } } \ No newline at end of file diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceIdentifier.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceIdentifier.cs index d0959983..d2c46a97 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceIdentifier.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceIdentifier.cs @@ -8,5 +8,6 @@ public interface IResourceIdentifier { string Identifier { get; set; } string SchemaIdentifier { get; set; } + string TenantId { get; set; } } } \ No newline at end of file diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs index 282cca9b..9510cda7 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs @@ -700,6 +700,7 @@ public static Uri ComposeResourceIdentifier( schemaIdentifier, path, resource.Identifier, + resource.TenantId, requestedAttributePaths, excludedAttributePaths); string query = retrievalParameters.ToString(); @@ -831,7 +832,7 @@ public static IResourceIdentifier GetIdentifier(this Resource resource) schemaIdentifier = resource.GetSchemaIdentifier(); } - IResourceIdentifier result = new ResourceIdentifier(schemaIdentifier, resource.Identifier); + IResourceIdentifier result = new ResourceIdentifier(schemaIdentifier, resource.Identifier, resource.TenantId); return result; } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryParameters.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryParameters.cs index d0117957..34ad5665 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryParameters.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryParameters.cs @@ -12,6 +12,7 @@ public sealed class QueryParameters : RetrievalParameters, IQueryParameters public QueryParameters( string schemaIdentifier, string path, + string tenantId, IFilter filter, IReadOnlyCollection requestedAttributePaths, IReadOnlyCollection excludedAttributePaths) @@ -22,25 +23,29 @@ public QueryParameters( throw new ArgumentNullException(nameof(filter)); } + this.TenantId = tenantId; this.AlternateFilters = filter.ToCollection(); } public QueryParameters( string schemaIdentifier, string path, + string tenantId, IReadOnlyCollection alternateFilters, IReadOnlyCollection requestedAttributePaths, IReadOnlyCollection excludedAttributePaths) : base(schemaIdentifier, path, requestedAttributePaths, excludedAttributePaths) { + this.TenantId = tenantId; this.AlternateFilters = alternateFilters ?? throw new ArgumentNullException(nameof(alternateFilters)); } public QueryParameters( string schemaIdentifier, string path, + string tenantId, IPaginationParameters paginationParameters) - : this(schemaIdentifier, path, Array.Empty(), Array.Empty(), Array.Empty()) + : this(schemaIdentifier, path, tenantId, Array.Empty(), Array.Empty(), Array.Empty()) { this.PaginationParameters = paginationParameters ?? throw new ArgumentNullException(nameof(paginationParameters)); } @@ -48,11 +53,13 @@ public QueryParameters( [Obsolete("Use QueryParameters(string, string, IFilter, IReadOnlyCollection, IReadOnlyCollection) instead")] public QueryParameters( string schemaIdentifier, + string tenantId, IFilter filter, IReadOnlyCollection requestedAttributePaths, IReadOnlyCollection excludedAttributePaths) : this( schemaIdentifier, + tenantId, new SchemaIdentifier(schemaIdentifier).FindPath(), filter, requestedAttributePaths, @@ -63,11 +70,13 @@ public QueryParameters( [Obsolete("Use QueryParameters(string, string, IReadOnlyCollection, IReadOnlyCollection, IReadOnlyCollection) instead")] public QueryParameters( string schemaIdentifier, + string tenantId, IReadOnlyCollection alternateFilters, IReadOnlyCollection requestedAttributePaths, IReadOnlyCollection excludedAttributePaths) : this( schemaIdentifier, + tenantId, new SchemaIdentifier(schemaIdentifier).FindPath(), alternateFilters, requestedAttributePaths, @@ -75,6 +84,8 @@ public QueryParameters( { } + public string TenantId { get; } + public IReadOnlyCollection AlternateFilters { get; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceIdentifier.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceIdentifier.cs index d70f197f..a00ac4c3 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceIdentifier.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceIdentifier.cs @@ -13,7 +13,7 @@ public ResourceIdentifier() { } - public ResourceIdentifier(string schemaIdentifier, string resourceIdentifier) + public ResourceIdentifier(string schemaIdentifier, string resourceIdentifier, string tenantId) { if (string.IsNullOrWhiteSpace(schemaIdentifier)) { @@ -27,8 +27,15 @@ public ResourceIdentifier(string schemaIdentifier, string resourceIdentifier) this.SchemaIdentifier = schemaIdentifier; this.Identifier = resourceIdentifier; + this.TenantId = tenantId; } + public string TenantId + { + get; + set; + } + public string Identifier { get; @@ -64,6 +71,11 @@ public override bool Equals(object obj) return false; } + if (!string.Equals(this.TenantId, otherIdentifier.TenantId, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + return true; } @@ -71,7 +83,8 @@ public override int GetHashCode() { int identifierCode = string.IsNullOrWhiteSpace(this.Identifier) ? 0 : this.Identifier.GetHashCode(StringComparison.InvariantCulture); int schemaIdentifierCode = string.IsNullOrWhiteSpace(this.SchemaIdentifier) ? 0 : this.SchemaIdentifier.GetHashCode(StringComparison.InvariantCulture); - int result = identifierCode ^ schemaIdentifierCode; + int tenantIdentifierCode = string.IsNullOrWhiteSpace(this.TenantId) ? 0 : this.TenantId.GetHashCode(StringComparison.InvariantCulture); + int result = identifierCode ^ schemaIdentifierCode ^ tenantIdentifierCode; return result; } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceRetrievalParameters.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceRetrievalParameters.cs index ae231ee8..d2f77bb8 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceRetrievalParameters.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceRetrievalParameters.cs @@ -13,6 +13,7 @@ public ResourceRetrievalParameters( string schemaIdentifier, string path, string resourceIdentifier, + string tenantId, IReadOnlyCollection requestedAttributePaths, IReadOnlyCollection excludedAttributePaths) : base(schemaIdentifier, path, requestedAttributePaths, excludedAttributePaths) @@ -26,14 +27,16 @@ public ResourceRetrievalParameters( new ResourceIdentifier() { Identifier = resourceIdentifier, - SchemaIdentifier = this.SchemaIdentifier + SchemaIdentifier = this.SchemaIdentifier, + TenantId = tenantId }; } public ResourceRetrievalParameters( string schemaIdentifier, string path, - string resourceIdentifier) + string resourceIdentifier, + string tenantId) : base(schemaIdentifier, path) { if (null == resourceIdentifier) @@ -45,7 +48,8 @@ public ResourceRetrievalParameters( new ResourceIdentifier() { Identifier = resourceIdentifier, - SchemaIdentifier = this.SchemaIdentifier + SchemaIdentifier = this.SchemaIdentifier, + TenantId = tenantId }; } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Resource.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Resource.cs index 0847e69c..4c3afa6e 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Resource.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Resource.cs @@ -10,6 +10,13 @@ namespace Microsoft.SCIM [DataContract] public abstract class Resource : Schematized { + public virtual string TenantId + { + get; + set; + } + + [DataMember(Name = AttributeNames.ExternalIdentifier, IsRequired = false, EmitDefaultValue = false)] public string ExternalIdentifier { diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProviderAdapter.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProviderAdapter.cs index 3f835ad2..19b83602 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProviderAdapter.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProviderAdapter.cs @@ -9,7 +9,7 @@ namespace Microsoft.SCIM public interface IProviderAdapter where T : Resource { string SchemaIdentifier { get; } - + string GetTenantId(HttpRequestMessage message); Task Create(HttpRequestMessage request, Resource resource, string correlationIdentifier); Task Delete(HttpRequestMessage request, string identifier, string correlationIdentifier); Task Query( diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/ProviderAdapterTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/ProviderAdapterTemplate.cs index 2a70f2b3..66243e16 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/ProviderAdapterTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/ProviderAdapterTemplate.cs @@ -22,6 +22,8 @@ public IProvider Provider public abstract string SchemaIdentifier { get; } + public virtual string GetTenantId(HttpRequestMessage message) => string.Empty; + public virtual async Task Create(HttpRequestMessage request, Resource resource, string correlationIdentifier) { if (null == request) @@ -39,13 +41,14 @@ public virtual async Task Create(HttpRequestMessage request, Resource throw new ArgumentNullException(nameof(correlationIdentifier)); } + resource.TenantId = GetTenantId(request); IReadOnlyCollection extensions = this.ReadExtensions(); IRequest creationRequest = new CreationRequest(request, resource, correlationIdentifier, extensions); Resource result = await this.Provider.CreateAsync(creationRequest).ConfigureAwait(false); return result; } - public virtual IResourceIdentifier CreateResourceIdentifier(string identifier) + public virtual IResourceIdentifier CreateResourceIdentifier(HttpRequestMessage message, string identifier) { if (string.IsNullOrWhiteSpace(identifier)) { @@ -56,7 +59,8 @@ public virtual IResourceIdentifier CreateResourceIdentifier(string identifier) new ResourceIdentifier() { Identifier = identifier, - SchemaIdentifier = this.SchemaIdentifier + SchemaIdentifier = this.SchemaIdentifier, + TenantId = GetTenantId(message) }; return result; } @@ -79,7 +83,7 @@ public virtual async Task Delete(HttpRequestMessage request, string identifier, } IReadOnlyCollection extensions = this.ReadExtensions(); - IResourceIdentifier resourceIdentifier = this.CreateResourceIdentifier(identifier); + IResourceIdentifier resourceIdentifier = this.CreateResourceIdentifier(request, identifier); IRequest deletionRequest = new DeletionRequest(request, resourceIdentifier, correlationIdentifier, extensions); await this.Provider.DeleteAsync(deletionRequest).ConfigureAwait(false); @@ -126,8 +130,9 @@ public virtual async Task Query( } string path = this.GetPath(request); + string tenantId = GetTenantId(request); IQueryParameters queryParameters = - new QueryParameters(this.SchemaIdentifier, path, filters, requestedAttributePaths, excludedAttributePaths); + new QueryParameters(this.SchemaIdentifier, path, tenantId, filters, requestedAttributePaths, excludedAttributePaths); queryParameters.PaginationParameters = paginationParameters; IReadOnlyCollection extensions = this.ReadExtensions(); IRequest queryRequest = @@ -171,6 +176,7 @@ public virtual async Task Replace( throw new ArgumentNullException(nameof(correlationIdentifier)); } + resource.TenantId = GetTenantId(request); IReadOnlyCollection extensions = this.ReadExtensions(); IRequest replaceRequest = new ReplaceRequest(request, resource, correlationIdentifier, extensions); Resource result = await this.Provider.ReplaceAsync(replaceRequest).ConfigureAwait(false); @@ -205,11 +211,13 @@ public virtual async Task Retrieve( } string path = this.GetPath(request); + string tenantId = this.GetTenantId(request); IResourceRetrievalParameters retrievalParameters = new ResourceRetrievalParameters( this.SchemaIdentifier, path, identifier, + tenantId, requestedAttributePaths, excludedAttributePaths); IReadOnlyCollection extensions = this.ReadExtensions(); @@ -235,7 +243,7 @@ public virtual async Task Update( throw new ArgumentNullException(nameof(correlationIdentifier)); } - IResourceIdentifier resourceIdentifier = this.CreateResourceIdentifier(identifier); + IResourceIdentifier resourceIdentifier = this.CreateResourceIdentifier(request, identifier); IPatch patch = new Patch { diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs index d7d6cde3..3a0b72a0 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs @@ -31,7 +31,7 @@ public override Task Create( throw new HttpResponseException(HttpStatusCode.NotImplemented); } - public override IResourceIdentifier CreateResourceIdentifier(string identifier) + public override IResourceIdentifier CreateResourceIdentifier(HttpRequestMessage message, string identifier) { throw new HttpResponseException(HttpStatusCode.NotImplemented); } From c64b71175cbd9054bb9e554b61c44dd122217417 Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:47:41 +1100 Subject: [PATCH 02/10] Add in extra features to support SCIM validation operations (#2) - Add Contains and StartsWith to the ComparisonOperator.cs and implement in the FilterExpression.cs - Add userType to the Core2EnterpriseUserExtensions.cs - Expose some of the framework to allow for better external inheritance --- .../Protocol/Core2EnterpriseUserExtensions.cs | 48 +++++++++++++++++++ .../Protocol/FilterExpression.cs | 8 +++- .../Schemas/ComparisonOperator.cs | 4 +- .../Service/Controllers/ControllerTemplate.cs | 8 ++-- 4 files changed, 62 insertions(+), 6 deletions(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Core2EnterpriseUserExtensions.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Core2EnterpriseUserExtensions.cs index 69cdaab5..ed80314e 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Core2EnterpriseUserExtensions.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Core2EnterpriseUserExtensions.cs @@ -267,6 +267,31 @@ private static void Apply(this Core2EnterpriseUser user, PatchOperation2 operati user.UserName = value.Value; } break; + + case AttributeNames.UserType: + value = operation.Value.SingleOrDefault(); + + if (OperationName.Remove == operation.Name) + { + if ((null == value) || string.Equals(user.UserType, value.Value, StringComparison.OrdinalIgnoreCase)) + { + value = null; + } + else + { + break; + } + } + + if (null == value) + { + user.UserType = null; + } + else + { + user.UserType = value.Value; + } + break; } } @@ -813,6 +838,27 @@ private static void PatchName(this Core2EnterpriseUser user, PatchOperation2 ope name.FamilyName = value; } + if + ( + string.Equals( + Microsoft.SCIM.AttributeNames.Formatted, + operation.Path.ValuePath.AttributePath, + StringComparison.OrdinalIgnoreCase) + ) + { + value = operation.Value?.Single().Value; + if + ( + value != null + && OperationName.Remove == operation.Name + && string.Equals(value, name.FamilyName, StringComparison.OrdinalIgnoreCase) + ) + { + value = null; + } + name.Formatted = value; + } + if (string.IsNullOrWhiteSpace(name.FamilyName) && string.IsNullOrWhiteSpace(name.GivenName)) { if (nameExisting != null) @@ -961,6 +1007,8 @@ private static void PatchPhoneNumbers(this Core2EnterpriseUser user, PatchOperat { value = null; } + + phoneNumber ??= new PhoneNumber(); phoneNumber.Value = value; if (string.IsNullOrWhiteSpace(phoneNumber.Value)) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/FilterExpression.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/FilterExpression.cs index c01c685b..6d0b76fc 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/FilterExpression.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/FilterExpression.cs @@ -33,7 +33,7 @@ namespace Microsoft.SCIM // The clause, a eq 1 is one group, // the first pair of bracketed clauses are in a second group, // and the second pair of bracketed clauses are in a third group. - internal sealed class FilterExpression : IFilterExpression + public sealed class FilterExpression : IFilterExpression { private const char BracketClose = ')'; private const char Escape = '\\'; @@ -271,6 +271,9 @@ private ComparisonOperatorValue Operator case ComparisonOperatorValue.bitAnd: this.filterOperator = ComparisonOperator.BitAnd; break; + case ComparisonOperatorValue.sw: + this.filterOperator = ComparisonOperator.StartsWith; + break; case ComparisonOperatorValue.ew: this.filterOperator = ComparisonOperator.EndsWith; break; @@ -289,6 +292,9 @@ private ComparisonOperatorValue Operator case ComparisonOperatorValue.lt: this.filterOperator = ComparisonOperator.LessThan; break; + case ComparisonOperatorValue.co: + this.filterOperator = ComparisonOperator.Contains; + break; case ComparisonOperatorValue.includes: this.filterOperator = ComparisonOperator.Includes; break; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ComparisonOperator.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ComparisonOperator.cs index ff2a993a..62c2aa0b 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ComparisonOperator.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ComparisonOperator.cs @@ -18,6 +18,8 @@ public enum ComparisonOperator MatchesExpression, NotBitAnd, NotEquals, - NotMatchesExpression + NotMatchesExpression, + Contains, + StartsWith } } \ No newline at end of file diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs index 9a656267..07884ef7 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs @@ -18,10 +18,10 @@ public abstract class ControllerTemplate : ControllerBase private const string HeaderKeyContentType = "Content-Type"; private const string HeaderKeyLocation = "Location"; - internal readonly IMonitor monitor; - internal readonly IProvider provider; + private readonly IMonitor monitor; + protected readonly IProvider provider; - internal ControllerTemplate(IProvider provider, IMonitor monitor) + protected ControllerTemplate(IProvider provider, IMonitor monitor) { this.monitor = monitor; this.provider = provider; @@ -77,7 +77,7 @@ protected virtual bool TryGetMonitor(out IMonitor monitor) public abstract class ControllerTemplate : ControllerTemplate where T : Resource { - internal ControllerTemplate(IProvider provider, IMonitor monitor) + protected ControllerTemplate(IProvider provider, IMonitor monitor) : base(provider, monitor) { } From 45162e1ab41986ee8713d2439025439dbe5bd43b Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Fri, 24 Jan 2025 09:24:31 +1100 Subject: [PATCH 03/10] Update Version tp 1.0.2 (#3) --- .../Microsoft.SCIM.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index 4637ffe5..9bc4ea37 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -5,10 +5,10 @@ net7.0 true Microsoft SCIM - 1.0.1 - 1.0.1 - 1.0.1 - 1.0.1 + 1.0.2 + 1.0.2 + 1.0.2 + 1.0.2 en From 6c189054266ca92115b6aa3996fcf4f3e78b49e5 Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:05:26 +1100 Subject: [PATCH 04/10] Fix the serialization to better handle Dates and Collections (#4) - Update the JsonFactory.cs and TrustedJsonFactory.cs to use Json Date formatting - Update the SchematizedJsonDeserializingFactory.cs to correctly get items from the JArray and assume as the default data type - Return better errors from the ControllerTemplate.cs - Update the NuGet version --- .../Microsoft.SCIM.csproj | 8 ++--- .../SchematizedJsonDeserializingFactory.cs | 11 ++++++- .../Schemas/JsonFactory.cs | 24 +++++++++----- .../Schemas/TrustedJsonFactory.cs | 31 ++++++++++++++----- .../Service/Controllers/ControllerTemplate.cs | 4 +-- 5 files changed, 55 insertions(+), 23 deletions(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index 9bc4ea37..e658c3ff 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -5,10 +5,10 @@ net7.0 true Microsoft SCIM - 1.0.2 - 1.0.2 - 1.0.2 - 1.0.2 + 1.0.3 + 1.0.3 + 1.0.3 + 1.0.3 en diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactory.cs index 68c226cd..90ca6025 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactory.cs @@ -2,6 +2,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ +using Newtonsoft.Json.Linq; + namespace Microsoft.SCIM { using System; @@ -161,7 +163,14 @@ public override Schematized Create(IReadOnlyDictionary json) switch (value) { case IEnumerable schemas: - schemaIdentifiers = schemas.ToCollection(); + try + { + schemaIdentifiers = ((JArray)schemas).Values().ToCollection(); + } + catch(ArgumentException) + { + schemaIdentifiers = schemas.ToCollection(); + } break; default: throw new ArgumentException( diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonFactory.cs index 3e70c072..15be6030 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonFactory.cs @@ -99,40 +99,48 @@ private static JsonFactory InitializeFactory() private class Implementation : JsonFactory { + /// + /// The default DateParseHandling results in a non-JSON compliant string as the date, DateParseHandling.None forces the + /// correct JSON date format. + /// + private static readonly JsonSerializerSettings JsonSerializerSettings = new() { DateParseHandling = DateParseHandling.None }; + public override Dictionary Create(string json) { try { - Dictionary result = - JsonConvert.DeserializeObject>(json); - return result; + return JsonConvert.DeserializeObject>(json, JsonSerializerSettings); } - finally + catch (InvalidCastException) { + var result = + (Dictionary)JsonConvert.DeserializeObject( + json, JsonSerializerSettings); + return result; } } public override string Create(string[] json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(Dictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(IDictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(IReadOnlyDictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TrustedJsonFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TrustedJsonFactory.cs index 6f879798..3bdb99e5 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TrustedJsonFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TrustedJsonFactory.cs @@ -2,6 +2,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ +using System; + namespace Microsoft.SCIM { using System.Collections.Generic; @@ -9,35 +11,48 @@ namespace Microsoft.SCIM public class TrustedJsonFactory : JsonFactory { + /// + /// The default DateParseHandling results in a non-JSON compliant string as the date, DateParseHandling.None forces the + /// correct JSON date format. + /// + private static readonly JsonSerializerSettings JsonSerializerSettings = new() { DateParseHandling = DateParseHandling.None }; + public override Dictionary Create(string json) { - Dictionary result = - (Dictionary)JsonConvert.DeserializeObject( - json); - return result; + try + { + return JsonConvert.DeserializeObject>(json, JsonSerializerSettings); + } + catch (InvalidCastException) + { + var result = + (Dictionary)JsonConvert.DeserializeObject( + json, JsonSerializerSettings); + return result; + } } public override string Create(string[] json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(Dictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(IDictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } public override string Create(IReadOnlyDictionary json) { - string result = JsonConvert.SerializeObject(json); + string result = JsonConvert.SerializeObject(json, JsonSerializerSettings); return result; } } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs index 07884ef7..8a7c1925 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs @@ -551,7 +551,7 @@ public virtual async Task Patch(string identifier, [FromBody]Patc monitor.Report(notification); } - throw; + return this.ScimError(HttpStatusCode.BadRequest, exception.Message); } } @@ -649,7 +649,7 @@ public virtual async Task> Post([FromBody]T resource) monitor.Report(notification); } - throw; + return this.ScimError(HttpStatusCode.BadRequest, exception.Message); } } From 1c123a61820d69464bcb3f855165b9a5954dc6ab Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Fri, 7 Feb 2025 12:15:49 +1100 Subject: [PATCH 05/10] Fix an issue with the DataContractSerializer not being able to handle Boolean as "True" (#5) - Update the JsonDeserializingFactory.cs with a ParseJson() function that updates "True" to "true" for all JProperties - Update the NuGet version --- .../Microsoft.SCIM.csproj | 8 ++-- .../Schemas/JsonDeserializingFactory.cs | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index e658c3ff..dd732596 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -5,10 +5,10 @@ net7.0 true Microsoft SCIM - 1.0.3 - 1.0.3 - 1.0.3 - 1.0.3 + 1.0.4 + 1.0.4 + 1.0.4 + 1.0.4 en diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs index 39972496..61120274 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs @@ -2,6 +2,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ +using Newtonsoft.Json.Linq; + namespace Microsoft.SCIM { using System; @@ -110,6 +112,44 @@ public virtual TDataContract Create(string json) TDataContract result = this.Create(keyedValues); return result; } + + private static void ParseJsonValue(object jsonValue) + { + if (jsonValue is JProperty jProperty) + { + // HACK: The DataContractSerializer cannot The value 'True' cannot be parsed as the type 'Boolean' + if (jProperty.Value.ToString() == "True") + jProperty.Value = "true"; + + if (jProperty.Value.ToString() == "False") + jProperty.Value = "false"; + } + if (jsonValue is JObject jObject) + { + foreach (var jProp in jObject.Properties()) + { + ParseJsonValue(jProp); + } + } + if (jsonValue is JArray jArray) + { + foreach (var jToken in jArray) + { + ParseJsonValue(jToken); + } + } + } + + private static void ParseJson(IReadOnlyDictionary json) + { + if (json == null) + return; + + foreach (var jsonKvp in json) + { + ParseJsonValue(jsonKvp.Value); + } + } public IReadOnlyDictionary Normalize(IReadOnlyDictionary json) { @@ -118,6 +158,8 @@ public IReadOnlyDictionary Normalize(IReadOnlyDictionary result = this.JsonNormalizer.Normalize(json); return result; } From b5195ed5f0bac2b837f2889020d16c2f0054adea Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Wed, 10 Dec 2025 22:27:52 -0800 Subject: [PATCH 06/10] Ensure the date format is ISO 8601 as per the SCIM format (#6) - Update the JsonDeserializingFactory.cs and JsonSerializer.cs to set the DateTimeFormat to DateTimeFormat("O") - Update projects to net90 - Add tests project --- .../Microsoft.SCIM.WebHostSample.csproj | 2 +- Microsoft.SCIM.sln | 6 +++++ ...rpriseUserJsonDeserializingFactoryTests.cs | 16 ++++++++++++ ...CrossDomainIdentityManagement.Tests.csproj | 25 +++++++++++++++++++ .../Microsoft.SCIM.csproj | 10 ++++---- .../Schemas/JsonDeserializingFactory.cs | 7 +----- .../Schemas/JsonSerializer.cs | 15 ++++++----- 7 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 Microsoft.SystemForCrossDomainIdentityManagement.Tests/Core2EnterpriseUserJsonDeserializingFactoryTests.cs create mode 100644 Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj diff --git a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj index 3ac56dcc..60b4500f 100644 --- a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj +++ b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj @@ -1,7 +1,7 @@  - net7.0 + net9.0 diff --git a/Microsoft.SCIM.sln b/Microsoft.SCIM.sln index fff9b0ca..07a80f2d 100644 --- a/Microsoft.SCIM.sln +++ b/Microsoft.SCIM.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SCIM", "Microsoft EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SCIM.WebHostSample", "Microsoft.SCIM.WebHostSample\Microsoft.SCIM.WebHostSample.csproj", "{238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.SystemForCrossDomainIdentityManagement.Tests", "Microsoft.SystemForCrossDomainIdentityManagement.Tests\Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj", "{B1D7B263-EA5B-4F7A-B5F3-3A697DA6BD56}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Release|Any CPU.Build.0 = Release|Any CPU + {B1D7B263-EA5B-4F7A-B5F3-3A697DA6BD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1D7B263-EA5B-4F7A-B5F3-3A697DA6BD56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1D7B263-EA5B-4F7A-B5F3-3A697DA6BD56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1D7B263-EA5B-4F7A-B5F3-3A697DA6BD56}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Core2EnterpriseUserJsonDeserializingFactoryTests.cs b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Core2EnterpriseUserJsonDeserializingFactoryTests.cs new file mode 100644 index 00000000..63d2bf42 --- /dev/null +++ b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Core2EnterpriseUserJsonDeserializingFactoryTests.cs @@ -0,0 +1,16 @@ +using Microsoft.SCIM; + +namespace Microsoft.SystemForCrossDomainIdentityManagement.Tests; + +public class Core2EnterpriseUserJsonDeserializingFactoryTests +{ + private const string Core2EnterpriseUserString = "{\n \"active\" : true,\n \"displayName\" : \"test user1\",\n \"emails\" : [ {\n \"type\" : \"work\",\n \"primary\" : true,\n \"value\" : \"test.user1@somedomain.com\"\n } ],\n \"locale\" : \"en-US\",\n \"meta\" : {\n \"resourceType\" : null,\n \"created\" : \"2025-12-10T22:52:06.4081651\",\n \"lastModified\" : \"2025-12-10T22:52:06.4439685\",\n \"version\" : null,\n \"location\" : \"\"\n },\n \"name\" : {\n \"familyName\" : \"user123\",\n \"givenName\" : \"test\"\n },\n \"userName\" : \"test.user1@somedomain.com\",\n \"externalId\" : \"00uy542fqumJzNFq2697\",\n \"id\" : \"z4dl6zdheglurdnuc4mwn54kcq@somedomain.local\",\n \"schemas\" : [ \"urn:ietf:params:scim:schemas:core:2.0:User\" ],\n \"groups\" : [ ]\n}"; + + [Fact] + public void Create() + { + var core2EnterpriseUserJsonDeserializingFactory = new Core2EnterpriseUserJsonDeserializingFactory(); + var core2EnterpriseUser = core2EnterpriseUserJsonDeserializingFactory.Create(Core2EnterpriseUserString); + Assert.NotNull(core2EnterpriseUser); + } +} \ No newline at end of file diff --git a/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj new file mode 100644 index 00000000..37bf6cff --- /dev/null +++ b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj @@ -0,0 +1,25 @@ + + + + net9.0 + enable + enable + false + + + + + + + + + + + + + + + + + + diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index dd732596..91da9fb8 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -2,13 +2,13 @@ Microsoft SCIM - net7.0 + net9.0 true Microsoft SCIM - 1.0.4 - 1.0.4 - 1.0.4 - 1.0.4 + 1.0.5 + 1.0.5 + 1.0.5 + 1.0.5 en diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs index 61120274..315c977a 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonDeserializingFactory.cs @@ -16,12 +16,7 @@ namespace Microsoft.SCIM public abstract class JsonDeserializingFactory : IJsonNormalizationBehavior { private static readonly Lazy JsonSerializerSettings = - new Lazy( - () => - new DataContractJsonSerializerSettings() - { - EmitTypeInformation = EmitTypeInformation.Never - }); + new Lazy(SCIM.JsonSerializer.GetDataContractJsonSerializerSettings); private static readonly Lazy JsonSerializer = new Lazy( diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonSerializer.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonSerializer.cs index 21511ddf..0ea6705b 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonSerializer.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonSerializer.cs @@ -12,13 +12,16 @@ namespace Microsoft.SCIM internal class JsonSerializer : IJsonSerializable { + public static DataContractJsonSerializerSettings GetDataContractJsonSerializerSettings() + => new () + { + EmitTypeInformation = EmitTypeInformation.Never, + // SCIM uses the ISO 8601 which is the round trip - https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings#Roundtrip + DateTimeFormat = new DateTimeFormat("O") + }; + private static readonly Lazy SerializerSettings = - new Lazy( - () => - new DataContractJsonSerializerSettings() - { - EmitTypeInformation = EmitTypeInformation.Never - }); + new Lazy(GetDataContractJsonSerializerSettings); private readonly object dataContractValue; From 43c729a2c8b1ff5d52676e1e19fdb4312ab152c4 Mon Sep 17 00:00:00 2001 From: Jahmai Lay Date: Mon, 25 May 2026 16:13:31 +1000 Subject: [PATCH 07/10] CA-11833: Upgrade SCIMReferenceCode to .NET 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Target all projects to net10.0 - Remove abandoned WebApiCompatShim and other packages superseded by Microsoft.AspNetCore.App FrameworkReference - Add drop-in HttpResponseException to replace Web API 2 type from compat shim - Rewrite ConvertRequest() using HttpContext.Request directly - Remove MediaTypeFormatter inheritance from SchematizedMediaTypeFormatter - Replace ObjectContent/JsonMediaTypeFormatter with StringContent in ProtocolExtensions - Migrate [FromUri] to [FromQuery] - Bump System.IdentityModel.Tokens.Jwt 6.25.1 → 8.18.0 (GHSA-59j7-ghrg-fj52) - Bump Microsoft.AspNetCore.Authentication.JwtBearer to 10.0.8 - Version bump to 1.0.6 Co-Authored-By: Claude Sonnet 4.6 --- .../Microsoft.SCIM.WebHostSample.csproj | 6 ++- .../Provider/InMemoryGroupProvider.cs | 1 - .../Provider/InMemoryUserProvider.cs | 1 - ...CrossDomainIdentityManagement.Tests.csproj | 2 +- .../Microsoft.SCIM.csproj | 28 +++++-------- .../Protocol/ProtocolExtensions.cs | 41 ++++++++----------- .../Controllers/BulkRequestController.cs | 1 - .../Service/Controllers/ControllerTemplate.cs | 17 ++++---- .../Controllers/ResourceTypesController.cs | 1 - .../Service/Controllers/SchemasController.cs | 1 - .../ServiceProviderConfigurationController.cs | 1 - .../Service/HttpResponseException.cs | 25 +++++++++++ .../Service/HttpResponseExceptionFactory.cs | 1 - .../Service/IProvider.cs | 1 - .../Service/RequestExtensions.cs | 1 - .../Service/ResourceQuery.cs | 1 - .../Service/RootProviderAdapter .cs | 1 - .../Service/SampleProvider.cs | 1 - .../Service/SchematizedMediaTypeFormatter.cs | 30 +++++++------- 19 files changed, 81 insertions(+), 80 deletions(-) create mode 100644 Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseException.cs diff --git a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj index 60b4500f..7bb68a2e 100644 --- a/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj +++ b/Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj @@ -1,9 +1,13 @@  - net9.0 + net10.0 + + + + diff --git a/Microsoft.SCIM.WebHostSample/Provider/InMemoryGroupProvider.cs b/Microsoft.SCIM.WebHostSample/Provider/InMemoryGroupProvider.cs index 6dba20a8..4aec0b3d 100644 --- a/Microsoft.SCIM.WebHostSample/Provider/InMemoryGroupProvider.cs +++ b/Microsoft.SCIM.WebHostSample/Provider/InMemoryGroupProvider.cs @@ -8,7 +8,6 @@ namespace Microsoft.SCIM.WebHostSample.Provider using System.Linq.Expressions; using System.Net; using System.Threading.Tasks; - using System.Web.Http; using Microsoft.SCIM; public class InMemoryGroupProvider : ProviderBase diff --git a/Microsoft.SCIM.WebHostSample/Provider/InMemoryUserProvider.cs b/Microsoft.SCIM.WebHostSample/Provider/InMemoryUserProvider.cs index 8fad98d8..a6c23b53 100644 --- a/Microsoft.SCIM.WebHostSample/Provider/InMemoryUserProvider.cs +++ b/Microsoft.SCIM.WebHostSample/Provider/InMemoryUserProvider.cs @@ -8,7 +8,6 @@ namespace Microsoft.SCIM.WebHostSample.Provider using System.Linq.Expressions; using System.Net; using System.Threading.Tasks; - using System.Web.Http; using Microsoft.SCIM; public class InMemoryUserProvider : ProviderBase diff --git a/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj index 37bf6cff..ac16e962 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement.Tests/Microsoft.SystemForCrossDomainIdentityManagement.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable false diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index 91da9fb8..b73dc091 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -2,34 +2,26 @@ Microsoft SCIM - net9.0 + net10.0 true Microsoft SCIM - 1.0.5 - 1.0.5 - 1.0.5 - 1.0.5 + 1.0.6 + 1.0.6 + 1.0.6 + 1.0.6 en + + + + - - - - - + - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs index 9510cda7..6b71c265 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs @@ -11,7 +11,6 @@ namespace Microsoft.SCIM using System.IO; using System.Linq; using System.Net.Http; - using System.Net.Http.Formatting; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -444,12 +443,10 @@ public static HttpRequestMessage ComposePatchRequest( { string contentType = MediaTypes.Protocol; - MediaTypeFormatter contentFormatter = new JsonMediaTypeFormatter(); - requestContent = - new ObjectContent>( - json, - contentFormatter, - contentType); + requestContent = new StringContent( + JsonConvert.SerializeObject(json), + Encoding.UTF8, + contentType); result = new HttpRequestMessage(ProtocolExtensions.PatchMethod, resourceIdentifier); result.Content = requestContent; requestContent = null; @@ -499,12 +496,10 @@ public static HttpRequestMessage ComposePatchRequest( HttpContent requestContent = null; try { - MediaTypeFormatter contentFormatter = new JsonMediaTypeFormatter(); - requestContent = - new ObjectContent>( - json, - contentFormatter, - MediaTypes.Json); + requestContent = new StringContent( + JsonConvert.SerializeObject(json), + Encoding.UTF8, + MediaTypes.Json); result = new HttpRequestMessage(ProtocolExtensions.PatchMethod, resourceIdentifier); result.Content = requestContent; requestContent = null; @@ -555,12 +550,10 @@ public static HttpRequestMessage ComposePutRequest(this Resource resource, Uri b HttpContent requestContent = null; try { - MediaTypeFormatter contentFormatter = new JsonMediaTypeFormatter(); - requestContent = - new ObjectContent>( - json, - contentFormatter, - contentType); + requestContent = new StringContent( + JsonConvert.SerializeObject(json), + Encoding.UTF8, + contentType); result = new HttpRequestMessage(HttpMethod.Put, resourceIdentifier); result.Content = requestContent; requestContent = null; @@ -611,12 +604,10 @@ public static HttpRequestMessage ComposePostRequest(this Resource resource, Uri HttpContent requestContent = null; try { - MediaTypeFormatter contentFormatter = new JsonMediaTypeFormatter(); - requestContent = - new ObjectContent>( - json, - contentFormatter, - contentType); + requestContent = new StringContent( + JsonConvert.SerializeObject(json), + Encoding.UTF8, + contentType); result = new HttpRequestMessage(HttpMethod.Post, typeResourceIdentifier); result.Content = requestContent; requestContent = null; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/BulkRequestController.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/BulkRequestController.cs index 39481f64..2c1ba4bb 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/BulkRequestController.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/BulkRequestController.cs @@ -11,7 +11,6 @@ namespace Microsoft.SCIM using System.Net; using System.Net.Http; using System.Threading.Tasks; - using System.Web.Http; [Route(ServiceConstants.RouteBulk)] [Authorize] diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs index 8a7c1925..14f25dd0 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs @@ -8,9 +8,7 @@ namespace Microsoft.SCIM using System.Net; using System.Net.Http; using System.Threading.Tasks; - using System.Web.Http; using Microsoft.AspNetCore.Mvc; - using Microsoft.AspNetCore.Mvc.WebApiCompatShim; public abstract class ControllerTemplate : ControllerBase { @@ -39,7 +37,7 @@ protected virtual void ConfigureResponse(Resource resource) if (!this.Response.Headers.ContainsKey(ControllerTemplate.HeaderKeyContentType)) { - this.Response.Headers.Add(ControllerTemplate.HeaderKeyContentType, ProtocolConstants.ContentType); + this.Response.Headers[ControllerTemplate.HeaderKeyContentType] = ProtocolConstants.ContentType; } Uri baseResourceIdentifier = this.ConvertRequest().GetBaseResourceIdentifier(); @@ -47,14 +45,19 @@ protected virtual void ConfigureResponse(Resource resource) string resourceLocation = resourceIdentifier.AbsoluteUri; if (!this.Response.Headers.ContainsKey(ControllerTemplate.HeaderKeyLocation)) { - this.Response.Headers.Add(ControllerTemplate.HeaderKeyLocation, resourceLocation); + this.Response.Headers[ControllerTemplate.HeaderKeyLocation] = resourceLocation; } } protected HttpRequestMessage ConvertRequest() { - HttpRequestMessageFeature hreqmf = new HttpRequestMessageFeature(this.HttpContext); - HttpRequestMessage result = hreqmf.HttpRequestMessage; + var req = this.HttpContext.Request; + var uri = new Uri($"{req.Scheme}://{req.Host}{req.Path}{req.QueryString}"); + var result = new HttpRequestMessage(new HttpMethod(req.Method), uri); + foreach (var header in req.Headers) + { + result.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); + } return result; } @@ -284,7 +287,7 @@ await provider [HttpGet(ControllerTemplate.AttributeValueIdentifier)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "The names of the methods of a controller must correspond to the names of hypertext markup verbs")] - public virtual async Task Get([FromUri]string identifier) + public virtual async Task Get([FromQuery]string identifier) { string correlationIdentifier = null; try diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ResourceTypesController.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ResourceTypesController.cs index ed5aa50a..9487ac31 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ResourceTypesController.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ResourceTypesController.cs @@ -6,7 +6,6 @@ namespace Microsoft.SCIM using System.Collections.Generic; using System.Net; using System.Net.Http; - using System.Web.Http; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/SchemasController.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/SchemasController.cs index 811784ec..eec49591 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/SchemasController.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/SchemasController.cs @@ -6,7 +6,6 @@ namespace Microsoft.SCIM using System.Collections.Generic; using System.Net; using System.Net.Http; - using System.Web.Http; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ServiceProviderConfigurationController.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ServiceProviderConfigurationController.cs index eb803f24..ec6fc7ea 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ServiceProviderConfigurationController.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ServiceProviderConfigurationController.cs @@ -5,7 +5,6 @@ namespace Microsoft.SCIM using System; using System.Net; using System.Net.Http; - using System.Web.Http; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseException.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseException.cs new file mode 100644 index 00000000..4bf2cdea --- /dev/null +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseException.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation.// Licensed under the MIT license. + +namespace Microsoft.SCIM +{ + using System; + using System.Net; + using System.Net.Http; + + public class HttpResponseException : Exception + { + public HttpResponseException(HttpStatusCode statusCode) + : base(statusCode.ToString()) + { + Response = new HttpResponseMessage(statusCode); + } + + public HttpResponseException(HttpResponseMessage response) + : base(response?.StatusCode.ToString()) + { + Response = response; + } + + public HttpResponseMessage Response { get; } + } +} diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseExceptionFactory.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseExceptionFactory.cs index 74f30025..f9d20d2d 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseExceptionFactory.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseExceptionFactory.cs @@ -4,7 +4,6 @@ namespace Microsoft.SCIM { using System.Net; using System.Net.Http; - using System.Web.Http; internal abstract class HttpResponseExceptionFactory { diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProvider.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProvider.cs index c0dd13e8..9b23ae40 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProvider.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/IProvider.cs @@ -5,7 +5,6 @@ namespace Microsoft.SCIM using System; using System.Collections.Generic; using System.Threading.Tasks; - using System.Web.Http; using Microsoft.AspNetCore.Builder; public interface IProvider diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RequestExtensions.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RequestExtensions.cs index 4d1d661a..1907781b 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RequestExtensions.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RequestExtensions.cs @@ -6,7 +6,6 @@ namespace Microsoft.SCIM using System.Linq; using System.Net; using System.Net.Http; - using System.Web.Http; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/ResourceQuery.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/ResourceQuery.cs index b4608599..db36b80f 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/ResourceQuery.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/ResourceQuery.cs @@ -9,7 +9,6 @@ namespace Microsoft.SCIM using System.Linq; using System.Net; using System.Web; - using System.Web.Http; public sealed class ResourceQuery : IResourceQuery { diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs index 3a0b72a0..fa9708a0 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/RootProviderAdapter .cs @@ -6,7 +6,6 @@ namespace Microsoft.SCIM using System.Net; using System.Net.Http; using System.Threading.Tasks; - using System.Web.Http; internal class RootProviderAdapter : ProviderAdapterTemplate { diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/SampleProvider.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/SampleProvider.cs index 7a24f06b..3d996dee 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/SampleProvider.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/SampleProvider.cs @@ -8,7 +8,6 @@ namespace Microsoft.SCIM using System.Linq; using System.Net; using System.Threading.Tasks; - using System.Web.Http; using Newtonsoft.Json; public sealed class SampleProvider : ProviderBase, ISampleProvider diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/SchematizedMediaTypeFormatter.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/SchematizedMediaTypeFormatter.cs index 3b6795e8..147e6e02 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/SchematizedMediaTypeFormatter.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/SchematizedMediaTypeFormatter.cs @@ -7,14 +7,12 @@ namespace Microsoft.SCIM using System.IO; using System.Net; using System.Net.Http; - using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Text; using System.Threading; using System.Threading.Tasks; - using System.Web.Http; - public sealed class SchematizedMediaTypeFormatter : MediaTypeFormatter + public sealed class SchematizedMediaTypeFormatter { private static readonly Encoding Encoding = Encoding.UTF8; @@ -52,6 +50,8 @@ public SchematizedMediaTypeFormatter( this.DeserializingFactory = deserializingFactory ?? throw new ArgumentNullException(nameof(deserializingFactory)); } + public IList SupportedMediaTypes { get; } = new List(); + private JsonDeserializingFactory DeserializingFactory { get; @@ -71,7 +71,7 @@ private static bool CanProcessType(Type type) return result; } - public override bool CanReadType(Type type) + public bool CanReadType(Type type) { if (null == type) { @@ -82,7 +82,7 @@ public override bool CanReadType(Type type) return result; } - public override bool CanWriteType(Type type) + public bool CanWriteType(Type type) { if (null == type) { @@ -175,25 +175,24 @@ private async Task ReadFromStream(Type type, Stream readStream, HttpCont } catch (ArgumentException) { - return new HttpResponseException(HttpStatusCode.BadRequest); + throw new HttpResponseException(HttpStatusCode.BadRequest); } catch (NotSupportedException) { - return new HttpResponseException(HttpStatusCode.BadRequest); + throw new HttpResponseException(HttpStatusCode.BadRequest); } #pragma warning disable CA1031 // Do not catch general exception types catch { - return new HttpResponseException(HttpStatusCode.BadRequest); + throw new HttpResponseException(HttpStatusCode.BadRequest); } #pragma warning restore CA1031 // Do not catch general exception types } - public override Task ReadFromStreamAsync( + public Task ReadFromStreamAsync( Type type, Stream readStream, - HttpContent content, - IFormatterLogger formatterLogger) + HttpContent content) { if (null == type) { @@ -209,16 +208,15 @@ public override Task ReadFromStreamAsync( return result; } - public override Task ReadFromStreamAsync( + public Task ReadFromStreamAsync( Type type, Stream readStream, HttpContent content, - IFormatterLogger formatterLogger, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); - return this.ReadFromStreamAsync(type, readStream, content, formatterLogger); + return this.ReadFromStreamAsync(type, readStream, content); } private async Task WriteToStream( @@ -281,7 +279,7 @@ private async Task WriteToStream( writeStream.Flush(); } - public override Task WriteToStreamAsync( + public Task WriteToStreamAsync( Type type, object value, Stream writeStream, @@ -306,7 +304,7 @@ public override Task WriteToStreamAsync( return result; } - public override Task WriteToStreamAsync( + public Task WriteToStreamAsync( Type type, object value, Stream writeStream, From 0243a10e71a33f8e3add80d0c3369fd164ce2b06 Mon Sep 17 00:00:00 2001 From: Jahmai Lay Date: Mon, 25 May 2026 16:21:57 +1000 Subject: [PATCH 08/10] CA-11833: Fix [FromRoute] binding and dev signing key length - [FromQuery] -> [FromRoute] on Get(string identifier): route parameter was being looked up in the query string, causing 400 on GET by ID - Extend IssuerSigningKey in appsettings.Development.json to 32 chars; Microsoft.IdentityModel v8 requires >=256 bits for HS256 Co-Authored-By: Claude Sonnet 4.6 --- Microsoft.SCIM.WebHostSample/appsettings.Development.json | 2 +- .../Service/Controllers/ControllerTemplate.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.SCIM.WebHostSample/appsettings.Development.json b/Microsoft.SCIM.WebHostSample/appsettings.Development.json index 7da2847a..8e13887f 100644 --- a/Microsoft.SCIM.WebHostSample/appsettings.Development.json +++ b/Microsoft.SCIM.WebHostSample/appsettings.Development.json @@ -9,7 +9,7 @@ "Token": { "TokenAudience": "Microsoft.Security.Bearer", "TokenIssuer": "Microsoft.Security.Bearer", - "IssuerSigningKey": "A1B2C3D4E5F6A1B2C3D4E5F6", + "IssuerSigningKey": "A1B2C3D4E5F6A1B2C3D4E5F6G7H8I9J0", "TokenLifetimeInMins": "120" } } diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs index 14f25dd0..2fa07835 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs @@ -287,7 +287,7 @@ await provider [HttpGet(ControllerTemplate.AttributeValueIdentifier)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "The names of the methods of a controller must correspond to the names of hypertext markup verbs")] - public virtual async Task Get([FromQuery]string identifier) + public virtual async Task Get([FromRoute]string identifier) { string correlationIdentifier = null; try From 7ef133e6969e13f39c4dd4823e6fb81b0fdb6bf3 Mon Sep 17 00:00:00 2001 From: Jahmai Lay Date: Mon, 25 May 2026 17:30:28 +1000 Subject: [PATCH 09/10] CA-11833: Fix ConvertRequest() to preserve PathBase and HttpContext options Two regressions introduced when replacing HttpRequestMessageFeature in the .NET 10 upgrade: - URI was built from req.Path only, dropping req.PathBase; GetBaseResourceIdentifier() calls .Last() on path segments and threw InvalidOperationException when PathBase held the full path and Path was empty (common in test and certain host configs). - HttpContext was no longer stored in HttpRequestMessage.Options; custom GetTenantId() overrides that read from Options (e.g. SafeZoneScimProviderAdapterTemplateBase) threw UnauthorizedAccessException on every request. Fix: combine PathBase + Path for the URI, and set HttpContext in Options. Co-Authored-By: Claude Sonnet 4.6 --- .../Service/Controllers/ControllerTemplate.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs index 2fa07835..9761e5bb 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs @@ -8,6 +8,7 @@ namespace Microsoft.SCIM using System.Net; using System.Net.Http; using System.Threading.Tasks; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; public abstract class ControllerTemplate : ControllerBase @@ -52,12 +53,14 @@ protected virtual void ConfigureResponse(Resource resource) protected HttpRequestMessage ConvertRequest() { var req = this.HttpContext.Request; - var uri = new Uri($"{req.Scheme}://{req.Host}{req.Path}{req.QueryString}"); + var fullPath = req.PathBase + req.Path; + var uri = new Uri($"{req.Scheme}://{req.Host}{fullPath}{req.QueryString}"); var result = new HttpRequestMessage(new HttpMethod(req.Method), uri); foreach (var header in req.Headers) { result.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); } + result.Options.Set(new HttpRequestOptionsKey(nameof(HttpContext)), this.HttpContext); return result; } From 5d3a186f52ee32900234f049dde885443517677e Mon Sep 17 00:00:00 2001 From: Jahmai Lay Date: Mon, 25 May 2026 17:33:59 +1000 Subject: [PATCH 10/10] CA-11833: bump Microsoft.SCIM to 1.0.7 Co-Authored-By: Claude Sonnet 4.6 --- .../Microsoft.SCIM.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj index b73dc091..e56d1388 100644 --- a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj @@ -5,10 +5,10 @@ net10.0 true Microsoft SCIM - 1.0.6 - 1.0.6 - 1.0.6 - 1.0.6 + 1.0.7 + 1.0.7 + 1.0.7 + 1.0.7 en