├── .gitattributes ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Microsoft.SCIM.WebHostSample ├── .config │ └── dotnet-tools.json ├── Controllers │ └── TokenController.cs ├── Microsoft.SCIM.WebHostSample.csproj ├── Program.cs ├── Provider │ ├── InMemoryGroupProvider.cs │ ├── InMemoryProvider.cs │ ├── InMemoryStorage.cs │ └── InMemoryUserProvider.cs ├── Resources │ ├── SampleAddressesAttribute.cs │ ├── SampleCommonAttributes.cs │ ├── SampleConstants.cs │ ├── SampleEnterpriseUserAttributes.cs │ ├── SampleGroupAttributes.cs │ ├── SampleMultivaluedAttributes.cs │ ├── SampleNameAttribute.cs │ ├── SampleResourceTypeAttributes.cs │ ├── SampleResourceTypes.cs │ ├── SampleSchemaAttributes.cs │ ├── SampleServiceProviderConfigAttributes.cs │ ├── SampleTypeScheme.cs │ └── SampleUserAttributes.cs ├── Startup.cs ├── appsettings.Development.json └── appsettings.json ├── Microsoft.SCIM.sln ├── Microsoft.SystemForCrossDomainIdentityManagement ├── Microsoft.SCIM.csproj ├── Protocol │ ├── BulkOperation.cs │ ├── BulkOperations.cs │ ├── BulkRequest2.cs │ ├── BulkRequestOperation.cs │ ├── BulkResponse2.cs │ ├── BulkResponseOperation.cs │ ├── Core2EnterpriseUserExtensions.cs │ ├── DictionaryExtension.cs │ ├── ErrorResponse.cs │ ├── ErrorResponseJsonDeserializingFactory.cs │ ├── ErrorType.cs │ ├── Extension.cs │ ├── Filter.cs │ ├── FilterExpression.cs │ ├── Friends.cs │ ├── GlobalSuppressions.cs │ ├── IExtension.cs │ ├── IFilter.cs │ ├── IFilterExpression.cs │ ├── IGroupDeserializer.cs │ ├── IPaginationParameters.cs │ ├── IPatchOperation2Base.cs │ ├── IPatchRequest2Deserializer.cs │ ├── IPath.cs │ ├── IQuery.cs │ ├── IQueryParameters.cs │ ├── IReadOnlyCollectionExtensions.cs │ ├── IResourceIdentifier.cs │ ├── IResourceRetrievalParameters.cs │ ├── IResponse.cs │ ├── IRetrievalParameters.cs │ ├── ISchemaIdentifier.cs │ ├── ISchematizedJsonDeserializingFactory.cs │ ├── IUserDeserializer.cs │ ├── JsonDeserializingFactory.cs │ ├── MediaTypes.cs │ ├── ObjectExtentions.cs │ ├── OperationName.cs │ ├── OperationValue.cs │ ├── PaginationParameters.cs │ ├── PatchOperation2.cs │ ├── PatchOperation2Base.cs │ ├── PatchOperation2Combined.cs │ ├── PatchOperation2SingleValued.cs │ ├── PatchOperation2SingleValuedJsonDeserializingFactory.cs │ ├── PatchOperationJsonDeserializingFactory.cs │ ├── PatchRequest2.cs │ ├── PatchRequest2Base.cs │ ├── PatchRequest2DeserializingFactory.cs │ ├── PatchRequest2JsonDeserializingFactory.cs │ ├── PatchRequestBase.cs │ ├── Path.cs │ ├── ProtocolAttributeNames.cs │ ├── ProtocolConstants.cs │ ├── ProtocolExtensions.cs │ ├── ProtocolJsonDeserializingFactory.cs │ ├── ProtocolJsonNormalizer.cs │ ├── ProtocolSchemaIdentifiers.cs │ ├── Query.cs │ ├── QueryKeys.cs │ ├── QueryParameters.cs │ ├── QueryResponse.cs │ ├── QueryResponseBase.cs │ ├── QueryResponseJsonDeserializingFactory.cs │ ├── ResourceIdentifier.cs │ ├── ResourceRetrievalParameters.cs │ ├── Response.cs │ ├── RetrievalParameters.cs │ ├── SchemaIdentifier.cs │ ├── SchematizedJsonDeserializingFactory.cs │ ├── SchematizedJsonDeserializingFactoryBase.cs │ ├── SortOrder.cs │ └── StringExtension.cs ├── Schemas │ ├── Address.cs │ ├── AddressBase.cs │ ├── AttributeDataType.cs │ ├── AttributeNames.cs │ ├── AttributeScheme.cs │ ├── AuthenticationScheme.cs │ ├── BulkRequestsFeature.cs │ ├── ComparisonOperator.cs │ ├── ConfigurationFactory.cs │ ├── ConfigurationSectionFactory.cs │ ├── Core2EnterpriseUser.cs │ ├── Core2EnterpriseUserBase.cs │ ├── Core2EnterpriseUserJsonDeserializingFactory.cs │ ├── Core2Error.cs │ ├── Core2Group.cs │ ├── Core2GroupBase.cs │ ├── Core2GroupJsonDeserializingFactory.cs │ ├── Core2Metadata.cs │ ├── Core2ResourceType.cs │ ├── Core2ResourceTypeJsonDeserializingFactory.cs │ ├── Core2ServiceConfiguration.cs │ ├── Core2ServiceConfigurationJsonDeserializingFactory.cs │ ├── Core2User.cs │ ├── Core2UserBase.cs │ ├── Core2UserJsonDeserializingFactory.cs │ ├── DateTimeExtension.cs │ ├── ElectronicMailAddress.cs │ ├── ElectronicMailAddressBase.cs │ ├── EnumerableExtension.cs │ ├── ErrorBase.cs │ ├── EventToken.cs │ ├── EventTokenClaimTypes.cs │ ├── EventTokenDecorator.cs │ ├── EventTokenFactory.cs │ ├── ExtensionAttributeEnterpriseUser2.cs │ ├── ExtensionAttributeEnterpriseUserBase.cs │ ├── ExtensionAttributeWindowsAzureActiveDirectoryGroup.cs │ ├── Feature.cs │ ├── FeatureBase.cs │ ├── Friends.cs │ ├── GlobalSuppressions.cs │ ├── GroupBase.cs │ ├── IChange.cs │ ├── IEventToken.cs │ ├── IJsonNormalizationBehavior.cs │ ├── IJsonSerializable.cs │ ├── IResourceJsonDeserializingFactory.cs │ ├── ISchematizedJsonDeserializingFactory.cs │ ├── ISystemForCrossDomainIdentityManagementConfiguration.cs │ ├── ISystemForCrossDomainIdentityManagementResourceIdentifier.cs │ ├── IUnixTime.cs │ ├── InstantMessaging.cs │ ├── InstantMessagingBase.cs │ ├── JsonDeserializingFactory.cs │ ├── JsonFactory.cs │ ├── JsonNormalizer.cs │ ├── JsonNormalizerTemplate.cs │ ├── JsonSerializer.cs │ ├── LogicalOperator.cs │ ├── Manager.cs │ ├── ManagerDeserializingFactory.cs │ ├── Member.cs │ ├── MemberBase.cs │ ├── Mutability.cs │ ├── Name.cs │ ├── PhoneNumber.cs │ ├── PhoneNumberBase.cs │ ├── Photo.cs │ ├── PhotoBase.cs │ ├── PluralUnsecuredEventTokenFactory.cs │ ├── QualifiedResource.cs │ ├── Resource.cs │ ├── Returned.cs │ ├── Role.cs │ ├── RoleBase.cs │ ├── SchemaConstants.cs │ ├── SchemaIdentifiers.cs │ ├── Schematized.cs │ ├── ServiceConfigurationBase.cs │ ├── SingularEventToken.cs │ ├── SingularUnsecuredEventTokenFactory.cs │ ├── SpecificationVersion.cs │ ├── SystemForCrossDomainIdentityManagementConfigurationSection.cs │ ├── SystemForCrossDomainIdentityManagementResourceIdentifier.cs │ ├── TrustedJsonFactory.cs │ ├── TypeScheme.cs │ ├── TypeSchemeJsonDeserializingFactory.cs │ ├── TypedItem.cs │ ├── TypedValue.cs │ ├── Types.cs │ ├── Uniqueness.cs │ ├── UnixTime.cs │ ├── UnsecuredEventTokenFactory.cs │ ├── User.cs │ └── UserBase.cs ├── Service │ ├── BulkCreationOperationContext.cs │ ├── BulkCreationOperationState.cs │ ├── BulkDeletionOperationContext.cs │ ├── BulkDeletionOperationState.cs │ ├── BulkOperationContextBase.cs │ ├── BulkOperationState.cs │ ├── BulkOperationStateBase.cs │ ├── BulkRequest.cs │ ├── BulkUpdateOperationContext.cs │ ├── BulkUpdateOperationState.cs │ ├── Controllers │ │ ├── BulkRequestController.cs │ │ ├── ControllerTemplate.cs │ │ ├── GroupsController.cs │ │ ├── ResourceTypesController.cs │ │ ├── RootController.cs │ │ ├── SchemasController.cs │ │ ├── ServiceProviderConfigurationController.cs │ │ └── UsersController.cs │ ├── Core2EnterpriseUserProviderAdapter.cs │ ├── Core2GroupProviderAdapter.cs │ ├── CreationRequest.cs │ ├── DeletionRequest.cs │ ├── DependencyResolverDecorator.cs │ ├── DeserializingFactory.cs │ ├── EventRequest.cs │ ├── Friends.cs │ ├── GlobalSuppressions.cs │ ├── HttpResponseExceptionFactory.cs │ ├── HttpResponseMessageFactory.cs │ ├── HttpStringResponseExceptionFactory.cs │ ├── HttpStringResponseMessageFactory.cs │ ├── IBulkCreationOperationContext.cs │ ├── IBulkCreationOperationState.cs │ ├── IBulkOperationContext.cs │ ├── IBulkOperationState.cs │ ├── IBulkUpdateOperationContext.cs │ ├── IBulkUpdateOperationState.CS │ ├── IMetadataProvider.cs │ ├── IPatch.cs │ ├── IProvider.cs │ ├── IProviderAdapter.cs │ ├── IRequest.cs │ ├── IResourceQuery.cs │ ├── ISampleProvider.cs │ ├── IUniformResourceIdentifier.cs │ ├── InvalidBulkOperationContext.cs │ ├── InvalidBulkOperationState.cs │ ├── Monitor │ │ ├── ConsoleMonitor.cs │ │ ├── CriticalExceptionNotificationFactory.cs │ │ ├── ExceptionNotification.cs │ │ ├── ExceptionNotificationFactory.cs │ │ ├── IExceptionNotification.cs │ │ ├── IInformationNotification.cs │ │ ├── IMonitor.cs │ │ ├── INotification.cs │ │ ├── InformationNotification.cs │ │ ├── InformationNotificationFactory.cs │ │ ├── Notification.cs │ │ ├── NotificationFactory.cs │ │ ├── NotificationFactoryBase.cs │ │ ├── VerboseInformationNotificationFactory.cs │ │ └── WarningNotificationFactory.cs │ ├── MonitoringMiddleware.cs │ ├── Patch.cs │ ├── ProviderAdapterTemplate.cs │ ├── ProviderBase.cs │ ├── ProviderExtensions.cs │ ├── QueryRequest.cs │ ├── QueryResponse.cs │ ├── ReplaceRequest.cs │ ├── RequestExtensions.cs │ ├── ResourceQuery.cs │ ├── RetrievalRequest.cs │ ├── RootProviderAdapter .cs │ ├── SampleProvider.cs │ ├── SchematizedMediaTypeFormatter.cs │ ├── ServiceConstants.cs │ ├── ServiceNotificationIdentifiers.cs │ ├── SevereWarningNotificationFactory.cs │ ├── SystemForCrossDomainIdentityManagementRequest.cs │ ├── UniformResourceIdentifier.cs │ └── UpdateRequest.cs ├── SystemForCrossDomainIdentityManagementProtocolResources.Designer.cs ├── SystemForCrossDomainIdentityManagementProtocolResources.resx ├── SystemForCrossDomainIdentityManagementSchemasResources.Designer.cs ├── SystemForCrossDomainIdentityManagementSchemasResources.resx ├── SystemForCrossDomainIdentityManagementServiceResources.Designer.cs └── SystemForCrossDomainIdentityManagementServiceResources.resx ├── PostmanCollection.json ├── README.md ├── SCIM Inbound.postman_collection.json └── SECURITY.md /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to 4 | agree to a Contributor License Agreement (CLA) declaring that you have the right to, 5 | and actually do, grant us the rights to use your contribution. For details, visit 6 | https://cla.microsoft.com. 7 | 8 | When you submit a pull request, a CLA-bot will automatically determine whether you need 9 | to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the 10 | instructions provided by the bot. You will only need to do this once across all repositories using our CLA. 11 | 12 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 13 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 14 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "3.1.2", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Microsoft.SCIM.WebHostSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Program.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM.WebHostSample 6 | { 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Hosting; 9 | 10 | public class Program 11 | { 12 | public static void Main(string[] args) 13 | { 14 | Program.CreateHostBuilder(args).Build().Run(); 15 | } 16 | 17 | public static IHostBuilder CreateHostBuilder(string[] args) => 18 | Host.CreateDefaultBuilder(args) 19 | .ConfigureWebHostDefaults(webBuilder => 20 | { 21 | webBuilder.UseStartup(); 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Resources/SampleCommonAttributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM.WebHostSample.Resources 4 | { 5 | public static class SampleCommonAttributes 6 | { 7 | public static AttributeScheme IdentiFierAttributeScheme 8 | { 9 | get 10 | { 11 | AttributeScheme idScheme = new AttributeScheme("id", AttributeDataType.@string, false) 12 | { 13 | Description = SampleConstants.DescriptionIdentifier 14 | }; 15 | return idScheme; 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Resources/SampleGroupAttributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM.WebHostSample.Resources 4 | { 5 | public static class SampleGroupAttributes 6 | { 7 | public static AttributeScheme GroupDisplayNameAttributeScheme 8 | { 9 | get 10 | { 11 | AttributeScheme groupDisplayScheme = new AttributeScheme("displayName", AttributeDataType.@string, false) 12 | { 13 | Description = SampleConstants.DescriptionGroupDisplayName, 14 | Required = true, 15 | Uniqueness = Uniqueness.server 16 | }; 17 | 18 | return groupDisplayScheme; 19 | } 20 | } 21 | 22 | public static AttributeScheme MembersAttributeScheme 23 | { 24 | get 25 | { 26 | AttributeScheme membersScheme = new AttributeScheme("members", AttributeDataType.complex, true) 27 | { 28 | Description = SampleConstants.DescriptionMemebers 29 | }; 30 | membersScheme.AddSubAttribute(SampleMultivaluedAttributes.ValueSubAttributeScheme); 31 | membersScheme.AddSubAttribute(SampleMultivaluedAttributes.TypeSubAttributeScheme); 32 | 33 | return membersScheme; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Resources/SampleNameAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM.WebHostSample.Resources 4 | { 5 | public static class SampleNameAttribute 6 | { 7 | public static AttributeScheme FormattedNameAttributeScheme 8 | { 9 | get 10 | { 11 | AttributeScheme formattedNameScheme = new AttributeScheme("formatted", AttributeDataType.@string, false) 12 | { 13 | Description = SampleConstants.DescriptionFormattedName 14 | }; 15 | return formattedNameScheme; 16 | } 17 | } 18 | 19 | public static AttributeScheme GivenNameAttributeScheme 20 | { 21 | get 22 | { 23 | AttributeScheme givenNameScheme = new AttributeScheme("givenName", AttributeDataType.@string, false) 24 | { 25 | Description = SampleConstants.DescriptionGivenName 26 | }; 27 | return givenNameScheme; 28 | } 29 | } 30 | 31 | public static AttributeScheme FamilyNameAttributeScheme 32 | { 33 | get 34 | { 35 | AttributeScheme familyNameScheme = new AttributeScheme("familyName", AttributeDataType.@string, false) 36 | { 37 | Description = SampleConstants.DescriptionFamilyName 38 | }; 39 | return familyNameScheme; 40 | } 41 | } 42 | 43 | public static AttributeScheme HonorificPrefixAttributeScheme 44 | { 45 | get 46 | { 47 | AttributeScheme honorificPrefixScheme = new AttributeScheme("honorificPrefix", AttributeDataType.@string, false) 48 | { 49 | Description = SampleConstants.DescriptionHonorificPrefix 50 | }; 51 | return honorificPrefixScheme; 52 | } 53 | } 54 | 55 | public static AttributeScheme HonorificSuffixAttributeScheme 56 | { 57 | get 58 | { 59 | AttributeScheme honorificSuffixScheme = new AttributeScheme("honorificSuffix", AttributeDataType.@string, false) 60 | { 61 | Description = SampleConstants.DescriptionHonorificSuffix 62 | }; 63 | return honorificSuffixScheme; 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Resources/SampleResourceTypeAttributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM.WebHostSample.Resources 4 | { 5 | public static class SampleResourceTypeAttributes 6 | { 7 | 8 | public static AttributeScheme NameAttributeScheme 9 | { 10 | get 11 | { 12 | AttributeScheme nameScheme = new AttributeScheme("name", AttributeDataType.@string, false) 13 | { 14 | Description = SampleConstants.DescriptionResourceTypeName 15 | }; 16 | return nameScheme; 17 | } 18 | } 19 | 20 | public static AttributeScheme EndpointAttributeScheme 21 | { 22 | get 23 | { 24 | AttributeScheme endpointScheme = new AttributeScheme("endpoint", AttributeDataType.reference, false) 25 | { 26 | Description = SampleConstants.DescriptionResourceTypeEndpoint, 27 | Required = true, 28 | Mutability = Mutability.readOnly 29 | }; 30 | endpointScheme.AddReferenceTypes("uri"); 31 | 32 | return endpointScheme; 33 | } 34 | } 35 | 36 | public static AttributeScheme SchemaAttributeScheme 37 | { 38 | get 39 | { 40 | AttributeScheme schemaScheme = new AttributeScheme("schema", AttributeDataType.reference, false) 41 | { 42 | Description = SampleConstants.DescriptionResourceTypeSchemaAttribute, 43 | Required = true, 44 | Mutability = Mutability.readOnly, 45 | CaseExact = true 46 | }; 47 | schemaScheme.AddReferenceTypes("uri"); 48 | 49 | return schemaScheme; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/Resources/SampleResourceTypes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM.WebHostSample.Resources 4 | { 5 | using System; 6 | 7 | public class SampleResourceTypes 8 | { 9 | public static Core2ResourceType UserResourceType 10 | { 11 | get 12 | { 13 | Core2ResourceType userResource = new Core2ResourceType 14 | { 15 | Identifier = Types.User, 16 | Endpoint = new Uri($"{SampleConstants.SampleScimEndpoint}/Users"), 17 | Schema = SampleConstants.UserEnterpriseSchema 18 | }; 19 | 20 | return userResource; 21 | } 22 | } 23 | 24 | public static Core2ResourceType GroupResourceType 25 | { 26 | get 27 | { 28 | Core2ResourceType groupResource = new Core2ResourceType 29 | { 30 | Identifier = Types.Group, 31 | Endpoint = new Uri($"{SampleConstants.SampleScimEndpoint}/Groups"), 32 | Schema = $"{SampleConstants.Core2SchemaPrefix}{Types.Group}" 33 | }; 34 | 35 | return groupResource; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "Token": { 10 | "TokenAudience": "Microsoft.Security.Bearer", 11 | "TokenIssuer": "Microsoft.Security.Bearer", 12 | "IssuerSigningKey": "A1B2C3D4E5F6A1B2C3D4E5F6", 13 | "TokenLifetimeInMins": "120" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Microsoft.SCIM.WebHostSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "Token": { 10 | "TokenAudience": "8adf8e6e-67b2-4cf2-a259-e3dc5476c621", 11 | "TokenIssuer": "https://sts.windows.net//" 12 | }, 13 | "AllowedHosts": "*" 14 | } 15 | -------------------------------------------------------------------------------- /Microsoft.SCIM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SCIM", "Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.csproj", "{C9ED6410-1995-4B98-AD57-C02D5F16631C}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.SCIM.WebHostSample", "Microsoft.SCIM.WebHostSample\Microsoft.SCIM.WebHostSample.csproj", "{238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {C9ED6410-1995-4B98-AD57-C02D5F16631C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {C9ED6410-1995-4B98-AD57-C02D5F16631C}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {C9ED6410-1995-4B98-AD57-C02D5F16631C}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {C9ED6410-1995-4B98-AD57-C02D5F16631C}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {238F1B05-D3EE-4AB4-871E-ADEA0A1665CF}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BA30FD0D-DDC6-474D-ACE3-FD6AC5924BC5} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/BulkOperation.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net.Http; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | public abstract class BulkOperation 13 | { 14 | private HttpMethod method; 15 | private string methodName; 16 | 17 | protected BulkOperation() 18 | { 19 | this.Identifier = Guid.NewGuid().ToString(); 20 | } 21 | 22 | protected BulkOperation(string identifier) 23 | { 24 | this.Identifier = identifier; 25 | } 26 | 27 | [DataMember(Name = ProtocolAttributeNames.BulkOperationIdentifier, Order = 1)] 28 | public string Identifier 29 | { 30 | get; 31 | private set; 32 | } 33 | 34 | public HttpMethod Method 35 | { 36 | get => this.method; 37 | 38 | set 39 | { 40 | this.method = value; 41 | if (value != null) 42 | { 43 | this.methodName = value.ToString(); 44 | } 45 | } 46 | } 47 | 48 | [DataMember(Name = ProtocolAttributeNames.Method, Order = 0)] 49 | #pragma warning disable IDE0051 // Remove unused private members 50 | private string MethodName 51 | #pragma warning restore IDE0051 // Remove unused private members 52 | { 53 | get => this.methodName; 54 | 55 | set 56 | { 57 | this.method = new HttpMethod(value); 58 | this.methodName = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/BulkRequest2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class BulkRequest2 : BulkOperations 11 | { 12 | public BulkRequest2() 13 | : base(ProtocolSchemaIdentifiers.Version2BulkRequest) 14 | { 15 | } 16 | 17 | [DataMember(Name = ProtocolAttributeNames.FailOnErrors, Order = 1)] 18 | public int? FailOnErrors 19 | { 20 | get; 21 | set; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/BulkResponse2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class BulkResponse2 : BulkOperations 11 | { 12 | public BulkResponse2() 13 | : base(ProtocolSchemaIdentifiers.Version2BulkResponse) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/BulkResponseOperation.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | [KnownType(typeof(ErrorResponse))] 13 | [KnownType(typeof(Core2EnterpriseUser))] 14 | [KnownType(typeof(QueryResponse))] 15 | [KnownType(typeof(Core2User))] 16 | [KnownType(typeof(QueryResponse))] 17 | [KnownType(typeof(QueryResponse))] 18 | [KnownType(typeof(Core2Group))] 19 | public sealed class BulkResponseOperation : BulkOperation, IResponse 20 | { 21 | private IResponse response; 22 | 23 | public BulkResponseOperation(string identifier) 24 | : base(identifier) 25 | { 26 | this.OnInitialization(); 27 | } 28 | 29 | public BulkResponseOperation() 30 | : base(null) 31 | { 32 | this.OnInitialization(); 33 | } 34 | 35 | [DataMember(Name = ProtocolAttributeNames.Location)] 36 | public Uri Location 37 | { 38 | get; 39 | set; 40 | } 41 | 42 | [DataMember(Name = ProtocolAttributeNames.Response)] 43 | public object Response 44 | { 45 | get; 46 | set; 47 | } 48 | 49 | public HttpStatusCode Status 50 | { 51 | get => this.response.Status; 52 | set => this.response.Status = value; 53 | } 54 | 55 | [DataMember(Name = ProtocolAttributeNames.Status)] 56 | public string StatusCodeValue 57 | { 58 | get => this.response.StatusCodeValue; 59 | set => this.response.StatusCodeValue = value; 60 | } 61 | 62 | public bool IsError() => this.response.IsError(); 63 | 64 | [OnDeserializing] 65 | private void OnDeserializing(StreamingContext _) => this.OnInitialization(); 66 | 67 | private void OnInitialization() => this.response = new Response(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/DictionaryExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | internal static class DictionaryExtension 11 | { 12 | public static void Trim(this IDictionary dictionary) 13 | { 14 | IReadOnlyCollection keys = dictionary.Keys.ToArray(); 15 | foreach (string key in keys) 16 | { 17 | object value = dictionary[key]; 18 | if (null == value) 19 | { 20 | dictionary.Remove(key); 21 | } 22 | 23 | IDictionary dictionaryValue = value as IDictionary; 24 | if (dictionaryValue != null) 25 | { 26 | dictionaryValue.Trim(); 27 | if (dictionaryValue.Count <= 0) 28 | { 29 | dictionary.Remove(key); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | public sealed class ErrorResponse : Schematized 13 | { 14 | private ErrorType errorType; 15 | 16 | [DataMember(Name = ProtocolAttributeNames.ErrorType)] 17 | private string errorTypeValue; 18 | 19 | private Response response; 20 | 21 | public ErrorResponse() 22 | { 23 | this.Initialize(); 24 | this.AddSchema(ProtocolSchemaIdentifiers.Version2Error); 25 | } 26 | 27 | [DataMember(Name = ProtocolAttributeNames.Detail)] 28 | public string Detail 29 | { 30 | get; 31 | set; 32 | } 33 | 34 | public ErrorType ErrorType 35 | { 36 | get 37 | { 38 | return this.errorType; 39 | } 40 | 41 | set 42 | { 43 | this.errorType = value; 44 | this.errorTypeValue = Enum.GetName(typeof(ErrorType), value); 45 | } 46 | } 47 | 48 | public HttpStatusCode Status 49 | { 50 | get 51 | { 52 | return this.response.Status; 53 | } 54 | 55 | set 56 | { 57 | this.response.Status = value; 58 | } 59 | } 60 | 61 | private void Initialize() 62 | { 63 | this.response = new Response(); 64 | } 65 | 66 | [OnDeserializing] 67 | private void OnDeserializing(StreamingContext context) 68 | { 69 | this.Initialize(); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ErrorResponseJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class ErrorResponseJsonDeserializingFactory : 8 | ProtocolJsonDeserializingFactory 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Friends.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | using System.Runtime.CompilerServices; 6 | 7 | [assembly: InternalsVisibleTo("Microsoft.SystemForCrossDomainIdentityManagement.Test, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 8 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AzureAD/SCIMReferenceCode/d445ef901981fef684a220fe8cf6c97b588600fd/Microsoft.SystemForCrossDomainIdentityManagement/Protocol/GlobalSuppressions.cs -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net.Http; 9 | 10 | public interface IExtension 11 | { 12 | Type Controller { get; } 13 | JsonDeserializingFactory JsonDeserializingFactory { get; } 14 | string Path { get; } 15 | string SchemaIdentifier { get; } 16 | string TypeName { get; } 17 | 18 | bool Supports(HttpRequestMessage request); 19 | } 20 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IFilter.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IFilter 8 | { 9 | IFilter AdditionalFilter { get; set; } 10 | string AttributePath { get; } 11 | string ComparisonValue { get; } 12 | string ComparisonValueEncoded { get; } 13 | AttributeDataType? DataType { get; set; } 14 | ComparisonOperator FilterOperator { get; } 15 | 16 | string Serialize(); 17 | } 18 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IFilterExpression.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | internal interface IFilterExpression 10 | { 11 | IReadOnlyCollection ToFilters(); 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IGroupDeserializer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Deserializer", Justification = "False analysis")] 8 | public interface IGroupDeserializer 9 | { 10 | IResourceJsonDeserializingFactory GroupDeserializationBehavior { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IPaginationParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IPaginationParameters 8 | { 9 | int? Count { get; set; } 10 | int? StartIndex { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IPatchOperation2Base.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IPatchOperation2Base 8 | { 9 | OperationName Name { get; set; } 10 | IPath Path { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IPatchRequest2Deserializer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Deserializer", Justification = "False analysis")] 8 | public interface IPatchRequest2Deserializer 9 | { 10 | ISchematizedJsonDeserializingFactory PatchRequest2DeserializationBehavior { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IPath.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IPath 10 | { 11 | string AttributePath { get; } 12 | string SchemaIdentifier { get; } 13 | IReadOnlyCollection SubAttributes { get; } 14 | IPath ValuePath { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQuery.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IQuery 10 | { 11 | IReadOnlyCollection AlternateFilters { get; set; } 12 | IReadOnlyCollection ExcludedAttributePaths { get; set; } 13 | IPaginationParameters PaginationParameters { get; set; } 14 | string Path { get; set; } 15 | IReadOnlyCollection RequestedAttributePaths { get; set; } 16 | 17 | string Compose(); 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IQueryParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IQueryParameters : IRetrievalParameters 10 | { 11 | IReadOnlyCollection AlternateFilters { get; } 12 | IPaginationParameters PaginationParameters { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IReadOnlyCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Web; 11 | 12 | public static class IReadOnlyCollectionExtensions 13 | { 14 | public static IReadOnlyCollection Encode(this IReadOnlyCollection collection) 15 | { 16 | IReadOnlyCollection result = 17 | collection 18 | .Select( 19 | (string item) => 20 | HttpUtility.UrlEncode(item)) 21 | .ToArray(); 22 | return result; 23 | } 24 | 25 | public static bool TryGetPath( 26 | this IReadOnlyCollection extensions, 27 | string schemaIdentifier, 28 | out string path) 29 | { 30 | if (string.IsNullOrWhiteSpace(schemaIdentifier)) 31 | { 32 | throw new ArgumentNullException(nameof(schemaIdentifier)); 33 | } 34 | 35 | path = null; 36 | IExtension 37 | extension = 38 | extensions 39 | .SingleOrDefault( 40 | (IExtension item) => 41 | string.Equals(schemaIdentifier, item.SchemaIdentifier, StringComparison.OrdinalIgnoreCase)); 42 | if (null == extension) 43 | { 44 | return false; 45 | } 46 | 47 | path = extension.Path; 48 | return true; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceIdentifier.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IResourceIdentifier 8 | { 9 | string Identifier { get; set; } 10 | string SchemaIdentifier { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResourceRetrievalParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IResourceRetrievalParameters : IRetrievalParameters 8 | { 9 | IResourceIdentifier ResourceIdentifier { get; } 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IResponse.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Net; 8 | 9 | internal interface IResponse 10 | { 11 | HttpStatusCode Status { get; set; } 12 | string StatusCodeValue { get; set; } 13 | 14 | bool IsError(); 15 | } 16 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IRetrievalParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IRetrievalParameters 10 | { 11 | IReadOnlyCollection ExcludedAttributePaths { get; } 12 | string Path { get; } 13 | IReadOnlyCollection RequestedAttributePaths { get; } 14 | string SchemaIdentifier { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ISchemaIdentifier.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface ISchemaIdentifier 8 | { 9 | string Value { get; } 10 | 11 | string FindPath(); 12 | bool TryFindPath(out string path); 13 | } 14 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ISchematizedJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | internal interface ISchematizedJsonDeserializingFactory : 8 | IGroupDeserializer, 9 | IPatchRequest2Deserializer, 10 | IUserDeserializer 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/IUserDeserializer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Deserializer", Justification = "False analysis")] 8 | public interface IUserDeserializer 9 | { 10 | IResourceJsonDeserializingFactory UserDeserializationBehavior { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/JsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public delegate Resource JsonDeserializingFactory(IReadOnlyDictionary json); 10 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/MediaTypes.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class MediaTypes 8 | { 9 | public const string JavaWebToken = "application/jwt"; 10 | public const string Json = "application/json"; 11 | public const string Protocol = ProtocolConstants.ContentType; 12 | public const string Stream = "application/octet-stream"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ObjectExtentions.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Linq; 9 | using Newtonsoft.Json; 10 | using Newtonsoft.Json.Linq; 11 | 12 | public static class ObjectExtentions 13 | { 14 | public static bool IsResourceType(this object json, string scheme) 15 | { 16 | if (null == json) 17 | { 18 | throw new ArgumentNullException(nameof(json)); 19 | } 20 | if (string.IsNullOrWhiteSpace(scheme)) 21 | { 22 | throw new ArgumentNullException(nameof(scheme)); 23 | } 24 | 25 | dynamic operationDataJson = JsonConvert.DeserializeObject(json.ToString()); 26 | bool result = false; 27 | 28 | switch (operationDataJson.schemas) 29 | { 30 | case JArray schemas: 31 | string[] schemasList = schemas.ToObject(); 32 | result = 33 | schemasList 34 | .Any( 35 | (string item) => 36 | string.Equals(item, scheme, StringComparison.OrdinalIgnoreCase)); 37 | break; 38 | default: 39 | break; 40 | } 41 | return result; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/OperationName.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum OperationName 8 | { 9 | Add, 10 | Remove, 11 | Replace 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/OperationValue.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Globalization; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public sealed class OperationValue 12 | { 13 | private const string Template = "{0} {1}"; 14 | 15 | [DataMember(Name = ProtocolAttributeNames.Reference, Order = 0, IsRequired = false, EmitDefaultValue = false)] 16 | public string Reference 17 | { 18 | get; 19 | set; 20 | } 21 | 22 | [DataMember(Name = AttributeNames.Value, Order = 1, IsRequired = false, EmitDefaultValue = false)] 23 | public string Value 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | public override string ToString() 30 | { 31 | string result = 32 | string.Format( 33 | CultureInfo.InvariantCulture, 34 | OperationValue.Template, 35 | this.Value, 36 | this.Reference) 37 | .Trim(); 38 | return result; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PaginationParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public class PaginationParameters : IPaginationParameters 8 | { 9 | int? count; 10 | int? startIndex; 11 | 12 | public int? Count 13 | { 14 | get 15 | { 16 | return this.count; 17 | } 18 | 19 | set 20 | { 21 | if (value.HasValue && value.Value < 0) 22 | { 23 | this.count = 0; 24 | return; 25 | } 26 | this.count = value; 27 | } 28 | } 29 | 30 | public int? StartIndex 31 | { 32 | get 33 | { 34 | return this.startIndex; 35 | } 36 | 37 | set 38 | { 39 | if (value.HasValue && value.Value < 1) 40 | { 41 | this.startIndex = 1; 42 | return; 43 | } 44 | this.startIndex = value; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchOperation2SingleValued.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Globalization; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | public sealed class PatchOperation2SingleValued : PatchOperation2Base 13 | { 14 | private const string Template = "{0}: [{1}]"; 15 | 16 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "The serialized value is consumed.")] 17 | [DataMember(Name = AttributeNames.Value, Order = 2)] 18 | private string valueValue; 19 | 20 | public PatchOperation2SingleValued() 21 | { 22 | this.OnInitialization(); 23 | } 24 | 25 | public PatchOperation2SingleValued(OperationName operationName, string pathExpression, string value) 26 | : base(operationName, pathExpression) 27 | { 28 | if (string.IsNullOrWhiteSpace(value)) 29 | { 30 | throw new ArgumentNullException(nameof(value)); 31 | } 32 | 33 | this.valueValue = value; 34 | } 35 | 36 | public string Value 37 | { 38 | get 39 | { 40 | return this.valueValue; 41 | } 42 | } 43 | 44 | [OnDeserializing] 45 | private void OnDeserializing(StreamingContext context) 46 | { 47 | this.OnInitialization(); 48 | } 49 | 50 | private void OnInitialization() 51 | { 52 | this.valueValue = string.Empty; 53 | } 54 | 55 | public override string ToString() 56 | { 57 | string operation = base.ToString(); 58 | string result = 59 | string.Format( 60 | CultureInfo.InvariantCulture, 61 | PatchOperation2SingleValued.Template, 62 | operation, 63 | this.valueValue); 64 | return result; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchOperation2SingleValuedJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | namespace Microsoft.SCIM 5 | { 6 | internal class PatchOperation2SingleValuedJsonDeserializingFactory : 7 | ProtocolJsonDeserializingFactory 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchOperationJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | internal class PatchOperation2JsonDeserializingFactory : ProtocolJsonDeserializingFactory 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchRequest2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | public sealed class PatchRequest2 : PatchRequest2Base 13 | { 14 | public PatchRequest2() 15 | { 16 | } 17 | 18 | public PatchRequest2(IReadOnlyCollection operations) 19 | : base(operations) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchRequest2Base.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Runtime.Serialization; 10 | 11 | [DataContract] 12 | public abstract class PatchRequest2Base : PatchRequestBase 13 | where TOperation : PatchOperation2Base 14 | { 15 | [DataMember(Name = ProtocolAttributeNames.Operations, Order = 2)] 16 | private List operationsValue; 17 | private IReadOnlyCollection operationsWrapper; 18 | 19 | protected PatchRequest2Base() 20 | { 21 | this.OnInitialization(); 22 | this.OnInitialized(); 23 | this.AddSchema(ProtocolSchemaIdentifiers.Version2PatchOperation); 24 | } 25 | 26 | protected PatchRequest2Base(IReadOnlyCollection operations) 27 | : this() 28 | { 29 | this.operationsValue.AddRange(operations); 30 | } 31 | 32 | public IReadOnlyCollection Operations 33 | { 34 | get 35 | { 36 | return this.operationsWrapper; 37 | } 38 | } 39 | 40 | public void AddOperation(TOperation operation) 41 | { 42 | if (null == operation) 43 | { 44 | throw new ArgumentNullException(nameof(operation)); 45 | } 46 | 47 | this.operationsValue.Add(operation); 48 | } 49 | 50 | [OnDeserialized] 51 | private void OnDeserialized(StreamingContext context) 52 | { 53 | this.OnInitialized(); 54 | } 55 | 56 | [OnDeserializing] 57 | private void OnDeserializing(StreamingContext context) 58 | { 59 | this.OnInitialization(); 60 | } 61 | 62 | private void OnInitialization() 63 | { 64 | this.operationsValue = new List(); 65 | } 66 | 67 | private void OnInitialized() 68 | { 69 | this.operationsWrapper = this.operationsValue.AsReadOnly(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchRequest2JsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class PatchRequest2JsonDeserializingFactory : 8 | PatchRequest2DeserializingFactory 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/PatchRequestBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class PatchRequestBase : Schematized 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolAttributeNames.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class ProtocolAttributeNames 8 | { 9 | public const string BulkOperationIdentifier = "bulkId"; 10 | public const string Count = "count"; 11 | public const string Data = "data"; 12 | public const string Detail = "detail"; 13 | public const string ErrorType = "scimType"; 14 | public const string ExcludedAttributes = "excludedAttributes"; 15 | public const string FailOnErrors = "failOnErrors"; 16 | public const string ItemsPerPage = "itemsPerPage"; 17 | public const string Location = "location"; 18 | public const string Method = "method"; 19 | public const string Operations = "Operations"; 20 | public const string Patch1Operation = "operation"; 21 | public const string Patch2Operation = "op"; 22 | public const string Path = AttributeNames.Path; 23 | public const string Reference = "$ref"; 24 | public const string Resources = "Resources"; 25 | public const string Response = "response"; 26 | public const string Schemas = "schemas"; 27 | public const string SortBy = "sortBy"; 28 | public const string SortOrder = "sortOrder"; 29 | public const string StartIndex = "startIndex"; 30 | public const string Status = "status"; 31 | public const string TotalResults = "totalResults"; 32 | } 33 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolConstants.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using Newtonsoft.Json; 9 | using Newtonsoft.Json.Serialization; 10 | 11 | public static class ProtocolConstants 12 | { 13 | public const string ContentType = "application/scim+json"; 14 | public const string PathGroups = "Groups"; 15 | public const string PathUsers = "Users"; 16 | public const string PathBulk = "Bulk"; 17 | public const string PathWebBatchInterface = SchemaConstants.PathInterface + "/batch"; 18 | 19 | public readonly static Lazy JsonSettings = 20 | new Lazy(() => ProtocolConstants.InitializeSettings()); 21 | 22 | private static JsonSerializerSettings InitializeSettings() 23 | { 24 | JsonSerializerSettings result = new JsonSerializerSettings(); 25 | result.Error = delegate (object sender, ErrorEventArgs args) { args.ErrorContext.Handled = true; }; 26 | return result; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Threading; 8 | 9 | public abstract class ProtocolJsonDeserializingFactory : ProtocolJsonDeserializingFactory 10 | { 11 | } 12 | 13 | public abstract class ProtocolJsonDeserializingFactory : JsonDeserializingFactory 14 | { 15 | private IJsonNormalizationBehavior jsonNormalizer; 16 | 17 | public override IJsonNormalizationBehavior JsonNormalizer 18 | { 19 | get 20 | { 21 | IJsonNormalizationBehavior result = 22 | LazyInitializer.EnsureInitialized( 23 | ref this.jsonNormalizer, 24 | () => 25 | new ProtocolJsonNormalizer()); 26 | return result; 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolJsonNormalizer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Reflection; 11 | using System.Threading; 12 | 13 | public sealed class ProtocolJsonNormalizer : JsonNormalizerTemplate 14 | { 15 | private IReadOnlyCollection attributeNames; 16 | 17 | public override IReadOnlyCollection AttributeNames 18 | { 19 | get 20 | { 21 | IReadOnlyCollection result = 22 | LazyInitializer.EnsureInitialized>( 23 | ref this.attributeNames, 24 | ProtocolJsonNormalizer.CollectAttributeNames); 25 | return result; 26 | } 27 | } 28 | 29 | private static IReadOnlyCollection CollectAttributeNames() 30 | { 31 | Type attributeNamesType = typeof(ProtocolAttributeNames); 32 | IReadOnlyCollection members = attributeNamesType.GetFields(BindingFlags.Public | BindingFlags.Static); 33 | IReadOnlyCollection protocolAttributeNames = 34 | members 35 | .Select( 36 | (FieldInfo item) => 37 | item.GetValue(null)) 38 | .Cast() 39 | .ToArray(); 40 | IReadOnlyCollection result = 41 | new JsonNormalizer() 42 | .AttributeNames 43 | .Union(protocolAttributeNames) 44 | .ToArray(); 45 | return result; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolSchemaIdentifiers.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class ProtocolSchemaIdentifiers 8 | { 9 | private const string Error = "Error"; 10 | 11 | private const string OperationPatch = "PatchOp"; 12 | 13 | private const string VersionMessages2 = "2.0:"; 14 | 15 | private const string PrefixMessages = "urn:ietf:params:scim:api:messages:"; 16 | public const string PrefixMessages2 = ProtocolSchemaIdentifiers.PrefixMessages + ProtocolSchemaIdentifiers.VersionMessages2; 17 | 18 | private const string ResponseList = "ListResponse"; 19 | private const string RequestBulk = "BulkRequest"; 20 | 21 | private const string ResponseBulk = "BulkResponse"; 22 | 23 | public const string Version2Error = 24 | ProtocolSchemaIdentifiers.PrefixMessages2 + ProtocolSchemaIdentifiers.Error; 25 | 26 | public const string Version2ListResponse = 27 | ProtocolSchemaIdentifiers.PrefixMessages2 + ProtocolSchemaIdentifiers.ResponseList; 28 | 29 | public const string Version2PatchOperation = 30 | ProtocolSchemaIdentifiers.PrefixMessages2 + ProtocolSchemaIdentifiers.OperationPatch; 31 | public const string Version2BulkRequest = 32 | ProtocolSchemaIdentifiers.PrefixMessages2 + ProtocolSchemaIdentifiers.RequestBulk; 33 | 34 | public const string Version2BulkResponse = 35 | ProtocolSchemaIdentifiers.PrefixMessages2 + ProtocolSchemaIdentifiers.ResponseBulk; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryKeys.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class QueryKeys 8 | { 9 | public const string Attributes = "attributes"; 10 | public const string Count = "count"; 11 | public const string Filter = "filter"; 12 | public const string ExcludedAttributes = "excludedAttributes"; 13 | public const string StartIndex = "startIndex"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/QueryResponse.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public sealed class QueryResponse : QueryResponseBase 12 | where TResource : Resource 13 | { 14 | public QueryResponse() 15 | : base(ProtocolSchemaIdentifiers.Version2ListResponse) 16 | { 17 | } 18 | 19 | public QueryResponse(IReadOnlyCollection resources) 20 | : base(ProtocolSchemaIdentifiers.Version2ListResponse, resources) 21 | { 22 | } 23 | 24 | public QueryResponse(IList resources) 25 | : base(ProtocolSchemaIdentifiers.Version2ListResponse, resources) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceRetrievalParameters.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public sealed class ResourceRetrievalParameters : RetrievalParameters, IResourceRetrievalParameters 11 | { 12 | public ResourceRetrievalParameters( 13 | string schemaIdentifier, 14 | string path, 15 | string resourceIdentifier, 16 | IReadOnlyCollection requestedAttributePaths, 17 | IReadOnlyCollection excludedAttributePaths) 18 | : base(schemaIdentifier, path, requestedAttributePaths, excludedAttributePaths) 19 | { 20 | if (null == resourceIdentifier) 21 | { 22 | throw new ArgumentNullException(nameof(resourceIdentifier)); 23 | } 24 | 25 | this.ResourceIdentifier = 26 | new ResourceIdentifier() 27 | { 28 | Identifier = resourceIdentifier, 29 | SchemaIdentifier = this.SchemaIdentifier 30 | }; 31 | } 32 | 33 | public ResourceRetrievalParameters( 34 | string schemaIdentifier, 35 | string path, 36 | string resourceIdentifier) 37 | : base(schemaIdentifier, path) 38 | { 39 | if (null == resourceIdentifier) 40 | { 41 | throw new ArgumentNullException(nameof(resourceIdentifier)); 42 | } 43 | 44 | this.ResourceIdentifier = 45 | new ResourceIdentifier() 46 | { 47 | Identifier = resourceIdentifier, 48 | SchemaIdentifier = this.SchemaIdentifier 49 | }; 50 | } 51 | 52 | public IResourceIdentifier ResourceIdentifier 53 | { 54 | get; 55 | private set; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Response.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Globalization; 9 | using System.Linq; 10 | using System.Net; 11 | 12 | internal class Response : IResponse 13 | { 14 | private readonly object thisLock = new object(); 15 | 16 | private HttpResponseClass responseClass; 17 | private HttpStatusCode statusCode; 18 | private string statusCodeValue; 19 | 20 | private enum HttpResponseClass 21 | { 22 | Informational = 1, 23 | Success = 2, 24 | Redirection = 3, 25 | ClientError = 4, 26 | ServerError = 5 27 | } 28 | 29 | public HttpStatusCode Status 30 | { 31 | get 32 | { 33 | return this.statusCode; 34 | } 35 | 36 | set 37 | { 38 | this.StatusCodeValue = ((int)value).ToString(CultureInfo.InvariantCulture); 39 | } 40 | } 41 | 42 | public string StatusCodeValue 43 | { 44 | get 45 | { 46 | return this.statusCodeValue; 47 | } 48 | 49 | set 50 | { 51 | lock (this.thisLock) 52 | { 53 | this.statusCode = (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), value); 54 | this.statusCodeValue = value; 55 | char responseClassSignifier = this.statusCodeValue.First(); 56 | double responseClassNumber = char.GetNumericValue(responseClassSignifier); 57 | int responseClassCode = Convert.ToInt32(responseClassNumber); 58 | this.responseClass = (HttpResponseClass)Enum.ToObject(typeof(HttpResponseClass), responseClassCode); 59 | } 60 | } 61 | } 62 | 63 | public bool IsError() 64 | { 65 | bool result = HttpResponseClass.ClientError == this.responseClass 66 | || HttpResponseClass.ServerError == this.responseClass; 67 | return result; 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchemaIdentifier.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | public class SchemaIdentifier : ISchemaIdentifier 10 | { 11 | public SchemaIdentifier(string value) 12 | { 13 | if (string.IsNullOrWhiteSpace(value)) 14 | { 15 | throw new ArgumentNullException(nameof(value)); 16 | } 17 | 18 | this.Value = value; 19 | } 20 | 21 | public string Value 22 | { 23 | get; 24 | private set; 25 | } 26 | 27 | public string FindPath() 28 | { 29 | if (!this.TryFindPath(out string result)) 30 | { 31 | throw new NotSupportedException(this.Value); 32 | } 33 | 34 | return result; 35 | } 36 | 37 | public bool TryFindPath(out string path) 38 | { 39 | path = null; 40 | 41 | switch (this.Value) 42 | { 43 | case SchemaIdentifiers.Core2EnterpriseUser: 44 | case SchemaIdentifiers.Core2User: 45 | path = ProtocolConstants.PathUsers; 46 | return true; 47 | case SchemaIdentifiers.Core2Group: 48 | path = ProtocolConstants.PathGroups; 49 | return true; 50 | case SchemaIdentifiers.None: 51 | path = SchemaConstants.PathInterface; 52 | return true; 53 | default: 54 | return false; 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactoryBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public abstract class SchematizedJsonDeserializingFactoryBase : 11 | ProtocolJsonDeserializingFactory, 12 | ISchematizedJsonDeserializingFactory 13 | { 14 | public abstract IReadOnlyCollection Extensions { get; set; } 15 | public abstract IResourceJsonDeserializingFactory GroupDeserializationBehavior { get; set; } 16 | public abstract ISchematizedJsonDeserializingFactory PatchRequest2DeserializationBehavior { get; set; } 17 | public abstract IResourceJsonDeserializingFactory UserDeserializationBehavior { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SortOrder.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum SortOrder 8 | { 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ascending", Justification = "The casing is as specified by a protocol")] 10 | ascending = 0, 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "descending", Justification = "The casing is as specified by a protocol")] 12 | descending = 1 13 | } 14 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Address.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Address : AddressBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/AddressBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class AddressBase : TypedItem 11 | { 12 | public const string Home = "home"; 13 | public const string Other = "other"; 14 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Untyped", Justification = "False analysis")] 15 | public const string Untyped = "untyped"; 16 | public const string Work = "work"; 17 | 18 | internal AddressBase() 19 | { 20 | } 21 | 22 | [DataMember(Name = AttributeNames.Country, IsRequired = false, EmitDefaultValue = false)] 23 | public string Country 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | [DataMember(Name = AttributeNames.Formatted, IsRequired = false, EmitDefaultValue = false)] 30 | public string Formatted 31 | { 32 | get; 33 | set; 34 | } 35 | 36 | [DataMember(Name = AttributeNames.Locality, IsRequired = false, EmitDefaultValue = false)] 37 | public string Locality 38 | { 39 | get; 40 | set; 41 | } 42 | 43 | [DataMember(Name = AttributeNames.PostalCode, IsRequired = false, EmitDefaultValue = false)] 44 | public string PostalCode 45 | { 46 | get; 47 | set; 48 | } 49 | 50 | [DataMember(Name = AttributeNames.Region, IsRequired = false, EmitDefaultValue = false)] 51 | public string Region 52 | { 53 | get; 54 | set; 55 | } 56 | 57 | [DataMember(Name = AttributeNames.StreetAddress, IsRequired = false, EmitDefaultValue = false)] 58 | public string StreetAddress 59 | { 60 | get; 61 | set; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/AttributeDataType.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Enum of type names will contain type names")] 8 | public enum AttributeDataType 9 | { 10 | @string, 11 | boolean, 12 | @decimal, 13 | integer, 14 | dateTime, 15 | binary, 16 | reference, 17 | complex 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/BulkRequestsFeature.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class BulkRequestsFeature : FeatureBase 11 | { 12 | private BulkRequestsFeature() 13 | { 14 | } 15 | 16 | public int ConcurrentOperations 17 | { 18 | get; 19 | private set; 20 | } 21 | 22 | [DataMember(Name = AttributeNames.MaximumOperations)] 23 | public int MaximumOperations 24 | { 25 | get; 26 | private set; 27 | } 28 | 29 | [DataMember(Name = AttributeNames.MaximumPayloadSize)] 30 | public int MaximumPayloadSize 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | public static BulkRequestsFeature CreateUnsupportedFeature() 37 | { 38 | BulkRequestsFeature result = 39 | new BulkRequestsFeature() 40 | { 41 | Supported = false 42 | }; 43 | return result; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ComparisonOperator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum ComparisonOperator 8 | { 9 | BitAnd, 10 | EndsWith, 11 | Equals, 12 | EqualOrGreaterThan, 13 | GreaterThan, 14 | EqualOrLessThan, 15 | LessThan, 16 | Includes, 17 | IsMemberOf, 18 | MatchesExpression, 19 | NotBitAnd, 20 | NotEquals, 21 | NotMatchesExpression 22 | } 23 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | public abstract class ConfigurationFactory 10 | where TException : Exception 11 | { 12 | public abstract TConfiguration Create( 13 | Lazy defaultConfiguration, 14 | out TException configurationError); 15 | } 16 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ConfigurationSectionFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Configuration; 9 | 10 | public class ConfigurationSectionFactory : 11 | ConfigurationFactory 12 | where TConfiguration : ConfigurationSection 13 | { 14 | public ConfigurationSectionFactory(string sectionName) 15 | { 16 | if (string.IsNullOrEmpty(sectionName)) 17 | { 18 | throw new ArgumentNullException(nameof(sectionName)); 19 | } 20 | 21 | this.SectionName = sectionName; 22 | } 23 | 24 | private string SectionName 25 | { 26 | get; 27 | set; 28 | } 29 | 30 | public override TConfiguration Create( 31 | Lazy defaultConfiguration, 32 | out ConfigurationErrorsException errors) 33 | { 34 | errors = null; 35 | 36 | if (null == defaultConfiguration) 37 | { 38 | throw new ArgumentNullException(nameof(defaultConfiguration)); 39 | } 40 | 41 | TConfiguration result = null; 42 | try 43 | { 44 | result = (TConfiguration)ConfigurationManager.GetSection(this.SectionName); 45 | } 46 | catch (ConfigurationErrorsException exception) 47 | { 48 | errors = exception; 49 | } 50 | 51 | if (null == result) 52 | { 53 | result = defaultConfiguration.Value; 54 | } 55 | 56 | return result; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2EnterpriseUser.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1501:AvoidExcessiveInheritance", Justification = "The long inheritence hieararchy reflects the the System for Cross-Domain Identity Management inheritence mechanism.")] 10 | [DataContract(Name = Core2EnterpriseUser.DataContractName)] 11 | public sealed class Core2EnterpriseUser : Core2EnterpriseUserBase 12 | { 13 | private const string DataContractName = "Core2EnterpriseUser"; 14 | 15 | public Core2EnterpriseUser() 16 | : base() 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2EnterpriseUserBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class Core2EnterpriseUserBase : Core2UserBase 11 | { 12 | protected Core2EnterpriseUserBase() 13 | : base() 14 | { 15 | this.AddSchema(SchemaIdentifiers.Core2EnterpriseUser); 16 | this.EnterpriseExtension = new ExtensionAttributeEnterpriseUser2(); 17 | } 18 | 19 | [DataMember(Name = AttributeNames.ExtensionEnterpriseUser2)] 20 | public ExtensionAttributeEnterpriseUser2 EnterpriseExtension 21 | { 22 | get; 23 | set; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2Error.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Core2Error : ErrorBase 11 | { 12 | public Core2Error( 13 | string detail, 14 | int status, 15 | string scimType = null // https://datatracker.ietf.org/doc/html/rfc7644#section-3.12 16 | ) 17 | { 18 | this.AddSchema(ProtocolSchemaIdentifiers.Version2Error); 19 | 20 | this.Detail = detail; 21 | this.Status = status; 22 | this.ScimType = scimType != null ? scimType : null; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2Group.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Core2Group : Core2GroupBase 11 | { 12 | public Core2Group() 13 | : base() 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2GroupJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public sealed class Core2GroupJsonDeserializingFactory : JsonDeserializingFactory 11 | { 12 | public override Core2Group Create(IReadOnlyDictionary json) 13 | { 14 | if (null == json) 15 | { 16 | throw new ArgumentNullException(nameof(json)); 17 | } 18 | 19 | Core2Group result = base.Create(json); 20 | 21 | foreach (KeyValuePair entry in json) 22 | { 23 | if 24 | ( 25 | entry.Key.StartsWith(SchemaIdentifiers.PrefixExtension, StringComparison.OrdinalIgnoreCase) 26 | && entry.Value is Dictionary nestedObject 27 | ) 28 | { 29 | result.AddCustomAttribute(entry.Key, nestedObject); 30 | } 31 | } 32 | 33 | return result; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2Metadata.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public sealed class Core2Metadata 12 | { 13 | [DataMember(Name = AttributeNames.ResourceType, Order = 0)] 14 | public string ResourceType 15 | { 16 | get; 17 | set; 18 | } 19 | [DataMember(Name = AttributeNames.Created, Order = 1)] 20 | public DateTime Created 21 | { 22 | get; 23 | set; 24 | } 25 | [DataMember(Name = AttributeNames.LastModified, Order = 2)] 26 | public DateTime LastModified 27 | { 28 | get; 29 | set; 30 | } 31 | [DataMember(Name = AttributeNames.Version, Order = 3)] 32 | public string Version 33 | { 34 | get; 35 | set; 36 | } 37 | [DataMember(Name = AttributeNames.Location, Order = 4)] 38 | public string Location 39 | { 40 | get; 41 | set; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2ResourceTypeJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class Core2ResourceTypeJsonDeserializingFactory : 8 | JsonDeserializingFactory 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2ServiceConfiguration.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Core2ServiceConfiguration : ServiceConfigurationBase 11 | { 12 | public Core2ServiceConfiguration( 13 | BulkRequestsFeature bulkRequestsSupport, 14 | bool supportsEntityTags, 15 | bool supportsFiltering, 16 | bool supportsPasswordChange, 17 | bool supportsPatching, 18 | bool supportsSorting) 19 | { 20 | this.AddSchema(SchemaIdentifiers.Core2ServiceConfiguration); 21 | this.Metadata = 22 | new Core2Metadata() 23 | { 24 | ResourceType = Types.ServiceProviderConfiguration 25 | }; 26 | 27 | this.BulkRequests = bulkRequestsSupport; 28 | this.EntityTags = new Feature(supportsEntityTags); 29 | this.Filtering = new Feature(supportsFiltering); 30 | this.PasswordChange = new Feature(supportsPasswordChange); 31 | this.Patching = new Feature(supportsPatching); 32 | this.Sorting = new Feature(supportsSorting); 33 | } 34 | 35 | [DataMember(Name = AttributeNames.Metadata)] 36 | public Core2Metadata Metadata 37 | { 38 | get; 39 | set; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2ServiceConfigurationJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class Core2ServiceConfigurationJsonDeserializingFactory : 8 | JsonDeserializingFactory 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2User.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Core2User : Core2UserBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Core2UserJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class Core2UserJsonDeserializingFactory : JsonDeserializingFactory 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/DateTimeExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Globalization; 9 | 10 | internal static class DateTimeExtension 11 | { 12 | private const string FormatStringRoundtrip = "O"; 13 | 14 | public static string ToRoundtripString(this DateTime dateTime) 15 | { 16 | string result = dateTime.ToString(DateTimeExtension.FormatStringRoundtrip, CultureInfo.InvariantCulture); 17 | return result; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ElectronicMailAddress.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class ElectronicMailAddress : ElectronicMailAddressBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ElectronicMailAddressBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public class ElectronicMailAddressBase : TypedValue 11 | { 12 | internal ElectronicMailAddressBase() 13 | { 14 | } 15 | 16 | public const string Home = "home"; 17 | public const string Other = "other"; 18 | public const string Work = "work"; 19 | } 20 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/EnumerableExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | 11 | internal static class EnumerableExtension 12 | { 13 | public static int CheckedCount(this IEnumerable enumeration) 14 | { 15 | long longCount = enumeration.LongCount(); 16 | int result = Convert.ToInt32(longCount); 17 | return result; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ErrorBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class ErrorBase : Schematized 11 | { 12 | [DataMember(Name = "scimType", Order = 1)] //AttributeNames.ScimType 13 | public virtual string ScimType 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | [DataMember(Name = "detail", Order = 2)] //AttributeNames.Detail 20 | public virtual string Detail 21 | { 22 | get; 23 | set; 24 | } 25 | 26 | [DataMember(Name = "status", Order = 3)] //AttributeNames.Status 27 | public virtual int Status 28 | { 29 | get; 30 | set; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/EventTokenClaimTypes.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class EventTokenClaimTypes 8 | { 9 | public const string Audience = "aud"; 10 | public const string Expiration = "exp"; 11 | public const string Events = "events"; 12 | public const string Identifier = "jti"; 13 | public const string IssuedAt = "iat"; 14 | public const string Issuer = "iss"; 15 | public const string NotBefore = "nbf"; 16 | public const string Subject = "sub"; 17 | public const string Transaction = "txn"; 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/EventTokenFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IdentityModel.Tokens.Jwt; 10 | 11 | public abstract class EventTokenFactory 12 | { 13 | protected EventTokenFactory(string issuer, JwtHeader header) 14 | { 15 | if (string.IsNullOrWhiteSpace(issuer)) 16 | { 17 | throw new ArgumentNullException(nameof(issuer)); 18 | } 19 | 20 | this.Issuer = issuer; 21 | this.Header = header ?? throw new ArgumentNullException(nameof(header)); 22 | } 23 | 24 | public JwtHeader Header 25 | { 26 | get; 27 | private set; 28 | } 29 | 30 | public string Issuer 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | public abstract IEventToken Create(IDictionary events); 37 | } 38 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ExtensionAttributeEnterpriseUser2.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // ------------------------------------------------------------ 4 | 5 | 6 | namespace Microsoft.SCIM 7 | { 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public sealed class ExtensionAttributeEnterpriseUser2 : ExtensionAttributeEnterpriseUserBase 12 | { 13 | [DataMember(Name = AttributeNames.Manager, IsRequired = false, EmitDefaultValue = false)] 14 | public Manager Manager 15 | { 16 | get; 17 | set; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ExtensionAttributeEnterpriseUserBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class ExtensionAttributeEnterpriseUserBase 11 | { 12 | [DataMember(Name = AttributeNames.CostCenter, IsRequired = false, EmitDefaultValue = false)] 13 | public string CostCenter 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | [DataMember(Name = AttributeNames.Department, IsRequired = false, EmitDefaultValue = false)] 20 | public string Department 21 | { 22 | get; 23 | set; 24 | } 25 | 26 | [DataMember(Name = AttributeNames.Division, IsRequired = false, EmitDefaultValue = false)] 27 | public string Division 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | [DataMember(Name = AttributeNames.EmployeeNumber, IsRequired = false, EmitDefaultValue = false)] 34 | public string EmployeeNumber 35 | { 36 | get; 37 | set; 38 | } 39 | 40 | [DataMember(Name = AttributeNames.Organization, IsRequired = false, EmitDefaultValue = false)] 41 | public string Organization 42 | { 43 | get; 44 | set; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ExtensionAttributeWindowsAzureActiveDirectoryGroup.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public sealed class ExtensionAttributeWindowsAzureActiveDirectoryGroup 12 | { 13 | [DataMember(Name = AttributeNames.ElectronicMailAddresses)] 14 | public IEnumerable ElectronicMailAddresses 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | [DataMember(Name = AttributeNames.ExternalIdentifier)] 21 | public string ExternalIdentifier 22 | { 23 | get; 24 | set; 25 | } 26 | 27 | [DataMember(Name = AttributeNames.MailEnabled, IsRequired = false)] 28 | public bool MailEnabled 29 | { 30 | get; 31 | set; 32 | } 33 | 34 | [DataMember(Name = AttributeNames.SecurityEnabled, IsRequired = false)] 35 | public bool SecurityEnabled 36 | { 37 | get; 38 | set; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Feature.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Feature : FeatureBase 11 | { 12 | public Feature(bool supported) 13 | { 14 | this.Supported = supported; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/FeatureBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class FeatureBase 11 | { 12 | [DataMember(Name = AttributeNames.Supported)] 13 | public bool Supported 14 | { 15 | get; 16 | set; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Friends.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | using System.Runtime.CompilerServices; 6 | 7 | [assembly: InternalsVisibleTo("Microsoft.Graph.Provisioning, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 8 | [assembly: InternalsVisibleTo("Microsoft.SystemForCrossDomainIdentityManagement.Protocol, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 9 | [assembly: InternalsVisibleTo("Microsoft.SystemForCrossDomainIdentityManagement.Service, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 10 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AzureAD/SCIMReferenceCode/d445ef901981fef684a220fe8cf6c97b588600fd/Microsoft.SystemForCrossDomainIdentityManagement/Schemas/GlobalSuppressions.cs -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/GroupBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public abstract class GroupBase : Resource 12 | { 13 | [DataMember(Name = AttributeNames.DisplayName)] 14 | public virtual string DisplayName 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | [DataMember(Name = AttributeNames.Members, IsRequired = false, EmitDefaultValue = false)] 21 | public virtual IEnumerable Members 22 | { 23 | get; 24 | set; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IChange.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IChange 8 | { 9 | string Watermark { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IEventToken.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IdentityModel.Tokens.Jwt; 10 | 11 | public interface IEventToken 12 | { 13 | IReadOnlyCollection Audience { get; set; } 14 | IDictionary Events { get; } 15 | DateTime? Expiration { get; set; } 16 | JwtHeader Header { get; } 17 | string Identifier { get; } 18 | DateTime IssuedAt { get; } 19 | string Issuer { get; } 20 | DateTime? NotBefore { get; } 21 | string Subject { get; set; } 22 | string Transaction { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IJsonNormalizationBehavior.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IJsonNormalizationBehavior 10 | { 11 | IReadOnlyDictionary Normalize(IReadOnlyDictionary json); 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IJsonSerializable.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IJsonSerializable 10 | { 11 | Dictionary ToJson(); 12 | string Serialize(); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IResourceJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces", Justification = "This interface is a public interface that serves to refine the type of the generic member relative to the base interface")] 8 | public interface IResourceJsonDeserializingFactory : 9 | ISchematizedJsonDeserializingFactory 10 | where TOutput : Resource 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ISchematizedJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface ISchematizedJsonDeserializingFactory where TOutput : Schematized 10 | { 11 | TOutput Create(IReadOnlyDictionary json); 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ISystemForCrossDomainIdentityManagementConfiguration.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface ISystemForCrossDomainIdentityManagementConfiguration 8 | { 9 | bool AcceptLargeObjects { get; } 10 | } 11 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ISystemForCrossDomainIdentityManagementResourceIdentifier.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | internal interface ISystemForCrossDomainIdentityManagementResourceIdentifier 8 | { 9 | string RelativePath { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/IUnixTime.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | public interface IUnixTime 10 | { 11 | long EpochTimestamp { get; } 12 | 13 | DateTime ToUniversalTime(); 14 | } 15 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/InstantMessaging.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class InstantMessaging : InstantMessagingBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/InstantMessagingBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class InstantMessagingBase : TypedValue 11 | { 12 | public const string Aim = "aim"; 13 | public const string Gtalk = "gtalk"; 14 | public const string Icq = "icq"; 15 | public const string Msn = "msn"; 16 | public const string Qq = "qq"; 17 | public const string Skype = "skype"; 18 | public const string Xmpp = "xmpp"; 19 | public const string Yahoo = "yahoo"; 20 | 21 | internal InstantMessagingBase() 22 | { 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/JsonNormalizer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Reflection; 11 | using System.Threading; 12 | 13 | public sealed class JsonNormalizer : JsonNormalizerTemplate 14 | { 15 | private IReadOnlyCollection attributeNames; 16 | 17 | public override IReadOnlyCollection AttributeNames 18 | { 19 | get 20 | { 21 | IReadOnlyCollection result = 22 | LazyInitializer.EnsureInitialized>( 23 | ref this.attributeNames, 24 | JsonNormalizer.CollectAttributeNames); 25 | return result; 26 | } 27 | } 28 | 29 | private static IReadOnlyCollection CollectAttributeNames() 30 | { 31 | Type attributeNamesType = typeof(AttributeNames); 32 | IReadOnlyCollection members = attributeNamesType.GetFields(BindingFlags.Public | BindingFlags.Static); 33 | IReadOnlyCollection result = 34 | members 35 | .Select( 36 | (FieldInfo item) => 37 | item.GetValue(null)) 38 | .Cast() 39 | .ToArray(); 40 | return result; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/LogicalOperator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum LogicalOperator 8 | { 9 | And, 10 | Or 11 | } 12 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Manager.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Manager 11 | { 12 | [DataMember(Name = AttributeNames.Value)] 13 | public string Value 14 | { 15 | get; 16 | set; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ManagerDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public class ManagerDeserializingFactory : JsonDeserializingFactory 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Member.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Member : MemberBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/MemberBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class MemberBase 11 | { 12 | internal MemberBase() 13 | { 14 | } 15 | 16 | [DataMember(Name = AttributeNames.Type, IsRequired = false, EmitDefaultValue = false)] 17 | public string TypeName 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | [DataMember(Name = AttributeNames.Value)] 24 | public string Value 25 | { 26 | get; 27 | set; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Mutability.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum Mutability 8 | { 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "immutable", Justification = "The casing is as specified by a protocol")] 10 | immutable, 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "read", Justification = "The casing is as specified by a protocol")] 12 | readOnly, 13 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "read", Justification = "The casing is as specified by a protocol")] 14 | readWrite, 15 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "write", Justification = "The casing is as specified by a protocol")] 16 | writeOnly 17 | } 18 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Name.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Name 11 | { 12 | [DataMember(Name = AttributeNames.Formatted, Order = 0, IsRequired = false, EmitDefaultValue = false)] 13 | public string Formatted 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | [DataMember(Name = AttributeNames.FamilyName, Order = 1, IsRequired = false, EmitDefaultValue = false)] 20 | public string FamilyName 21 | { 22 | get; 23 | set; 24 | } 25 | 26 | [DataMember(Name = AttributeNames.GivenName, Order = 1, IsRequired = false, EmitDefaultValue = false)] 27 | public string GivenName 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | [DataMember(Name = AttributeNames.HonorificPrefix, Order = 1, IsRequired = false, EmitDefaultValue = false)] 34 | public string HonorificPrefix 35 | { 36 | get; 37 | set; 38 | } 39 | 40 | [DataMember(Name = AttributeNames.HonorificSuffix, Order = 1, IsRequired = false, EmitDefaultValue = false)] 41 | public string HonorificSuffix 42 | { 43 | get; 44 | set; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/PhoneNumber.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class PhoneNumber : PhoneNumberBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/PhoneNumberBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class PhoneNumberBase : TypedValue 11 | { 12 | public const string Fax = "fax"; 13 | public const string Home = "home"; 14 | public const string Mobile = "mobile"; 15 | public const string Other = "other"; 16 | public const string Pager = "pager"; 17 | public const string Work = "work"; 18 | 19 | internal PhoneNumberBase() 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Photo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Photo : PhotoBase 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/PhotoBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public class PhotoBase : TypedValue 11 | { 12 | internal PhotoBase() 13 | { 14 | } 15 | 16 | public const string Photo = "photo"; 17 | public const string Thumbnail = "thumbnail"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/PluralUnsecuredEventTokenFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public class PluralUnsecuredEventTokenFactory : UnsecuredEventTokenFactory 11 | { 12 | public PluralUnsecuredEventTokenFactory(string issuer) 13 | : base(issuer) 14 | { 15 | } 16 | 17 | public override IEventToken Create(IDictionary events) 18 | { 19 | if (null == events) 20 | { 21 | throw new ArgumentNullException(nameof(events)); 22 | } 23 | 24 | IEventToken result = new EventToken(this.Issuer, this.Header, events); 25 | return result; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Resource.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | [DataContract] 11 | public abstract class Resource : Schematized 12 | { 13 | [DataMember(Name = AttributeNames.ExternalIdentifier, IsRequired = false, EmitDefaultValue = false)] 14 | public string ExternalIdentifier 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | [DataMember(Name = AttributeNames.Identifier)] 21 | public string Identifier 22 | { 23 | get; 24 | set; 25 | } 26 | 27 | public virtual bool TryGetIdentifier(Uri baseIdentifier, out Uri identifier) 28 | { 29 | identifier = null; 30 | return false; 31 | } 32 | 33 | public virtual bool TryGetPathIdentifier(out Uri pathIdentifier) 34 | { 35 | pathIdentifier = null; 36 | return false; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Returned.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum Returned 8 | { 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "always", Justification = "The casing is as specified by a protocol")] 10 | always, 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "default", Justification = "The casing is as specified by a protocol")] 12 | @default, 13 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "never", Justification = "The casing is as specified by a protocol")] 14 | never, 15 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "request", Justification = "The casing is as specified by a protocol")] 16 | request 17 | } 18 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Role.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class Role : RoleBase 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/RoleBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class RoleBase : TypedItem 11 | { 12 | [DataMember(Name = AttributeNames.Display, IsRequired = false, EmitDefaultValue = false)] 13 | public string Display 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | [DataMember(Name = AttributeNames.Value, IsRequired = false, EmitDefaultValue = false)] 20 | public string Value 21 | { 22 | get; 23 | set; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/SchemaConstants.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class SchemaConstants 8 | { 9 | public const string PathInterface = "scim"; 10 | public const string SeparatorSchemaIdentifierAttribute = ":"; 11 | } 12 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/SchemaIdentifiers.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class SchemaIdentifiers 8 | { 9 | public const string Extension = "extension:"; 10 | 11 | private const string ExtensionEnterprise2 = SchemaIdentifiers.Extension + "enterprise:2.0:"; 12 | 13 | public const string None = "/"; 14 | 15 | public const string PrefixTypes1 = "urn:scim:schemas:"; 16 | private const string PrefixTypes2 = "urn:ietf:params:scim:schemas:"; 17 | 18 | private const string VersionSchemasCore2 = "core:2.0:"; 19 | 20 | public const string Core2EnterpriseUser = 21 | SchemaIdentifiers.PrefixTypes2 + 22 | SchemaIdentifiers.ExtensionEnterprise2 + 23 | Types.User; 24 | 25 | public const string Core2Group = 26 | SchemaIdentifiers.PrefixTypes2 + 27 | SchemaIdentifiers.VersionSchemasCore2 + 28 | Types.Group; 29 | 30 | public const string Core2ResourceType = 31 | SchemaIdentifiers.PrefixTypes2 + 32 | SchemaIdentifiers.ExtensionEnterprise2 + 33 | Types.ResourceType; 34 | 35 | public const string Core2ServiceConfiguration = 36 | SchemaIdentifiers.PrefixTypes2 + 37 | SchemaIdentifiers.VersionSchemasCore2 + 38 | Types.ServiceProviderConfiguration; 39 | 40 | public const string Core2User = 41 | SchemaIdentifiers.PrefixTypes2 + 42 | SchemaIdentifiers.VersionSchemasCore2 + 43 | Types.User; 44 | 45 | public const string Core2Schema = 46 | SchemaIdentifiers.PrefixTypes2 + 47 | SchemaIdentifiers.VersionSchemasCore2 + 48 | Types.Schema; 49 | 50 | public const string PrefixExtension = 51 | SchemaIdentifiers.PrefixTypes2 + 52 | SchemaIdentifiers.Extension; 53 | 54 | } 55 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/SingularEventToken.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Collections.ObjectModel; 10 | using System.Linq; 11 | 12 | public abstract class SingularEventToken : EventTokenDecorator 13 | { 14 | protected SingularEventToken(IEventToken innerToken) 15 | : base(innerToken) 16 | { 17 | if (this.InnerToken.Events.Count != 1) 18 | { 19 | throw new ArgumentException(SystemForCrossDomainIdentityManagementSchemasResources.ExceptionSingleEventExpected); 20 | } 21 | 22 | KeyValuePair singleEvent = this.InnerToken.Events.Single(); 23 | this.SchemaIdentifier = singleEvent.Key; 24 | this.Event = new ReadOnlyDictionary((IDictionary)singleEvent.Value); 25 | } 26 | 27 | protected SingularEventToken(string serialized) 28 | : this(new EventToken(serialized)) 29 | { 30 | } 31 | 32 | public IReadOnlyDictionary Event 33 | { 34 | get; 35 | private set; 36 | } 37 | 38 | public string SchemaIdentifier 39 | { 40 | get; 41 | private set; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/SingularUnsecuredEventTokenFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public class SingularUnsecuredEventTokenFactory : UnsecuredEventTokenFactory 11 | { 12 | public SingularUnsecuredEventTokenFactory(string issuer, string eventSchemaIdentifier) 13 | : base(issuer) 14 | { 15 | if (string.IsNullOrWhiteSpace(eventSchemaIdentifier)) 16 | { 17 | throw new ArgumentNullException(nameof(eventSchemaIdentifier)); 18 | } 19 | 20 | this.EventSchemaIdentifier = eventSchemaIdentifier; 21 | } 22 | 23 | private string EventSchemaIdentifier 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | public override IEventToken Create(IDictionary events) 30 | { 31 | IDictionary tokenEvents = new Dictionary(1); 32 | tokenEvents.Add(this.EventSchemaIdentifier, events); 33 | IEventToken result = new EventToken(this.Issuer, this.Header, tokenEvents); 34 | return result; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/SpecificationVersion.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | public static class SpecificationVersion 10 | { 11 | private static readonly Lazy VersionOneOhValue = 12 | new Lazy( 13 | () => 14 | new Version(1, 0)); 15 | 16 | private static readonly Lazy VersionOneOneValue = 17 | new Lazy( 18 | () => 19 | new Version(1, 1)); 20 | 21 | private static readonly Lazy VersionTwoOhValue = 22 | new Lazy( 23 | () => 24 | new Version(2, 0)); 25 | 26 | // NOTE: This version is to be used for DCaaS only. 27 | private static readonly Lazy VersionTwoOhOneValue = 28 | new Lazy( 29 | () => 30 | new Version(2, 0, 1)); 31 | 32 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Oh", Justification = "Not an abbreviation")] 33 | public static Version VersionOneOh 34 | { 35 | get 36 | { 37 | return SpecificationVersion.VersionOneOhValue.Value; 38 | } 39 | } 40 | 41 | public static Version VersionOneOne 42 | { 43 | get 44 | { 45 | return SpecificationVersion.VersionOneOneValue.Value; 46 | } 47 | } 48 | 49 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Oh", Justification = "Not an abbreviation")] 50 | public static Version VersionTwoOhOne 51 | { 52 | get 53 | { 54 | return SpecificationVersion.VersionTwoOhOneValue.Value; 55 | } 56 | } 57 | 58 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Oh", Justification = "Not an abbreviation")] 59 | public static Version VersionTwoOh 60 | { 61 | get 62 | { 63 | return SpecificationVersion.VersionTwoOhValue.Value; 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TrustedJsonFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using Newtonsoft.Json; 9 | 10 | public class TrustedJsonFactory : JsonFactory 11 | { 12 | public override Dictionary Create(string json) 13 | { 14 | Dictionary result = 15 | (Dictionary)JsonConvert.DeserializeObject( 16 | json); 17 | return result; 18 | } 19 | 20 | public override string Create(string[] json) 21 | { 22 | string result = JsonConvert.SerializeObject(json); 23 | return result; 24 | } 25 | 26 | public override string Create(Dictionary json) 27 | { 28 | string result = JsonConvert.SerializeObject(json); 29 | return result; 30 | } 31 | 32 | public override string Create(IDictionary json) 33 | { 34 | string result = JsonConvert.SerializeObject(json); 35 | return result; 36 | } 37 | 38 | public override string Create(IReadOnlyDictionary json) 39 | { 40 | string result = JsonConvert.SerializeObject(json); 41 | return result; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TypeSchemeJsonDeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public sealed class TypeSchemeJsonDeserializingFactory : JsonDeserializingFactory 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TypedItem.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class TypedItem 11 | { 12 | [DataMember(Name = AttributeNames.Type)] 13 | public string ItemType 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | [DataMember(Name = AttributeNames.Primary, IsRequired = false)] 20 | public bool Primary 21 | { 22 | get; 23 | set; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/TypedValue.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class TypedValue : TypedItem 11 | { 12 | [DataMember(Name = AttributeNames.Value, Order = 0)] 13 | public string Value 14 | { 15 | get; 16 | set; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Types.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public static class Types 8 | { 9 | public const string Group = "Group"; 10 | public const string ResourceType = "ResourceType"; 11 | public const string ServiceProviderConfiguration = "ServiceProviderConfig"; 12 | public const string User = "User"; 13 | public const string Schema = "Schema"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Uniqueness.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public enum Uniqueness 8 | { 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "none", Justification = "The casing is as specified by a protocol")] 10 | none, 11 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "server", Justification = "The casing is as specified by a protocol")] 12 | server, 13 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "global", Justification = "The casing is as specified by a protocol")] 14 | global 15 | } 16 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/UnixTime.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Globalization; 9 | 10 | // Refer to https://en.wikipedia.org/wiki/Unix_time 11 | public class UnixTime : IUnixTime 12 | { 13 | public static readonly DateTime Epoch = 14 | new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 15 | 16 | public UnixTime(long epochTimestamp) 17 | { 18 | this.EpochTimestamp = epochTimestamp; 19 | } 20 | 21 | public UnixTime(int epochTimestamp) 22 | : this(Convert.ToInt64(epochTimestamp)) 23 | { 24 | } 25 | 26 | public UnixTime(double epochTimestamp) 27 | : this(Convert.ToInt64(epochTimestamp)) 28 | { 29 | } 30 | 31 | public UnixTime(TimeSpan sinceEpoch) 32 | : this(sinceEpoch.TotalSeconds) 33 | { 34 | } 35 | 36 | public UnixTime(DateTime dateTime) 37 | : this(dateTime.ToUniversalTime().Subtract(UnixTime.Epoch)) 38 | { 39 | } 40 | 41 | public DateTime ToUniversalTime() 42 | { 43 | DateTime result = UnixTime.Epoch.AddSeconds(this.EpochTimestamp); 44 | return result; 45 | } 46 | 47 | public long EpochTimestamp 48 | { 49 | get; 50 | private set; 51 | } 52 | 53 | public override string ToString() 54 | { 55 | string result = this.EpochTimestamp.ToString(CultureInfo.InvariantCulture); 56 | return result; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/UnsecuredEventTokenFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.IdentityModel.Tokens.Jwt; 9 | 10 | public abstract class UnsecuredEventTokenFactory : EventTokenFactory 11 | { 12 | 13 | private static readonly Lazy UnsecuredTokenHeader = 14 | new Lazy( 15 | () => 16 | UnsecuredEventTokenFactory.ComposeHeader()); 17 | 18 | protected UnsecuredEventTokenFactory(string issuer) 19 | : base(issuer, UnsecuredEventTokenFactory.UnsecuredTokenHeader.Value) 20 | { 21 | } 22 | 23 | private static JwtHeader ComposeHeader() 24 | { 25 | JwtHeader result = new JwtHeader(); 26 | result.Add(EventToken.HeaderKeyAlgorithm, EventToken.JwtAlgorithmNone); 27 | return result; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/User.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public sealed class User : UserBase 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Schemas/UserBase.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Runtime.Serialization; 8 | 9 | [DataContract] 10 | public abstract class UserBase : Resource 11 | { 12 | [DataMember(Name = AttributeNames.UserName)] 13 | public virtual string UserName 14 | { 15 | get; 16 | set; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkCreationOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | internal sealed class BulkCreationOperationContext : BulkOperationContextBase, IBulkCreationOperationContext 11 | { 12 | private readonly IBulkCreationOperationState receivedState; 13 | 14 | public BulkCreationOperationContext( 15 | IRequest request, 16 | BulkRequestOperation operation) 17 | { 18 | if (null == request) 19 | { 20 | throw new ArgumentNullException(nameof(request)); 21 | } 22 | 23 | if (null == operation) 24 | { 25 | throw new ArgumentNullException(nameof(operation)); 26 | } 27 | 28 | this.receivedState = new BulkCreationOperationState(request, operation, this); 29 | this.Initialize(this.receivedState); 30 | this.PendingState = new BulkOperationState(request, operation, this); 31 | } 32 | 33 | public IReadOnlyCollection Dependents => this.receivedState.Dependents; 34 | 35 | public IBulkOperationState PendingState 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | public IReadOnlyCollection Subordinates => this.receivedState.Subordinates; 42 | 43 | public void AddDependent(IBulkUpdateOperationContext dependent) 44 | { 45 | if (null == dependent) 46 | { 47 | throw new ArgumentNullException(nameof(dependent)); 48 | } 49 | 50 | this.receivedState.AddDependent(dependent); 51 | } 52 | 53 | public void AddSubordinate(IBulkUpdateOperationContext subordinate) 54 | { 55 | if (null == subordinate) 56 | { 57 | throw new ArgumentNullException(nameof(subordinate)); 58 | } 59 | 60 | this.receivedState.AddSubordinate(subordinate); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkDeletionOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | internal sealed class BulkDeletionOperationContext : BulkOperationContextBase 10 | { 11 | public BulkDeletionOperationContext( 12 | IRequest request, 13 | BulkRequestOperation operation) 14 | { 15 | if (null == request) 16 | { 17 | throw new ArgumentNullException(nameof(request)); 18 | } 19 | 20 | if (null == operation) 21 | { 22 | throw new ArgumentNullException(nameof(operation)); 23 | } 24 | 25 | IBulkOperationState receivedState = new BulkDeletionOperationState(request, operation, this); 26 | this.Initialize(receivedState); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkDeletionOperationState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net; 9 | 10 | internal class BulkDeletionOperationState : BulkOperationStateBase 11 | { 12 | public BulkDeletionOperationState( 13 | IRequest request, 14 | BulkRequestOperation operation, 15 | IBulkOperationContext context) 16 | : base(request, operation, context) 17 | { 18 | } 19 | 20 | public override bool TryPrepareRequest(out IRequest request) 21 | { 22 | request = null; 23 | 24 | Uri absoluteResourceIdentifier = new Uri(this.BulkRequest.BaseResourceIdentifier, this.Operation.Path); 25 | if (!UniformResourceIdentifier.TryParse( 26 | absoluteResourceIdentifier, 27 | this.BulkRequest.Extensions, 28 | out IUniformResourceIdentifier resourceIdentifier)) 29 | { 30 | this.Context.State = this; 31 | 32 | ErrorResponse error = 33 | new ErrorResponse() 34 | { 35 | Status = HttpStatusCode.BadRequest, 36 | ErrorType = ErrorType.invalidPath 37 | }; 38 | BulkResponseOperation response = 39 | new BulkResponseOperation(this.Operation.Identifier) 40 | { 41 | Response = error, 42 | Method = this.Operation.Method, 43 | Status = HttpStatusCode.BadRequest 44 | }; 45 | response.Method = this.Operation.Method; 46 | 47 | this.Complete(response); 48 | return false; 49 | } 50 | 51 | request = 52 | new DeletionRequest( 53 | this.BulkRequest.Request, 54 | resourceIdentifier.Identifier, 55 | this.BulkRequest.CorrelationIdentifier, 56 | this.BulkRequest.Extensions); 57 | return true; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkOperationState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | internal class BulkOperationState : BulkOperationStateBase where TPayload : class 10 | { 11 | public BulkOperationState( 12 | IRequest request, 13 | BulkRequestOperation operation, 14 | IBulkOperationContext context) 15 | : base(request, operation, context) 16 | { 17 | } 18 | 19 | public override bool TryPrepareRequest(out IRequest request) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkRequest.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Net.Http; 9 | 10 | public sealed class BulkRequest : SystemForCrossDomainIdentityManagementRequest 11 | { 12 | public BulkRequest( 13 | HttpRequestMessage request, 14 | BulkRequest2 payload, 15 | string correlationIdentifier, 16 | IReadOnlyCollection extensions) 17 | : base(request, payload, correlationIdentifier, extensions) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/BulkUpdateOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | internal sealed class BulkUpdateOperationContext : BulkOperationContextBase, IBulkUpdateOperationContext 11 | { 12 | private readonly IBulkUpdateOperationState receivedState; 13 | 14 | public BulkUpdateOperationContext( 15 | IRequest request, 16 | BulkRequestOperation operation) 17 | { 18 | if (null == request) 19 | { 20 | throw new ArgumentNullException(nameof(request)); 21 | } 22 | 23 | if (null == operation) 24 | { 25 | throw new ArgumentNullException(nameof(operation)); 26 | } 27 | 28 | this.receivedState = new BulkUpdateOperationState(request, operation, this); 29 | this.Initialize(this.receivedState); 30 | } 31 | 32 | public BulkUpdateOperationContext( 33 | IRequest request, 34 | BulkRequestOperation operation, 35 | IBulkCreationOperationContext parent) 36 | { 37 | if (null == request) 38 | { 39 | throw new ArgumentNullException(nameof(request)); 40 | } 41 | 42 | if (null == operation) 43 | { 44 | throw new ArgumentNullException(nameof(operation)); 45 | } 46 | 47 | this.receivedState = new BulkUpdateOperationState(request, operation, this, parent); 48 | this.Initialize(this.receivedState); 49 | } 50 | 51 | public IReadOnlyCollection Dependencies => this.receivedState.Dependencies; 52 | 53 | public IBulkCreationOperationContext Parent => this.receivedState.Parent; 54 | 55 | public void AddDependency(IBulkCreationOperationContext dependency) 56 | { 57 | if (null == dependency) 58 | { 59 | throw new ArgumentNullException(nameof(dependency)); 60 | } 61 | 62 | this.receivedState.AddDependency(dependency); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/GroupsController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using Microsoft.AspNetCore.Authorization; 7 | using Microsoft.AspNetCore.Mvc; 8 | 9 | [Route(ServiceConstants.RouteGroups)] 10 | [Authorize] 11 | [ApiController] 12 | public sealed class GroupsController : ControllerTemplate 13 | { 14 | public GroupsController(IProvider provider, IMonitor monitor) 15 | : base(provider, monitor) 16 | { 17 | } 18 | 19 | protected override IProviderAdapter AdaptProvider(IProvider provider) 20 | { 21 | if (null == provider) 22 | { 23 | throw new ArgumentNullException(nameof(provider)); 24 | } 25 | 26 | IProviderAdapter result = 27 | new Core2GroupProviderAdapter(provider); 28 | return result; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/RootController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class RootController : ControllerTemplate 8 | { 9 | public RootController(IProvider provider, IMonitor monitor) 10 | : base(provider, monitor) 11 | { 12 | } 13 | 14 | protected override IProviderAdapter AdaptProvider(IProvider provider) 15 | { 16 | if (null == provider) 17 | { 18 | throw new ArgumentNullException(nameof(provider)); 19 | } 20 | 21 | IProviderAdapter result = new RootProviderAdapter(provider); 22 | return result; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using Microsoft.AspNetCore.Authorization; 7 | using Microsoft.AspNetCore.Mvc; 8 | 9 | [Route(ServiceConstants.RouteUsers)] 10 | [Authorize] 11 | [ApiController] 12 | public sealed class UsersController : ControllerTemplate 13 | { 14 | public UsersController(IProvider provider, IMonitor monitor) 15 | : base(provider, monitor) 16 | { 17 | } 18 | 19 | protected override IProviderAdapter AdaptProvider(IProvider provider) 20 | { 21 | if (null == provider) 22 | { 23 | throw new ArgumentNullException(nameof(provider)); 24 | } 25 | 26 | IProviderAdapter result = new Core2EnterpriseUserProviderAdapter(provider); 27 | return result; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Core2EnterpriseUserProviderAdapter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | internal class Core2EnterpriseUserProviderAdapter : ProviderAdapterTemplate 6 | { 7 | public Core2EnterpriseUserProviderAdapter(IProvider provider) 8 | : base(provider) 9 | { 10 | } 11 | 12 | public override string SchemaIdentifier 13 | { 14 | get 15 | { 16 | return SchemaIdentifiers.Core2EnterpriseUser; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Core2GroupProviderAdapter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | internal class Core2GroupProviderAdapter : ProviderAdapterTemplate 6 | { 7 | public Core2GroupProviderAdapter(IProvider provider) 8 | : base(provider) 9 | { 10 | } 11 | 12 | public override string SchemaIdentifier 13 | { 14 | get 15 | { 16 | return SchemaIdentifiers.Core2Group; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/CreationRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class CreationRequest : SystemForCrossDomainIdentityManagementRequest 9 | { 10 | public CreationRequest( 11 | HttpRequestMessage request, 12 | Resource payload, 13 | string correlationIdentifier, 14 | IReadOnlyCollection extensions) 15 | : base(request, payload, correlationIdentifier, extensions) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/DeletionRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class DeletionRequest : 9 | SystemForCrossDomainIdentityManagementRequest 10 | { 11 | public DeletionRequest( 12 | HttpRequestMessage request, 13 | IResourceIdentifier payload, 14 | string correlationIdentifier, 15 | IReadOnlyCollection extensions) 16 | : base(request, payload, correlationIdentifier, extensions) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/DeserializingFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | 7 | public abstract class DeserializingFactory : 8 | JsonDeserializingFactory, 9 | IResourceJsonDeserializingFactory where TResource : Resource, new() 10 | { 11 | public new TResource Create(IReadOnlyDictionary json) 12 | { 13 | TResource result = base.Create(json); 14 | return result; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/EventRequest.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | using System.Net.Http; 9 | 10 | public sealed class EventRequest : SystemForCrossDomainIdentityManagementRequest 11 | { 12 | public EventRequest( 13 | HttpRequestMessage request, 14 | IEventToken payload, 15 | string correlationIdentifier, 16 | IReadOnlyCollection extensions) 17 | : base(request, payload, correlationIdentifier, extensions) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Friends.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | using System.Runtime.CompilerServices; 4 | 5 | [assembly: InternalsVisibleTo("Microsoft.Graph.Provisioning, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 6 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AzureAD/SCIMReferenceCode/d445ef901981fef684a220fe8cf6c97b588600fd/Microsoft.SystemForCrossDomainIdentityManagement/Service/GlobalSuppressions.cs -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseExceptionFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Web.Http; 8 | 9 | internal abstract class HttpResponseExceptionFactory 10 | { 11 | public abstract HttpResponseMessage ProvideMessage(HttpStatusCode statusCode, T content); 12 | 13 | public HttpResponseException CreateException(HttpStatusCode statusCode, T content) 14 | { 15 | HttpResponseMessage message = null; 16 | try 17 | { 18 | message = this.ProvideMessage(statusCode, content); 19 | HttpResponseException result = new HttpResponseException(message); 20 | result = null; 21 | return result; 22 | } 23 | finally 24 | { 25 | if (message != null) 26 | { 27 | message.Dispose(); 28 | message = null; 29 | } 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpResponseMessageFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Net; 6 | using System.Net.Http; 7 | 8 | internal abstract class HttpResponseMessageFactory 9 | { 10 | public abstract HttpContent ProvideContent(T content); 11 | 12 | public HttpResponseMessage CreateMessage(HttpStatusCode statusCode, T content) 13 | { 14 | HttpContent messageContent = null; 15 | try 16 | { 17 | messageContent = this.ProvideContent(content); 18 | HttpResponseMessage result = null; 19 | try 20 | { 21 | result = new HttpResponseMessage(statusCode); 22 | result.Content = messageContent; 23 | messageContent = null; 24 | return result; 25 | } 26 | catch 27 | { 28 | if (result != null) 29 | { 30 | result.Dispose(); 31 | result = null; 32 | }; 33 | 34 | throw; 35 | } 36 | } 37 | finally 38 | { 39 | if (messageContent != null) 40 | { 41 | messageContent.Dispose(); 42 | messageContent = null; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpStringResponseExceptionFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Net; 7 | using System.Net.Http; 8 | 9 | internal class HttpStringResponseExceptionFactory : HttpResponseExceptionFactory 10 | { 11 | private const string ArgumentNameContent = "content"; 12 | 13 | private static readonly Lazy> ResponseMessageFactory = 14 | new Lazy>( 15 | () => 16 | new HttpStringResponseMessageFactory()); 17 | 18 | public override HttpResponseMessage ProvideMessage(HttpStatusCode statusCode, string content) 19 | { 20 | if (string.IsNullOrWhiteSpace(content)) 21 | { 22 | throw new ArgumentNullException(HttpStringResponseExceptionFactory.ArgumentNameContent); 23 | } 24 | 25 | HttpResponseMessage result = null; 26 | try 27 | { 28 | result = HttpStringResponseExceptionFactory.ResponseMessageFactory.Value.CreateMessage(statusCode, content); 29 | return result; 30 | } 31 | catch 32 | { 33 | if (result != null) 34 | { 35 | result.Dispose(); 36 | result = null; 37 | } 38 | 39 | throw; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/HttpStringResponseMessageFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Net.Http; 7 | 8 | internal class HttpStringResponseMessageFactory : HttpResponseMessageFactory 9 | { 10 | private const string ArgumentNameContent = "content"; 11 | 12 | public override HttpContent ProvideContent(string content) 13 | { 14 | if (string.IsNullOrWhiteSpace(content)) 15 | { 16 | throw new ArgumentNullException(HttpStringResponseMessageFactory.ArgumentNameContent); 17 | } 18 | 19 | HttpContent result = null; 20 | try 21 | { 22 | result = new StringContent(content); 23 | return result; 24 | } 25 | catch 26 | { 27 | if (result != null) 28 | { 29 | result.Dispose(); 30 | result = null; 31 | } 32 | 33 | throw; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkCreationOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IBulkCreationOperationContext : IBulkOperationContext, IBulkCreationOperationState 8 | { 9 | IBulkOperationState PendingState { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkCreationOperationState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IBulkCreationOperationState : IBulkOperationState 10 | { 11 | IReadOnlyCollection Dependents { get; } 12 | IReadOnlyCollection Subordinates { get; } 13 | 14 | void AddDependent(IBulkUpdateOperationContext dependent); 15 | void AddSubordinate(IBulkUpdateOperationContext subordinate); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Net.Http; 8 | 9 | public interface IBulkOperationContext : IBulkOperationState 10 | { 11 | bool Completed { get; } 12 | bool Faulted { get; } 13 | HttpMethod Method { get; } 14 | } 15 | 16 | public interface IBulkOperationContext : 17 | IBulkOperationContext, 18 | IBulkOperationState where TPayload : class 19 | { 20 | IBulkOperationState FaultedState { get; } 21 | IBulkOperationState PreparedState { get; } 22 | IBulkOperationState ProcessedState { get; } 23 | IBulkOperationState ReceivedState { get; } 24 | IBulkOperationState State { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkOperationState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IBulkOperationState 8 | { 9 | IRequest BulkRequest { get; } 10 | BulkRequestOperation Operation { get; } 11 | BulkResponseOperation Response { get; } 12 | 13 | void Complete(BulkResponseOperation response); 14 | bool TryPrepare(); 15 | } 16 | 17 | public interface IBulkOperationState : IBulkOperationState where TPayload : class 18 | { 19 | void Prepare(IRequest request); 20 | IRequest Request { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkUpdateOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | public interface IBulkUpdateOperationContext : IBulkOperationContext, IBulkUpdateOperationState 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IBulkUpdateOperationState.CS: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System.Collections.Generic; 8 | 9 | public interface IBulkUpdateOperationState : IBulkOperationState 10 | { 11 | IReadOnlyCollection Dependencies { get; } 12 | IBulkCreationOperationContext Parent { get; } 13 | 14 | void AddDependency(IBulkCreationOperationContext dependency); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IMetadataProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | 7 | public interface IMetadataProvider 8 | { 9 | Core2ServiceConfiguration Configuration { get; } 10 | IReadOnlyCollection ResourceTypes { get; } 11 | IReadOnlyCollection Schema { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IPatch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public interface IPatch 6 | { 7 | PatchRequestBase PatchRequest { get; set; } 8 | IResourceIdentifier ResourceIdentifier { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | using System.Web.Http; 9 | using Microsoft.AspNetCore.Builder; 10 | 11 | public interface IProvider 12 | { 13 | bool AcceptLargeObjects { get; set; } 14 | ServiceConfigurationBase Configuration { get; } 15 | //IEventTokenHandler EventHandler { get; set; } 16 | IReadOnlyCollection Extensions { get; } 17 | IResourceJsonDeserializingFactory GroupDeserializationBehavior { get; } 18 | ISchematizedJsonDeserializingFactory PatchRequestDeserializationBehavior { get; } 19 | IReadOnlyCollection ResourceTypes { get; } 20 | IReadOnlyCollection Schema { get; } 21 | //Action StartupBehavior { get; } 22 | IResourceJsonDeserializingFactory UserDeserializationBehavior { get; } 23 | Task CreateAsync(IRequest request); 24 | Task DeleteAsync(IRequest request); 25 | Task PaginateQueryAsync(IRequest request); 26 | Task QueryAsync(IRequest request); 27 | Task ReplaceAsync(IRequest request); 28 | Task RetrieveAsync(IRequest request); 29 | Task UpdateAsync(IRequest request); 30 | Task ProcessAsync(IRequest request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IProviderAdapter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | using System.Threading.Tasks; 8 | 9 | public interface IProviderAdapter where T : Resource 10 | { 11 | string SchemaIdentifier { get; } 12 | 13 | Task Create(HttpRequestMessage request, Resource resource, string correlationIdentifier); 14 | Task Delete(HttpRequestMessage request, string identifier, string correlationIdentifier); 15 | Task Query( 16 | HttpRequestMessage request, 17 | IReadOnlyCollection filters, 18 | IReadOnlyCollection requestedAttributePaths, 19 | IReadOnlyCollection excludedAttributePaths, 20 | IPaginationParameters paginationParameters, 21 | string correlationIdentifier); 22 | Task Replace(HttpRequestMessage request, Resource resource, string correlationIdentifier); 23 | Task Retrieve( 24 | HttpRequestMessage request, 25 | string identifier, 26 | IReadOnlyCollection requestedAttributePaths, 27 | IReadOnlyCollection excludedAttributePaths, 28 | string correlationIdentifier); 29 | Task Update( 30 | HttpRequestMessage request, 31 | string identifier, 32 | PatchRequestBase patchRequest, 33 | string correlationIdentifier); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Net.Http; 8 | 9 | public interface IRequest 10 | { 11 | Uri BaseResourceIdentifier { get; } 12 | string CorrelationIdentifier { get; } 13 | IReadOnlyCollection Extensions { get; } 14 | HttpRequestMessage Request { get; } 15 | } 16 | 17 | public interface IRequest : IRequest where TPayload : class 18 | { 19 | TPayload Payload { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IResourceQuery.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | 7 | public interface IResourceQuery 8 | { 9 | IReadOnlyCollection Attributes { get; } 10 | IReadOnlyCollection ExcludedAttributes { get; } 11 | IReadOnlyCollection Filters { get; } 12 | IPaginationParameters PaginationParameters { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/ISampleProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public interface ISampleProvider 6 | { 7 | Core2Group SampleGroup { get; } 8 | PatchRequest2 SamplePatch { get; } 9 | Core2EnterpriseUser SampleResource { get; } 10 | Core2EnterpriseUser SampleUser { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/IUniformResourceIdentifier.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public interface IUniformResourceIdentifier 6 | { 7 | bool IsQuery { get; } 8 | 9 | IResourceIdentifier Identifier { get; } 10 | IResourceQuery Query { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/InvalidBulkOperationContext.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Net.Http; 9 | 10 | internal class InvalidBulkOperationContext : IBulkOperationContext 11 | { 12 | private readonly IBulkOperationState state; 13 | 14 | public InvalidBulkOperationContext( 15 | IRequest request, 16 | BulkRequestOperation operation) 17 | { 18 | if (null == request) 19 | { 20 | throw new ArgumentNullException(nameof(request)); 21 | } 22 | 23 | if (null == operation) 24 | { 25 | throw new ArgumentNullException(nameof(operation)); 26 | } 27 | 28 | this.state = new InvalidBulkOperationState(request, operation); 29 | } 30 | 31 | public bool Completed => true; 32 | 33 | public bool Faulted => true; 34 | 35 | public IRequest BulkRequest => this.state.BulkRequest; 36 | 37 | public HttpMethod Method => this.state.Operation.Method; 38 | 39 | public BulkRequestOperation Operation => this.state.Operation; 40 | 41 | public BulkResponseOperation Response => this.state.Response; 42 | 43 | public void Complete(BulkResponseOperation response) => this.state.Complete(response); 44 | 45 | public bool TryPrepare() => this.state.TryPrepare(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/InvalidBulkOperationState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | 9 | internal class InvalidBulkOperationState : IBulkOperationState 10 | { 11 | public InvalidBulkOperationState( 12 | IRequest request, 13 | BulkRequestOperation operation) 14 | { 15 | this.BulkRequest = request ?? throw new ArgumentNullException(nameof(request)); 16 | this.Operation = operation ?? throw new ArgumentNullException(nameof(operation)); 17 | } 18 | 19 | public IRequest BulkRequest 20 | { 21 | get; 22 | private set; 23 | } 24 | 25 | public BulkRequestOperation Operation 26 | { 27 | get; 28 | private set; 29 | } 30 | 31 | public BulkResponseOperation Response 32 | { 33 | get; 34 | private set; 35 | } 36 | 37 | public void Complete(BulkResponseOperation response) 38 | { 39 | if (null == response) 40 | { 41 | throw new ArgumentNullException(nameof(response)); 42 | } 43 | 44 | if (response.Response is ErrorResponse) 45 | { 46 | this.Response = response; 47 | } 48 | else 49 | { 50 | throw new ArgumentException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionInvalidResponse); 51 | } 52 | } 53 | 54 | public bool TryPrepare() => false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/CriticalExceptionNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class CriticalExceptionNotificationFactory : NotificationFactory 8 | { 9 | private static readonly Lazy> Singleton = 10 | new Lazy>( 11 | () => 12 | new CriticalExceptionNotificationFactory()); 13 | 14 | private CriticalExceptionNotificationFactory() 15 | { 16 | } 17 | 18 | public static NotificationFactory Instance 19 | { 20 | get 21 | { 22 | return CriticalExceptionNotificationFactory.Singleton.Value; 23 | } 24 | } 25 | 26 | public override IExceptionNotification CreateNotification( 27 | Exception payload, 28 | string correlationIdentifier, 29 | long? identifier) 30 | { 31 | if (null == payload) 32 | { 33 | throw new ArgumentNullException(nameof(payload)); 34 | } 35 | 36 | IExceptionNotification result; 37 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 38 | { 39 | if (!identifier.HasValue) 40 | { 41 | result = new ExceptionNotification(payload, true); 42 | } 43 | else 44 | { 45 | result = new ExceptionNotification(payload, true, identifier.Value); 46 | } 47 | } 48 | else 49 | { 50 | if (!identifier.HasValue) 51 | { 52 | result = new ExceptionNotification(payload, true, correlationIdentifier); 53 | } 54 | else 55 | { 56 | result = new ExceptionNotification(payload, true, correlationIdentifier, identifier.Value); 57 | } 58 | } 59 | return result; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/ExceptionNotification.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class ExceptionNotification : Notification, IExceptionNotification 8 | { 9 | public ExceptionNotification(Exception payload, bool critical) 10 | : base(payload) 11 | { 12 | this.Critical = critical; 13 | } 14 | 15 | public ExceptionNotification(Exception payload) 16 | : this(payload, false) 17 | { 18 | } 19 | 20 | public ExceptionNotification(Exception payload, long identifier) 21 | : base(payload, identifier) 22 | { 23 | this.Critical = false; 24 | } 25 | 26 | public ExceptionNotification(Exception payload, bool critical, long identifier) 27 | : base(payload, identifier) 28 | { 29 | this.Critical = critical; 30 | } 31 | 32 | public ExceptionNotification(Exception payload, bool critical, string correlationIdentifier) 33 | : base(payload, correlationIdentifier) 34 | { 35 | this.Critical = critical; 36 | } 37 | 38 | public ExceptionNotification(Exception payload, string correlationIdentifier) 39 | : this(payload, false, correlationIdentifier) 40 | { 41 | } 42 | 43 | public ExceptionNotification(Exception payload, bool critical, string correlationIdentifier, long identifier) 44 | : base(payload, correlationIdentifier, identifier) 45 | { 46 | this.Critical = critical; 47 | } 48 | 49 | public ExceptionNotification(Exception payload, string correlationIdentifier, long identifier) 50 | : this(payload, false, correlationIdentifier, identifier) 51 | { 52 | } 53 | 54 | public bool Critical 55 | { 56 | get; 57 | set; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/ExceptionNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class ExceptionNotificationFactory : NotificationFactory 8 | { 9 | private static readonly Lazy> Singleton = 10 | new Lazy>( 11 | () => 12 | new ExceptionNotificationFactory()); 13 | 14 | private ExceptionNotificationFactory() 15 | { 16 | } 17 | 18 | public static NotificationFactory Instance 19 | { 20 | get 21 | { 22 | return ExceptionNotificationFactory.Singleton.Value; 23 | } 24 | } 25 | 26 | public override IExceptionNotification CreateNotification( 27 | Exception payload, 28 | string correlationIdentifier, 29 | long? identifier) 30 | { 31 | if (null == payload) 32 | { 33 | throw new ArgumentNullException(nameof(payload)); 34 | } 35 | 36 | IExceptionNotification result; 37 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 38 | { 39 | if (!identifier.HasValue) 40 | { 41 | result = new ExceptionNotification(payload); 42 | } 43 | else 44 | { 45 | result = new ExceptionNotification(payload, identifier.Value); 46 | } 47 | } 48 | else 49 | { 50 | if (!identifier.HasValue) 51 | { 52 | result = new ExceptionNotification(payload, correlationIdentifier); 53 | } 54 | else 55 | { 56 | result = new ExceptionNotification(payload, correlationIdentifier, identifier.Value); 57 | } 58 | } 59 | return result; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/IExceptionNotification.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public interface IExceptionNotification : INotification 8 | { 9 | bool Critical { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/IInformationNotification.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public interface IInformationNotification : INotification 6 | { 7 | bool Verbose { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/IMonitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public interface IMonitor 8 | { 9 | void Inform(IInformationNotification notification); 10 | void Report(IExceptionNotification notification); 11 | void Warn(Notification notification); 12 | void Warn(Notification notification); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/INotification.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public interface INotification 6 | { 7 | long? Identifier { get; } 8 | string CorrelationIdentifier { get; } 9 | TPayload Message { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/InformationNotification.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public sealed class InformationNotification : Notification, IInformationNotification 6 | { 7 | public InformationNotification(string payload, bool verbose) 8 | : base(payload) 9 | { 10 | this.Verbose = verbose; 11 | } 12 | 13 | public InformationNotification(string payload) 14 | : this(payload, false) 15 | { 16 | } 17 | 18 | public InformationNotification(string payload, long identifier) 19 | : base(payload, identifier) 20 | { 21 | this.Verbose = false; 22 | } 23 | 24 | public InformationNotification(string payload, bool verbose, long identifier) 25 | : base(payload, identifier) 26 | { 27 | this.Verbose = verbose; 28 | } 29 | 30 | public InformationNotification( 31 | string payload, 32 | bool verbose, 33 | string correlationIdentifier) 34 | : base(payload, correlationIdentifier) 35 | { 36 | this.Verbose = verbose; 37 | } 38 | 39 | public InformationNotification( 40 | string payload, 41 | string correlationIdentifier) 42 | : this(payload, false, correlationIdentifier) 43 | { 44 | } 45 | 46 | public InformationNotification( 47 | string payload, 48 | bool verbose, 49 | string correlationIdentifier, 50 | long identifier) 51 | : base(payload, correlationIdentifier, identifier) 52 | { 53 | this.Verbose = verbose; 54 | } 55 | 56 | public InformationNotification( 57 | string payload, 58 | string correlationIdentifier, 59 | long identifier) 60 | : this(payload, false, correlationIdentifier, identifier) 61 | { 62 | } 63 | 64 | public bool Verbose 65 | { 66 | get; 67 | set; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/InformationNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class InformationNotificationFactory : NotificationFactoryBase 8 | { 9 | private static readonly Lazy> Singleton = 10 | new Lazy>( 11 | () => 12 | new InformationNotificationFactory()); 13 | 14 | private InformationNotificationFactory() 15 | { 16 | } 17 | 18 | public static NotificationFactoryBase Instance 19 | { 20 | get 21 | { 22 | return InformationNotificationFactory.Singleton.Value; 23 | } 24 | } 25 | 26 | public override IInformationNotification CreateNotification( 27 | string payload, 28 | string correlationIdentifier, 29 | long? identifier) 30 | { 31 | if (string.IsNullOrWhiteSpace(payload)) 32 | { 33 | throw new ArgumentNullException(nameof(payload)); 34 | } 35 | 36 | IInformationNotification result; 37 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 38 | { 39 | if (!identifier.HasValue) 40 | { 41 | result = new InformationNotification(payload); 42 | } 43 | else 44 | { 45 | result = new InformationNotification(payload, identifier.Value); 46 | } 47 | } 48 | else 49 | { 50 | if (!identifier.HasValue) 51 | { 52 | result = new InformationNotification(payload, correlationIdentifier); 53 | } 54 | else 55 | { 56 | result = new InformationNotification(payload, correlationIdentifier, identifier.Value); 57 | } 58 | } 59 | return result; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/NotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public abstract class NotificationFactory 8 | { 9 | public abstract TNotification CreateNotification( 10 | TPayload payload, 11 | string correlationIdentifier, 12 | long? identifier); 13 | 14 | public TNotification CreateNotification(TPayload payload, Guid correlationIdentifier, long? identifier) 15 | { 16 | string correlationIdentifierValue = correlationIdentifier.ToString(); 17 | TNotification result = this.CreateNotification(payload, correlationIdentifierValue, identifier); 18 | return result; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/NotificationFactoryBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Globalization; 7 | 8 | public abstract class NotificationFactoryBase : NotificationFactory 9 | { 10 | public abstract override TNotification CreateNotification( 11 | string payload, 12 | string correlationIdentifier, 13 | long? identifier); 14 | 15 | public TNotification FormatNotification( 16 | string template, 17 | string correlationIdentifier, 18 | long? identifier, 19 | params object[] arguments) 20 | { 21 | if (string.IsNullOrWhiteSpace(template)) 22 | { 23 | throw new ArgumentNullException(nameof(template)); 24 | } 25 | 26 | string payload = string.Format(CultureInfo.InvariantCulture, template, arguments); 27 | TNotification result = this.CreateNotification(payload, correlationIdentifier, identifier); 28 | return result; 29 | } 30 | 31 | public TNotification FormatNotification( 32 | string template, 33 | Guid correlationIdentifier, 34 | long? identifier, 35 | params object[] arguments) 36 | { 37 | if (string.IsNullOrWhiteSpace(template)) 38 | { 39 | throw new ArgumentNullException(nameof(template)); 40 | } 41 | 42 | string correlationIdentifierValue = correlationIdentifier.ToString(); 43 | TNotification result = this.FormatNotification(template, correlationIdentifierValue, identifier, arguments); 44 | return result; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/VerboseInformationNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class VerboseInformationNotificationFactory : NotificationFactoryBase 8 | { 9 | private static readonly Lazy> Singleton = 10 | new Lazy>( 11 | () => 12 | new VerboseInformationNotificationFactory()); 13 | 14 | private VerboseInformationNotificationFactory() 15 | { 16 | } 17 | 18 | public static NotificationFactoryBase Instance 19 | { 20 | get 21 | { 22 | return VerboseInformationNotificationFactory.Singleton.Value; 23 | } 24 | } 25 | 26 | public override IInformationNotification CreateNotification( 27 | string payload, 28 | string correlationIdentifier, 29 | long? identifier) 30 | { 31 | if (string.IsNullOrWhiteSpace(payload)) 32 | { 33 | throw new ArgumentNullException(nameof(payload)); 34 | } 35 | 36 | IInformationNotification result; 37 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 38 | { 39 | if (!identifier.HasValue) 40 | { 41 | result = new InformationNotification(payload, true); 42 | } 43 | else 44 | { 45 | result = new InformationNotification(payload, true, identifier.Value); 46 | } 47 | } 48 | else 49 | { 50 | if (!identifier.HasValue) 51 | { 52 | result = new InformationNotification(payload, true, correlationIdentifier); 53 | } 54 | else 55 | { 56 | result = new InformationNotification(payload, true, correlationIdentifier, identifier.Value); 57 | } 58 | } 59 | return result; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Monitor/WarningNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class WarningNotificationFactory : NotificationFactoryBase> 8 | { 9 | private static readonly Lazy Singleton = 10 | new Lazy( 11 | () => 12 | new WarningNotificationFactory()); 13 | 14 | private WarningNotificationFactory() 15 | { 16 | } 17 | 18 | public static WarningNotificationFactory Instance 19 | { 20 | get 21 | { 22 | return WarningNotificationFactory.Singleton.Value; 23 | } 24 | } 25 | 26 | public override Notification CreateNotification( 27 | string payload, 28 | string correlationIdentifier, 29 | long? identifier) 30 | { 31 | if (string.IsNullOrWhiteSpace(payload)) 32 | { 33 | throw new ArgumentNullException(nameof(payload)); 34 | } 35 | 36 | Notification result; 37 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 38 | { 39 | if (!identifier.HasValue) 40 | { 41 | result = new InformationNotification(payload); 42 | } 43 | else 44 | { 45 | result = new InformationNotification(payload, identifier.Value); 46 | } 47 | } 48 | else 49 | { 50 | if (!identifier.HasValue) 51 | { 52 | result = new InformationNotification(payload, correlationIdentifier); 53 | } 54 | else 55 | { 56 | result = new InformationNotification(payload, correlationIdentifier, identifier.Value); 57 | } 58 | } 59 | return result; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/Patch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class Patch : IPatch 8 | { 9 | public Patch() 10 | { 11 | } 12 | 13 | public Patch(IResourceIdentifier resourceIdentifier, PatchRequestBase request) 14 | { 15 | this.ResourceIdentifier = resourceIdentifier ?? throw new ArgumentNullException(nameof(resourceIdentifier)); 16 | this.PatchRequest = request ?? throw new ArgumentNullException(nameof(request)); 17 | } 18 | 19 | public PatchRequestBase PatchRequest 20 | { 21 | get; 22 | set; 23 | } 24 | 25 | public IResourceIdentifier ResourceIdentifier 26 | { 27 | get; 28 | set; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/ProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | //------------------------------------------------------------ 4 | 5 | namespace Microsoft.SCIM 6 | { 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | public static class ProviderExtension 11 | { 12 | public static IReadOnlyCollection ReadExtensions(this IProvider provider) 13 | { 14 | if(null == provider) 15 | { 16 | throw new ArgumentNullException(nameof(provider)); 17 | } 18 | IReadOnlyCollection result; 19 | try 20 | { 21 | result = provider.Extensions; 22 | } 23 | catch (NotImplementedException) 24 | { 25 | result = null; 26 | } 27 | return result; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/QueryRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class QueryRequest : 9 | SystemForCrossDomainIdentityManagementRequest 10 | { 11 | public QueryRequest( 12 | HttpRequestMessage request, 13 | IQueryParameters payload, 14 | string correlationIdentifier, 15 | IReadOnlyCollection extensions) 16 | : base(request, payload, correlationIdentifier, extensions) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/QueryResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Runtime.Serialization; 7 | 8 | [DataContract] 9 | public sealed class QueryResponse : QueryResponseBase 10 | { 11 | public QueryResponse() 12 | : base() 13 | { 14 | } 15 | 16 | public QueryResponse(IReadOnlyCollection resources) 17 | : base(resources) 18 | { 19 | } 20 | 21 | public QueryResponse(IList resources) 22 | : base(resources) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/ReplaceRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class ReplaceRequest : SystemForCrossDomainIdentityManagementRequest 9 | { 10 | public ReplaceRequest( 11 | HttpRequestMessage request, 12 | Resource payload, 13 | string correlationIdentifier, 14 | IReadOnlyCollection extensions) 15 | : base(request, payload, correlationIdentifier, extensions) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/RetrievalRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class RetrievalRequest : 9 | SystemForCrossDomainIdentityManagementRequest 10 | { 11 | public RetrievalRequest( 12 | HttpRequestMessage request, 13 | IResourceRetrievalParameters payload, 14 | string correlationIdentifier, 15 | IReadOnlyCollection extensions) 16 | : base(request, payload, correlationIdentifier, extensions) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/ServiceConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | public static class ServiceConstants 6 | { 7 | public const string PathSegmentResourceTypes = "ResourceTypes"; 8 | public const string PathSegmentSchemas = "Schemas"; 9 | public const string PathSegmentServiceProviderConfiguration = "ServiceProviderConfig"; 10 | public const string RouteGroups = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ProtocolConstants.PathGroups; 11 | public const string RouteResourceTypes = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ServiceConstants.PathSegmentResourceTypes; 12 | public const string RouteSchemas = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ServiceConstants.PathSegmentSchemas; 13 | public const string RouteServiceConfiguration = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ServiceConstants.PathSegmentServiceProviderConfiguration; 14 | public const string RouteUsers = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ProtocolConstants.PathUsers; 15 | public const string RouteBulk = SchemaConstants.PathInterface + ServiceConstants.SeparatorSegments + ProtocolConstants.PathBulk; 16 | public const string SeparatorSegments = "/"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/SevereWarningNotificationFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | 7 | public sealed class SevereWarningNotificationFactory : NotificationFactory> 8 | { 9 | private static readonly Lazy Singleton = 10 | new Lazy( 11 | () => 12 | new SevereWarningNotificationFactory()); 13 | 14 | private SevereWarningNotificationFactory() 15 | { 16 | } 17 | 18 | public static SevereWarningNotificationFactory Instance => SevereWarningNotificationFactory.Singleton.Value; 19 | 20 | public override Notification CreateNotification( 21 | Exception payload, 22 | string correlationIdentifier, 23 | long? identifier) 24 | { 25 | if (null == payload) 26 | { 27 | throw new ArgumentNullException(nameof(payload)); 28 | } 29 | 30 | Notification result; 31 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 32 | { 33 | if (!identifier.HasValue) 34 | { 35 | result = new ExceptionNotification(payload); 36 | } 37 | else 38 | { 39 | result = new ExceptionNotification(payload, identifier.Value); 40 | } 41 | } 42 | else 43 | { 44 | if (!identifier.HasValue) 45 | { 46 | result = new ExceptionNotification(payload, correlationIdentifier); 47 | } 48 | else 49 | { 50 | result = new ExceptionNotification(payload, correlationIdentifier, identifier.Value); 51 | } 52 | } 53 | return result; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/SystemForCrossDomainIdentityManagementRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Net.Http; 8 | 9 | public abstract class SystemForCrossDomainIdentityManagementRequest : IRequest 10 | where TPayload : class 11 | { 12 | protected SystemForCrossDomainIdentityManagementRequest( 13 | HttpRequestMessage request, 14 | TPayload payload, 15 | string correlationIdentifier, 16 | IReadOnlyCollection extensions) 17 | { 18 | if (null == request) 19 | { 20 | throw new ArgumentNullException(nameof(request)); 21 | } 22 | 23 | if (string.IsNullOrWhiteSpace(correlationIdentifier)) 24 | { 25 | throw new ArgumentNullException(nameof(extensions)); 26 | } 27 | 28 | this.BaseResourceIdentifier = request.GetBaseResourceIdentifier(); 29 | this.Request = request; 30 | this.Payload = payload ?? throw new ArgumentNullException(nameof(payload)); 31 | this.CorrelationIdentifier = correlationIdentifier; 32 | this.Extensions = extensions; 33 | } 34 | 35 | public Uri BaseResourceIdentifier 36 | { 37 | get; 38 | private set; 39 | } 40 | 41 | public string CorrelationIdentifier 42 | { 43 | get; 44 | private set; 45 | } 46 | 47 | public IReadOnlyCollection Extensions 48 | { 49 | get; 50 | private set; 51 | } 52 | 53 | public TPayload Payload 54 | { 55 | get; 56 | private set; 57 | } 58 | 59 | public HttpRequestMessage Request 60 | { 61 | get; 62 | private set; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Microsoft.SystemForCrossDomainIdentityManagement/Service/UpdateRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation.// Licensed under the MIT license. 2 | 3 | namespace Microsoft.SCIM 4 | { 5 | using System.Collections.Generic; 6 | using System.Net.Http; 7 | 8 | public sealed class UpdateRequest : 9 | SystemForCrossDomainIdentityManagementRequest 10 | { 11 | public UpdateRequest( 12 | HttpRequestMessage request, 13 | IPatch payload, 14 | string correlationIdentifier, 15 | IReadOnlyCollection extensions) 16 | : base(request, payload, correlationIdentifier, extensions) 17 | { 18 | } 19 | } 20 | } 21 | --------------------------------------------------------------------------------