├── .asf.yaml ├── .editorconfig ├── .githooks └── pre-push ├── .github ├── dependabot.yml └── workflows │ ├── build-reproducible.yml │ ├── build.yml │ ├── codeql-analysis.yml │ ├── maven.yml │ ├── rat.yml │ ├── release.yml │ └── snapshot.yml ├── .gitignore ├── .mvn ├── develocity-custom-user-data.groovy ├── develocity.xml ├── extensions.xml ├── maven.config └── wrapper │ └── maven-wrapper.properties ├── Dockerfile ├── LICENSE ├── NOTICE ├── README.md ├── RELEASE_GUIDE.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── scim-client ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── client │ │ └── rest │ │ ├── BaseScimClient.java │ │ ├── ResourceTypesClient.java │ │ ├── RestCall.java │ │ ├── RestClientUtil.java │ │ ├── RestException.java │ │ ├── ScimGroupClient.java │ │ ├── ScimJacksonXmlBindJsonProvider.java │ │ ├── ScimSelfClient.java │ │ ├── ScimUserClient.java │ │ └── legacy │ │ ├── Version1ScimGroupClient.java │ │ └── Version1ScimUserClient.java │ └── test │ └── java │ └── org │ └── apache │ └── directory │ └── scim │ └── client │ └── rest │ ├── ClientTestSupport.java │ ├── ScimUserClientTest.java │ └── junit │ └── MockServerClientTestRunner.java ├── scim-compliance-tests ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── compliance │ │ ├── junit │ │ └── EmbeddedServerExtension.java │ │ └── tests │ │ ├── GroupsIT.java │ │ ├── ResourceTypesIT.java │ │ ├── SchemasIT.java │ │ ├── ScimpleITSupport.java │ │ ├── ServiceProviderConfigIT.java │ │ └── UsersIT.java │ └── resources │ └── META-INF │ └── services │ └── org.junit.jupiter.api.extension.Extension ├── scim-core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── core │ │ │ ├── json │ │ │ ├── ObjectMapperFactory.java │ │ │ └── ScimResourceDeserializer.java │ │ │ ├── repository │ │ │ ├── DefaultPatchHandler.java │ │ │ ├── ETag.java │ │ │ ├── InvalidRepositoryException.java │ │ │ ├── PatchHandler.java │ │ │ ├── Repository.java │ │ │ ├── RepositoryRegistry.java │ │ │ ├── SelfIdResolver.java │ │ │ ├── annotations │ │ │ │ ├── ProcessingExtensions.java │ │ │ │ └── ScimProcessingExtension.java │ │ │ └── extensions │ │ │ │ ├── AttributeFilterExtension.java │ │ │ │ ├── ClientFilterException.java │ │ │ │ └── ProcessingExtension.java │ │ │ ├── schema │ │ │ └── SchemaRegistry.java │ │ │ └── spi │ │ │ └── ScimpleComponents.java │ └── resources │ │ └── META-INF │ │ └── beans.xml │ └── test │ └── java │ └── org │ └── apache │ └── directory │ └── scim │ └── core │ ├── json │ └── ObjectMapperFactoryTest.java │ ├── repository │ ├── PatchHandlerTest.java │ ├── RepositoryRegistryTest.java │ └── RepositorySchemaRegistryTest.java │ └── schema │ └── SchemaRegistryTest.java ├── scim-coverage └── pom.xml ├── scim-server-examples ├── scim-server-jersey │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── directory │ │ │ │ └── scim │ │ │ │ └── example │ │ │ │ └── jersey │ │ │ │ ├── JerseyApplication.java │ │ │ │ ├── extensions │ │ │ │ └── LuckyNumberExtension.java │ │ │ │ └── service │ │ │ │ ├── InMemoryGroupService.java │ │ │ │ ├── InMemorySelfResolverImpl.java │ │ │ │ └── InMemoryUserService.java │ │ └── resources │ │ │ ├── beans.xml │ │ │ └── logback.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── example │ │ │ └── jersey │ │ │ └── JerseyTestServer.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer ├── scim-server-memory │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── example │ │ │ └── memory │ │ │ ├── extensions │ │ │ └── LuckyNumberExtension.java │ │ │ ├── rest │ │ │ └── RestApplication.java │ │ │ └── service │ │ │ ├── InMemoryGroupService.java │ │ │ ├── InMemorySelfResolverImpl.java │ │ │ └── InMemoryUserService.java │ │ └── webapp │ │ └── WEB-INF │ │ ├── beans.xml │ │ ├── jboss-web.xml │ │ └── web.xml ├── scim-server-quarkus │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── example │ │ │ └── quarkus │ │ │ ├── QuarkusApplication.java │ │ │ ├── extensions │ │ │ └── LuckyNumberExtension.java │ │ │ └── service │ │ │ ├── InMemoryGroupService.java │ │ │ ├── InMemorySelfResolverImpl.java │ │ │ └── InMemoryUserService.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── example │ │ │ └── quarkus │ │ │ ├── QuarkusGroupsIT.java │ │ │ ├── QuarkusResourceTypesIT.java │ │ │ ├── QuarkusSchemasIT.java │ │ │ ├── QuarkusServiceProviderConfigIT.java │ │ │ └── QuarkusUsersIT.java │ │ └── resources │ │ └── application.properties └── scim-server-spring-boot │ ├── README.md │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── example │ │ └── spring │ │ ├── ScimpleSpringBootApplication.java │ │ ├── extensions │ │ └── LuckyNumberExtension.java │ │ └── service │ │ ├── InMemoryGroupService.java │ │ ├── InMemorySelfResolverImpl.java │ │ └── InMemoryUserService.java │ └── resources │ └── application.properties ├── scim-server ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── server │ │ │ ├── configuration │ │ │ └── ServerConfiguration.java │ │ │ ├── exception │ │ │ ├── AttributeDoesNotExistException.java │ │ │ ├── AttributeException.java │ │ │ ├── BaseScimExceptionMapper.java │ │ │ ├── EtagGenerationException.java │ │ │ ├── FilterParseExceptionMapper.java │ │ │ ├── GenericExceptionMapper.java │ │ │ ├── MutabilityExceptionMapper.java │ │ │ ├── ResourceExceptionMapper.java │ │ │ ├── ScimExceptionMapper.java │ │ │ ├── UnableToCreateResourceException.java │ │ │ ├── UnableToDeleteResourceException.java │ │ │ ├── UnableToResolveIdResourceException.java │ │ │ ├── UnableToRetrieveExtensionsResourceException.java │ │ │ ├── UnableToRetrieveResourceException.java │ │ │ ├── UnableToUpdateResourceException.java │ │ │ ├── UnsupportedFilterExceptionMapper.java │ │ │ ├── UnsupportedOperationExceptionMapper.java │ │ │ └── WebApplicationExceptionMapper.java │ │ │ ├── filter │ │ │ └── ApiOriginFilter.java │ │ │ ├── rest │ │ │ ├── AttributeUtil.java │ │ │ ├── BaseResourceTypeResourceImpl.java │ │ │ ├── BulkResourceImpl.java │ │ │ ├── EtagGenerator.java │ │ │ ├── EtagParser.java │ │ │ ├── GroupResourceImpl.java │ │ │ ├── ResourceTypesResourceImpl.java │ │ │ ├── SchemaResourceImpl.java │ │ │ ├── ScimJacksonXmlBindJsonProvider.java │ │ │ ├── ScimResourceHelper.java │ │ │ ├── ScimpleFeature.java │ │ │ ├── SearchResourceImpl.java │ │ │ ├── SelfResourceImpl.java │ │ │ ├── ServiceProviderConfigResourceImpl.java │ │ │ └── UserResourceImpl.java │ │ │ └── spi │ │ │ └── ScimServerBuildCompatibleExtension.java │ └── resources │ │ └── META-INF │ │ ├── beans.xml │ │ └── services │ │ └── jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension │ └── test │ ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── server │ │ ├── it │ │ ├── CustomExtensionIT.java │ │ ├── JerseyTestServer.java │ │ └── testapp │ │ │ ├── App.java │ │ │ ├── InMemoryGroupService.java │ │ │ ├── InMemorySelfResolverImpl.java │ │ │ ├── InMemoryUserService.java │ │ │ └── LuckyNumberExtension.java │ │ └── rest │ │ ├── AttributeUtilTest.java │ │ ├── BaseResourceTypeResourceImplTest.java │ │ ├── BulkResourceImplTest.java │ │ ├── EtagParserTest.java │ │ └── SelfResourceImplTest.java │ └── resources │ └── META-INF │ └── services │ └── org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer ├── scim-spec ├── scim-spec-protocol │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── protocol │ │ │ ├── BaseResourceTypeResource.java │ │ │ ├── BulkResource.java │ │ │ ├── Constants.java │ │ │ ├── ErrorMessageType.java │ │ │ ├── GroupResource.java │ │ │ ├── ResourceTypesResource.java │ │ │ ├── SchemaResource.java │ │ │ ├── SearchResource.java │ │ │ ├── SelfResource.java │ │ │ ├── ServiceProviderConfigResource.java │ │ │ ├── UserResource.java │ │ │ ├── adapter │ │ │ ├── AttributeReferenceAdapter.java │ │ │ ├── FilterAdapter.java │ │ │ └── FilterWrapper.java │ │ │ ├── data │ │ │ ├── BulkOperation.java │ │ │ ├── BulkRequest.java │ │ │ ├── BulkResponse.java │ │ │ ├── ErrorResponse.java │ │ │ ├── ListResponse.java │ │ │ ├── PatchRequest.java │ │ │ ├── SearchRequest.java │ │ │ └── StatusAdapter.java │ │ │ └── exception │ │ │ └── ScimException.java │ │ └── test │ │ └── java │ │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── protocol │ │ └── adapter │ │ ├── AttributeReferenceAdapterTest.java │ │ └── StatusAdapterTest.java └── scim-spec-schema │ ├── pom.xml │ └── src │ ├── main │ ├── antlr4 │ │ ├── imports │ │ │ ├── Core.g4 │ │ │ ├── Json.g4 │ │ │ └── Urn.g4 │ │ └── org │ │ │ └── apache │ │ │ └── directory │ │ │ └── scim │ │ │ └── spec │ │ │ ├── filter │ │ │ └── Filter.g4 │ │ │ └── phonenumber │ │ │ ├── PhoneNumberLexer.g4 │ │ │ └── PhoneNumberParser.g4 │ └── java │ │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── spec │ │ ├── adapter │ │ ├── Iso8601DateTimeAdapter.java │ │ ├── LocalDateTimeAdapter.java │ │ └── PatchOperationPathAdapter.java │ │ ├── annotation │ │ ├── ScimAttribute.java │ │ ├── ScimExtensionType.java │ │ ├── ScimResourceIdReference.java │ │ ├── ScimResourceType.java │ │ └── ScimType.java │ │ ├── exception │ │ ├── ConflictResourceException.java │ │ ├── InvalidExtensionException.java │ │ ├── MutabilityException.java │ │ ├── ResourceException.java │ │ ├── ResourceNotFoundException.java │ │ ├── ScimResourceInvalidException.java │ │ └── UnsupportedFilterException.java │ │ ├── extension │ │ └── EnterpriseExtension.java │ │ ├── filter │ │ ├── AttributeComparisonExpression.java │ │ ├── AttributePresentExpression.java │ │ ├── BaseFilterExpressionMapper.java │ │ ├── CompareOperator.java │ │ ├── ComplexLogicalFilterBuilder.java │ │ ├── ExpressionBuildingListener.java │ │ ├── Filter.java │ │ ├── FilterBuilder.java │ │ ├── FilterComparisonFilterBuilder.java │ │ ├── FilterExpression.java │ │ ├── FilterExpressions.java │ │ ├── FilterParseException.java │ │ ├── FilterResponse.java │ │ ├── GroupExpression.java │ │ ├── InMemoryScimFilterMatcher.java │ │ ├── LogicalExpression.java │ │ ├── LogicalOperator.java │ │ ├── PageRequest.java │ │ ├── SimpleLogicalFilterBuilder.java │ │ ├── SortOrder.java │ │ ├── SortRequest.java │ │ ├── ValueFilterExpression.java │ │ ├── ValuePathExpression.java │ │ └── attribute │ │ │ ├── AttributeReference.java │ │ │ ├── AttributeReferenceListWrapper.java │ │ │ └── ScimRequestContext.java │ │ ├── patch │ │ ├── PatchOperation.java │ │ ├── PatchOperationPath.java │ │ └── PatchPathListener.java │ │ ├── phonenumber │ │ ├── PhoneNumberParseException.java │ │ └── PhoneNumberParseTreeListener.java │ │ ├── resources │ │ ├── Address.java │ │ ├── BaseResource.java │ │ ├── Email.java │ │ ├── Entitlement.java │ │ ├── GroupMembership.java │ │ ├── Im.java │ │ ├── Name.java │ │ ├── PhoneNumber.java │ │ ├── Photo.java │ │ ├── Role.java │ │ ├── ScimExtension.java │ │ ├── ScimGroup.java │ │ ├── ScimResource.java │ │ ├── ScimResourceWithOptionalId.java │ │ ├── ScimUser.java │ │ ├── TypedAttribute.java │ │ ├── UserGroup.java │ │ └── X509Certificate.java │ │ ├── schema │ │ ├── AttributeContainer.java │ │ ├── Mapper.java │ │ ├── Meta.java │ │ ├── ResourceType.java │ │ ├── Schema.java │ │ ├── Schemas.java │ │ ├── ScimSpecSchema.java │ │ ├── ScimType.java │ │ └── ServiceProviderConfiguration.java │ │ └── validator │ │ ├── Urn.java │ │ └── UrnValidator.java │ └── test │ ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── spec │ │ ├── AllSchemaTypesExtension.java │ │ ├── ComplexType.java │ │ ├── ComplexTypeExtension.java │ │ ├── LuckyNumberExtension.java │ │ ├── ObjectMapperFactory.java │ │ ├── filter │ │ ├── AbstractLexerParserTest.java │ │ ├── FilterBuilderEqualsTest.java │ │ ├── FilterBuilderGreaterTest.java │ │ ├── FilterBuilderLessThanTest.java │ │ ├── FilterBuilderNotEqualsTest.java │ │ ├── FilterBuilderPresentTest.java │ │ ├── FilterBuilderStringTest.java │ │ ├── FilterBuilderTest.java │ │ ├── FilterTest.java │ │ ├── InMemoryScimFilterMatcherTest.java │ │ └── attribute │ │ │ └── AttributeReferenceTest.java │ │ ├── patch │ │ └── PatchOperationPathTest.java │ │ ├── phonenumber │ │ └── PhoneNumberTest.java │ │ ├── resources │ │ ├── PhoneNumberBuilderTest.java │ │ └── PhoneNumberJsonTest.java │ │ └── schema │ │ ├── AttributeAssert.java │ │ ├── MapperTest.java │ │ ├── SchemaTest.java │ │ └── SchemasTest.java │ └── resources │ └── schemas │ ├── EnterpriseUser.json │ ├── Group.json │ ├── ResourceType.json │ ├── Schema.json │ ├── ServiceProviderConfig.json │ ├── User.json │ └── schema-schema.json ├── scim-test ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── apache │ └── directory │ └── scim │ └── test │ ├── assertj │ ├── IterablePatchOperationAssert.java │ ├── PatchOperationAssert.java │ ├── ScimGroupAssert.java │ └── ScimpleAssertions.java │ └── stub │ ├── ExampleObjectExtension.java │ ├── Order.java │ └── Subobject.java ├── scim-tools ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── tools │ │ ├── diff │ │ └── PatchGenerator.java │ │ └── lint │ │ ├── Lint.java │ │ └── LintException.java │ └── test │ ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── tools │ │ ├── diff │ │ └── PatchGeneratorTest.java │ │ └── lint │ │ └── LintTest.java │ └── resources │ └── examples │ ├── enterprise-user-example.json │ ├── full-user-example.json │ ├── group-example.json │ ├── minimal-user-example.json │ ├── resource-type-group-example.json │ └── resource-type-user-example.json ├── src ├── ci-templates │ ├── release-failure-summary.md │ ├── release-success-summary.md │ └── snapshot-success-summary.md ├── owasp │ └── suppression.xml ├── pmd │ └── ruleset.xml ├── scripts │ └── release.sh └── spotbugs │ └── excludes.xml └── support └── spring-boot ├── pom.xml └── src ├── main ├── java │ └── org │ │ └── apache │ │ └── directory │ │ └── scim │ │ └── spring │ │ └── ScimpleSpringConfiguration.java └── resources │ └── META-INF │ └── spring │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports └── test ├── java └── org │ └── apache │ └── directory │ └── scim │ └── spring │ └── it │ └── app │ ├── InMemoryGroupService.java │ ├── InMemoryUserService.java │ ├── ScimpleSpringApp.java │ └── SpringScimServer.java └── resources └── META-INF └── services └── org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | github: 18 | description: "Apache Directory - SCIMple" 19 | homepage: https://directory.apache.org/scimple/ 20 | features: 21 | wiki: false 22 | issues: true 23 | projects: false 24 | labels: 25 | - scim 26 | - java 27 | - apache 28 | - directory 29 | - apache-directory 30 | - network-server 31 | - network-client 32 | dependabot_alerts: true 33 | dependabot_updates: true 34 | del_branch_on_merge: true 35 | autolink_jira: 36 | - SCIMPLE 37 | - DIR 38 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | 15 | [*] 16 | charset=utf-8 17 | end_of_line=lf 18 | insert_final_newline=true 19 | indent_style=space 20 | indent_size=2 21 | -------------------------------------------------------------------------------- /.githooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Runs License header checks with Apache Rat 23 | # ---------------------------------------------------------------------------- 24 | 25 | ./mvnw apache-rat:check 26 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | version: 2 19 | updates: 20 | # Dependencies for Maven 21 | - package-ecosystem: 'maven' 22 | directory: '/' 23 | schedule: 24 | interval: 'weekly' 25 | open-pull-requests-limit: 10 26 | 27 | # Dependencies for GitHub Actions 28 | - package-ecosystem: 'github-actions' 29 | directory: '/' 30 | schedule: 31 | interval: 'daily' 32 | open-pull-requests-limit: 10 33 | -------------------------------------------------------------------------------- /.github/workflows/build-reproducible.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | name: Build Reproducibility Check 21 | 22 | on: 23 | workflow_dispatch: 24 | inputs: 25 | ref: 26 | description: The branch, tag or SHA to checkout 27 | default: 'develop' 28 | type: string 29 | 30 | env: 31 | MAVEN_ARGS: -V -B --no-transfer-progress 32 | 33 | jobs: 34 | build: 35 | runs-on: ubuntu-latest 36 | strategy: 37 | matrix: 38 | java: [21] 39 | 40 | steps: 41 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 42 | with: 43 | ref: ${{ inputs.ref }} 44 | 45 | - name: Set up Java ${{ matrix.java }}-zulu 46 | uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4.7.0 47 | with: 48 | java-version: ${{ matrix.java }} 49 | distribution: zulu 50 | cache: '' # disabled 51 | 52 | - name: Running Maven 53 | run: ./mvnw install 54 | env: 55 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} 56 | 57 | - name: Running Maven again to check reproducibility 58 | run: ./mvnw clean verify artifact:compare 59 | env: 60 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} 61 | 62 | - name: Upload Build Info 63 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 64 | with: 65 | name: Artifact BuildInfo 66 | path: target/scimple-*.buildinfo 67 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Build & Test 19 | 20 | on: 21 | pull_request: 22 | branches: [ develop ] 23 | 24 | jobs: 25 | build: 26 | 27 | strategy: 28 | matrix: 29 | java: [17, 21] 30 | 31 | uses: ./.github/workflows/maven.yml 32 | with: 33 | mvn: verify -Pci 34 | name: "Maven Verify (with Java ${{ matrix.java }}-zulu)" 35 | jobs_path: "build (${{ matrix.java }}) / maven" 36 | java-version: ${{ matrix.java }} 37 | java-distribution: 'zulu' 38 | secrets: inherit 39 | -------------------------------------------------------------------------------- /.github/workflows/rat.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Apache Rat 19 | 20 | on: 21 | push: 22 | branches: [ develop ] 23 | pull_request: 24 | branches: [ develop ] 25 | 26 | jobs: 27 | rat: 28 | uses: ./.github/workflows/maven.yml 29 | with: 30 | name: "Apache Rat - Check" 31 | jobs_path: "rat / maven" 32 | mvn: apache-rat:check 33 | java-version: 17 34 | java-distribution: 'zulu' 35 | secrets: inherit 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .metadata 2 | .classpath 3 | .errai 4 | .project 5 | .settings/ 6 | target/ 7 | .factorypath 8 | .vscode/ 9 | *.iml 10 | .idea/ 11 | .mvn/.develocity/develocity-workspace-id 12 | -------------------------------------------------------------------------------- /.mvn/develocity.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 25 | scimple 26 | 27 | https://develocity.apache.org 28 | 29 | 30 | #{isFalse(env['GITHUB_ACTIONS'])} 31 | 32 | authenticated 33 | 34 | 35 | #{{'0.0.0.0'}} 36 | 37 | 38 | 39 | 40 | #{isFalse(env['GITHUB_ACTIONS'])} 41 | 42 | 43 | false 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | com.gradle 26 | develocity-maven-extension 27 | 2.0 28 | 29 | 30 | com.gradle 31 | common-custom-user-data-maven-extension 32 | 2.0.1 33 | 34 | 35 | -------------------------------------------------------------------------------- /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | --threads=1.5C 2 | 3 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip 20 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, 9 | # software distributed under the License is distributed on an 10 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 | # KIND, either express or implied. See the License for the 12 | # specific language governing permissions and limitations 13 | # under the License. 14 | # 15 | 16 | FROM jboss/wildfly 17 | 18 | RUN /opt/jboss/wildfly/bin/add-user.sh vadmin vpassword --silent 19 | 20 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] 21 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Directory SCIMple 2 | Copyright 2018-Present The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Files located in scim-client/src/main/java/org/apache/directory/scim/client/rest/ were copied 8 | from https://github.com/PennState/commons-jaxrs and retain the original copyright. 9 | 10 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/RestCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The Pennsylvania State University © 2016 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, 11 | * software distributed under the License is distributed on an 12 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | * KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | package org.apache.directory.scim.client.rest; 18 | 19 | import jakarta.ws.rs.client.Invocation; 20 | import jakarta.ws.rs.core.Response; 21 | 22 | /** 23 | * Corresponds to {@link java.util.function.Function} but specific to REST calls. 24 | */ 25 | @FunctionalInterface 26 | public interface RestCall { 27 | Response apply(Invocation request) throws RestException; 28 | } 29 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/ScimGroupClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.core.GenericType; 24 | 25 | import org.apache.directory.scim.protocol.data.ListResponse; 26 | import org.apache.directory.scim.spec.resources.ScimGroup; 27 | 28 | public class ScimGroupClient extends BaseScimClient { 29 | 30 | private static final GenericType> SCIM_GROUP_LIST = new GenericType>(){}; 31 | 32 | public ScimGroupClient(Client client, String baseUrl) { 33 | super(client, baseUrl, ScimGroup.class, SCIM_GROUP_LIST); 34 | } 35 | 36 | public ScimGroupClient(Client client, String baseUrl, RestCall invoke) { 37 | super(client, baseUrl, ScimGroup.class, SCIM_GROUP_LIST, invoke); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/ScimJacksonXmlBindJsonProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest; 21 | 22 | import com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider; 23 | import jakarta.enterprise.context.ApplicationScoped; 24 | import jakarta.inject.Inject; 25 | import jakarta.ws.rs.Consumes; 26 | import jakarta.ws.rs.Produces; 27 | import jakarta.ws.rs.ext.Provider; 28 | import org.apache.directory.scim.core.json.ObjectMapperFactory; 29 | import org.apache.directory.scim.core.schema.SchemaRegistry; 30 | import org.apache.directory.scim.protocol.Constants; 31 | 32 | /** 33 | * Adds JacksonJaxbJsonProvider for custom MediaType {@code application/scim+json}. 34 | */ 35 | @Provider 36 | @Consumes(Constants.SCIM_CONTENT_TYPE) 37 | @Produces(Constants.SCIM_CONTENT_TYPE) 38 | @ApplicationScoped 39 | public class ScimJacksonXmlBindJsonProvider extends JacksonXmlBindJsonProvider { 40 | 41 | @Inject 42 | public ScimJacksonXmlBindJsonProvider(SchemaRegistry schemaRegistry) { 43 | super(ObjectMapperFactory.createObjectMapper(schemaRegistry), DEFAULT_ANNOTATIONS); 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/ScimUserClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.core.GenericType; 24 | 25 | import org.apache.directory.scim.protocol.data.ListResponse; 26 | import org.apache.directory.scim.spec.resources.ScimUser; 27 | 28 | public class ScimUserClient extends BaseScimClient { 29 | 30 | private static final GenericType> LIST_SCIM_USER = new GenericType>(){}; 31 | 32 | public ScimUserClient(Client client, String baseUrl) { 33 | super(client, baseUrl, ScimUser.class, LIST_SCIM_USER); 34 | } 35 | 36 | public ScimUserClient(Client client, String baseUrl, RestCall invoke) { 37 | super(client, baseUrl, ScimUser.class, LIST_SCIM_USER, invoke); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/legacy/Version1ScimGroupClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest.legacy; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.core.MediaType; 24 | 25 | import org.apache.directory.scim.client.rest.ScimGroupClient; 26 | import org.apache.directory.scim.client.rest.RestCall; 27 | 28 | public class Version1ScimGroupClient extends ScimGroupClient { 29 | 30 | public Version1ScimGroupClient(Client client, String baseUrl) { 31 | super(client, baseUrl); 32 | } 33 | 34 | public Version1ScimGroupClient(Client client, String baseUrl, RestCall invoke) { 35 | super(client, baseUrl, invoke); 36 | } 37 | 38 | @Override 39 | protected String getContentType() { 40 | return MediaType.APPLICATION_JSON; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /scim-client/src/main/java/org/apache/directory/scim/client/rest/legacy/Version1ScimUserClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest.legacy; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.core.MediaType; 24 | 25 | import org.apache.directory.scim.client.rest.ScimUserClient; 26 | import org.apache.directory.scim.client.rest.RestCall; 27 | 28 | public class Version1ScimUserClient extends ScimUserClient { 29 | 30 | public Version1ScimUserClient(Client client, String baseUrl) { 31 | super(client, baseUrl); 32 | } 33 | 34 | public Version1ScimUserClient(Client client, String baseUrl, RestCall invoke) { 35 | super(client, baseUrl, invoke); 36 | } 37 | 38 | @Override 39 | protected String getContentType() { 40 | return MediaType.APPLICATION_JSON; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /scim-client/src/test/java/org/apache/directory/scim/client/rest/ClientTestSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.client.rest; 21 | 22 | import com.fasterxml.jackson.core.JsonProcessingException; 23 | import com.fasterxml.jackson.databind.ObjectMapper; 24 | import com.fasterxml.jackson.databind.ObjectWriter; 25 | import okhttp3.mockwebserver.MockResponse; 26 | import org.apache.directory.scim.client.rest.junit.MockServerClientTestRunner; 27 | import org.junit.jupiter.api.Assertions; 28 | import org.junit.jupiter.api.extension.ExtendWith; 29 | 30 | import java.util.Map; 31 | 32 | @ExtendWith(MockServerClientTestRunner.class) 33 | abstract class ClientTestSupport { 34 | 35 | private final ObjectWriter objectWriter = new ObjectMapper().writerWithDefaultPrettyPrinter(); 36 | 37 | MockResponse scimResponse() { 38 | return new MockResponse() 39 | .setHeader("Content-Type", "application/scim+json"); 40 | } 41 | 42 | MockResponse scimResponse(Map json) { 43 | try { 44 | return scimResponse() 45 | .setBody(objectWriter.writeValueAsString(json)) 46 | .setResponseCode(200); 47 | } catch (JsonProcessingException e) { 48 | Assertions.fail(e); 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /scim-compliance-tests/src/main/java/org/apache/directory/scim/compliance/tests/ResourceTypesIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.compliance.tests; 21 | 22 | import org.apache.directory.scim.compliance.junit.EmbeddedServerExtension; 23 | import org.junit.jupiter.api.DisplayName; 24 | import org.junit.jupiter.api.Test; 25 | import org.junit.jupiter.api.extension.ExtendWith; 26 | 27 | import static org.hamcrest.Matchers.*; 28 | 29 | @ExtendWith(EmbeddedServerExtension.class) 30 | public class ResourceTypesIT extends ScimpleITSupport { 31 | 32 | @Test 33 | @DisplayName("ResourceTypes endpoint") 34 | public void resourceTypes() { 35 | get("/ResourceTypes") 36 | .statusCode(200) 37 | .body( 38 | "Resources", not(empty()), 39 | "schemas", hasItem(SCHEMA_LIST_RESPONSE), 40 | "itemsPerPage", isNumber(), 41 | "startIndex", isNumber(), 42 | "totalResults", isNumber(), 43 | "Resources[0].name", not(emptyString()), 44 | "Resources[0].endpoint", not(emptyString()), 45 | "Resources[0].schema", not(emptyString()) 46 | ); 47 | } 48 | 49 | @Test 50 | @DisplayName("Check if ResourceTypes is read-only") 51 | public void endpointIsReadOnly() { 52 | post("/ResourceTypes", "") 53 | .statusCode(405); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /scim-compliance-tests/src/main/java/org/apache/directory/scim/compliance/tests/SchemasIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.compliance.tests; 21 | 22 | import org.apache.directory.scim.compliance.junit.EmbeddedServerExtension; 23 | import org.junit.jupiter.api.DisplayName; 24 | import org.junit.jupiter.api.Test; 25 | import org.junit.jupiter.api.extension.ExtendWith; 26 | 27 | import static org.hamcrest.Matchers.*; 28 | 29 | @ExtendWith(EmbeddedServerExtension.class) 30 | public class SchemasIT extends ScimpleITSupport { 31 | 32 | @Test 33 | @DisplayName("ResourceTypes endpoint") 34 | public void resourceTypes() { 35 | get("/Schemas") 36 | .statusCode(200) 37 | .body( 38 | "Resources", not(empty()), 39 | "schemas", hasItem(SCHEMA_LIST_RESPONSE), 40 | "itemsPerPage", isNumber(), 41 | "startIndex", isNumber(), 42 | "totalResults", isNumber(), 43 | "Resources[0].id", not(emptyString()), 44 | "Resources[0].attributes", not(emptyString()) 45 | ); 46 | } 47 | 48 | @Test 49 | @DisplayName("Check if Schemas is read-only") 50 | public void endpointIsReadOnly() { 51 | post("/Schemas", "") 52 | .statusCode(405); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /scim-compliance-tests/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.compliance.junit.EmbeddedServerExtension 20 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/InvalidRepositoryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository; 21 | 22 | public class InvalidRepositoryException extends Exception { 23 | public InvalidRepositoryException(String message) { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/PatchHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository; 21 | 22 | import org.apache.directory.scim.spec.exception.UnsupportedFilterException; 23 | import org.apache.directory.scim.spec.exception.MutabilityException; 24 | import org.apache.directory.scim.spec.patch.PatchOperation; 25 | import org.apache.directory.scim.spec.resources.ScimResource; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * A PatchHandler applies PatchOperations to a ScimResource. PatchOperations are a payload in a PATCH REST request. 31 | */ 32 | public interface PatchHandler { 33 | 34 | /** 35 | * Applies patch operations to a ScimResource. 36 | * 37 | * @param original The source ScimResource to apply patches to. 38 | * @param patchOperations The list of patch operations to apply. 39 | * @return An updated ScimResource with all patches applied 40 | * @param The type of ScimResource. 41 | * @throws UnsupportedFilterException if the patch operations are invalid. 42 | * @throws MutabilityException if an attribute is not allowed to be updated. 43 | */ 44 | T apply(final T original, final List patchOperations); 45 | } 46 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/SelfIdResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository; 21 | 22 | import org.apache.directory.scim.spec.exception.ResourceException; 23 | 24 | import java.security.Principal; 25 | 26 | public interface SelfIdResolver { 27 | 28 | String resolveToInternalId(Principal principal) throws ResourceException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/annotations/ProcessingExtensions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository.annotations; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Inherited; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | import java.lang.annotation.Target; 28 | 29 | @Target({ ElementType.TYPE}) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Documented 32 | @Inherited 33 | public @interface ProcessingExtensions { 34 | 35 | /** 36 | * An array of one or more {@link ScimProcessingExtension @ScimProcessingExtension} declarations. 37 | */ 38 | ScimProcessingExtension[] value(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/annotations/ScimProcessingExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository.annotations; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Inherited; 25 | import java.lang.annotation.Repeatable; 26 | import java.lang.annotation.Retention; 27 | import java.lang.annotation.RetentionPolicy; 28 | import java.lang.annotation.Target; 29 | 30 | import org.apache.directory.scim.core.repository.extensions.ProcessingExtension; 31 | 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target({ElementType.TYPE}) 34 | @Documented 35 | @Inherited 36 | @Repeatable(ProcessingExtensions.class) 37 | public @interface ScimProcessingExtension { 38 | 39 | Class[] value(); 40 | } 41 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/extensions/AttributeFilterExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository.extensions; 21 | 22 | import org.apache.directory.scim.spec.filter.attribute.ScimRequestContext; 23 | import org.apache.directory.scim.spec.resources.ScimResource; 24 | 25 | public interface AttributeFilterExtension extends ProcessingExtension { 26 | 27 | ScimResource filterAttributes(ScimResource scimResource, ScimRequestContext scimRequestContext) throws ClientFilterException; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/extensions/ClientFilterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository.extensions; 21 | 22 | public class ClientFilterException extends Exception { 23 | 24 | private static final long serialVersionUID = 3308947684934769952L; 25 | 26 | private final int status; 27 | 28 | public ClientFilterException(int statusCode, String message) { 29 | super(message); 30 | this.status = statusCode; 31 | } 32 | 33 | public int getStatus() { 34 | return this.status; 35 | } 36 | 37 | public String toString() { 38 | return "ClientFilterException(status=" + this.getStatus() + ", " + getMessage() + ")"; 39 | } 40 | 41 | public boolean equals(final Object o) { 42 | if (o == this) return true; 43 | if (!(o instanceof ClientFilterException)) return false; 44 | final ClientFilterException other = (ClientFilterException) o; 45 | if (!other.canEqual((Object) this)) return false; 46 | if (!super.equals(o)) return false; 47 | if (this.getStatus() != other.getStatus()) return false; 48 | return true; 49 | } 50 | 51 | protected boolean canEqual(final Object other) { 52 | return other instanceof ClientFilterException; 53 | } 54 | 55 | public int hashCode() { 56 | final int PRIME = 59; 57 | int result = super.hashCode(); 58 | result = result * PRIME + this.getStatus(); 59 | return result; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /scim-core/src/main/java/org/apache/directory/scim/core/repository/extensions/ProcessingExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository.extensions; 21 | 22 | public interface ProcessingExtension { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /scim-core/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /scim-core/src/test/java/org/apache/directory/scim/core/repository/RepositorySchemaRegistryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.core.repository; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | import org.apache.directory.scim.spec.resources.ScimUser; 25 | import org.apache.directory.scim.spec.schema.Schema; 26 | import org.apache.directory.scim.core.schema.SchemaRegistry; 27 | import org.junit.jupiter.api.Test; 28 | import org.junit.jupiter.api.extension.ExtendWith; 29 | import org.mockito.Mock; 30 | import org.mockito.junit.jupiter.MockitoExtension; 31 | 32 | @ExtendWith(MockitoExtension.class) 33 | public class RepositorySchemaRegistryTest { 34 | 35 | SchemaRegistry schemaRegistry; 36 | 37 | @Mock 38 | Repository repository; 39 | 40 | RepositoryRegistry repositoryRegistry; 41 | 42 | public RepositorySchemaRegistryTest() { 43 | schemaRegistry = new SchemaRegistry(); 44 | repositoryRegistry = new RepositoryRegistry(schemaRegistry); 45 | } 46 | 47 | @Test 48 | public void testAddRepository() throws Exception { 49 | repositoryRegistry.registerRepository(ScimUser.class, repository); 50 | 51 | Schema schema = schemaRegistry.getSchema(ScimUser.SCHEMA_URI); 52 | 53 | assertThat(schema).isNotNull(); 54 | assertThat(schema.getId()).isEqualTo(ScimUser.SCHEMA_URI); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-jersey/README.md: -------------------------------------------------------------------------------- 1 | Apache Directory SCIMple In Memory Example 2 | ========================================== 3 | 4 | This example project demo's how to: 5 | 6 | * Add a custom SCIM Extension 7 | * Manage Users and Groups (in memory) 8 | 9 | Use this as a starter point on how to integrate Apache Directory SCIMple into your own project. 10 | 11 | Run: `mvn package exec:run` and then access one of the endpoints: 12 | 13 | ```bash 14 | # httpie 15 | http :8080/Users 16 | 17 | # curl 18 | curl localhost:8080/Users 19 | ``` 20 | n 21 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-jersey/src/main/java/org/apache/directory/scim/example/jersey/service/InMemorySelfResolverImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.jersey.service; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import org.apache.directory.scim.server.exception.UnableToResolveIdResourceException; 24 | import org.apache.directory.scim.core.repository.SelfIdResolver; 25 | 26 | import java.security.Principal; 27 | 28 | import jakarta.ws.rs.core.Response.Status; 29 | 30 | @ApplicationScoped 31 | public class InMemorySelfResolverImpl implements SelfIdResolver { 32 | 33 | @Override 34 | public String resolveToInternalId(Principal principal) throws UnableToResolveIdResourceException { 35 | throw new UnableToResolveIdResourceException(Status.NOT_IMPLEMENTED, "Caller Principal not available"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-jersey/src/main/resources/beans.xml: -------------------------------------------------------------------------------- 1 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-jersey/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-jersey/src/test/resources/META-INF/services/org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.example.jersey.JerseyTestServer 20 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/README.md: -------------------------------------------------------------------------------- 1 | Apache Directory SCIMple In Memory Example 2 | ========================================== 3 | 4 | This example WAR project demo's how to: 5 | 6 | * Add a custom SCIM Extension 7 | * Manage Users and Groups (in memory) 8 | 9 | Use this as a starter point on how to integrate Apache Directory SCIMple into your own project. 10 | 11 | Run: `mvn` and then access one of the endpoints: 12 | 13 | ```bash 14 | # httpie 15 | http :8080/v2/Users 16 | 17 | # curl 18 | curl localhost:8080/v2/Users 19 | ``` 20 | n 21 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/src/main/java/org/apache/directory/scim/example/memory/rest/RestApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.memory.rest; 21 | 22 | import jakarta.enterprise.inject.Produces; 23 | import org.apache.directory.scim.server.configuration.ServerConfiguration; 24 | 25 | import jakarta.ws.rs.ApplicationPath; 26 | import jakarta.ws.rs.core.Application; 27 | 28 | import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.httpBasic; 29 | 30 | @ApplicationPath("v2") 31 | public class RestApplication extends Application { 32 | 33 | @Produces 34 | ServerConfiguration serverConfiguration() { 35 | return new ServerConfiguration() 36 | .setId("scimple-in-memory-example") 37 | .addAuthenticationSchema(httpBasic()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/src/main/java/org/apache/directory/scim/example/memory/service/InMemorySelfResolverImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.memory.service; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import org.apache.directory.scim.server.exception.UnableToResolveIdResourceException; 24 | import org.apache.directory.scim.core.repository.SelfIdResolver; 25 | 26 | import java.security.Principal; 27 | 28 | import jakarta.ws.rs.core.Response.Status; 29 | 30 | @ApplicationScoped 31 | public class InMemorySelfResolverImpl implements SelfIdResolver { 32 | 33 | @Override 34 | public String resolveToInternalId(Principal principal) throws UnableToResolveIdResourceException { 35 | throw new UnableToResolveIdResourceException(Status.NOT_IMPLEMENTED, "Caller Principal not available"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 23 | / 24 | 25 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-memory/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/README.md: -------------------------------------------------------------------------------- 1 | Apache Directory SCIMple Quarkus Example 2 | ========================================== 3 | 4 | This example project demo's how to: 5 | 6 | * Add a custom SCIM Extension 7 | * Manage Users and Groups (in memory) 8 | 9 | Use this as a starter point on how to integrate Apache Directory SCIMple into your own project. 10 | 11 | Run: `mvn quarkus:dev` and then access one of the endpoints: 12 | 13 | ```bash 14 | # httpie 15 | http :8080/v2/Users 16 | 17 | # curl 18 | curl localhost:8080/v2/Users 19 | ``` 20 | n 21 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/main/java/org/apache/directory/scim/example/quarkus/QuarkusApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.enterprise.inject.Produces; 24 | import jakarta.ws.rs.ApplicationPath; 25 | import org.apache.directory.scim.server.configuration.ServerConfiguration; 26 | 27 | import java.util.Set; 28 | 29 | import jakarta.ws.rs.core.Application; 30 | import org.apache.directory.scim.server.rest.ScimResourceHelper; 31 | 32 | import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.oauthBearer; 33 | 34 | @ApplicationPath("v2") 35 | @ApplicationScoped 36 | public class QuarkusApplication extends Application { 37 | 38 | @Override 39 | public Set> getClasses() { 40 | return ScimResourceHelper.scimpleFeatureAndResourceClasses(); 41 | } 42 | 43 | @Produces 44 | ServerConfiguration serverConfiguration() { 45 | return new ServerConfiguration() 46 | // Set any unique configuration bits 47 | .setId("scimple-quarkus-example") 48 | .setDocumentationUri("https://github.com/apache/directory-scimple") 49 | // set the auth scheme too 50 | .addAuthenticationSchema(oauthBearer()); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/main/java/org/apache/directory/scim/example/quarkus/service/InMemorySelfResolverImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus.service; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import org.apache.directory.scim.server.exception.UnableToResolveIdResourceException; 24 | import org.apache.directory.scim.core.repository.SelfIdResolver; 25 | 26 | import java.security.Principal; 27 | 28 | import jakarta.ws.rs.core.Response.Status; 29 | 30 | @ApplicationScoped 31 | public class InMemorySelfResolverImpl implements SelfIdResolver { 32 | 33 | @Override 34 | public String resolveToInternalId(Principal principal) throws UnableToResolveIdResourceException { 35 | throw new UnableToResolveIdResourceException(Status.NOT_IMPLEMENTED, "Caller Principal not available"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/java/org/apache/directory/scim/example/quarkus/QuarkusGroupsIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import io.quarkus.test.common.http.TestHTTPResource; 23 | import io.quarkus.test.junit.QuarkusIntegrationTest; 24 | import org.apache.directory.scim.compliance.tests.GroupsIT; 25 | import org.junit.jupiter.api.parallel.Isolated; 26 | 27 | import java.net.URI; 28 | 29 | /** 30 | * Wraps GroupsIT in a Quarkus friendly runner. 31 | */ 32 | @QuarkusIntegrationTest 33 | @Isolated 34 | public class QuarkusGroupsIT extends GroupsIT { 35 | 36 | @TestHTTPResource("/v2") 37 | URI uri; 38 | 39 | @Override 40 | protected URI uri() { 41 | return uri; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/java/org/apache/directory/scim/example/quarkus/QuarkusResourceTypesIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import io.quarkus.test.common.http.TestHTTPResource; 23 | import io.quarkus.test.junit.QuarkusIntegrationTest; 24 | import org.apache.directory.scim.compliance.tests.ResourceTypesIT; 25 | import org.junit.jupiter.api.parallel.Isolated; 26 | 27 | import java.net.URI; 28 | 29 | /** 30 | * Wraps ResourceTypesIT in a Quarkus friendly runner. 31 | */ 32 | @QuarkusIntegrationTest 33 | @Isolated 34 | public class QuarkusResourceTypesIT extends ResourceTypesIT { 35 | 36 | @TestHTTPResource("/v2") 37 | URI uri; 38 | 39 | @Override 40 | protected URI uri() { 41 | return uri; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/java/org/apache/directory/scim/example/quarkus/QuarkusSchemasIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import io.quarkus.test.common.http.TestHTTPResource; 23 | import io.quarkus.test.junit.QuarkusIntegrationTest; 24 | import org.apache.directory.scim.compliance.tests.SchemasIT; 25 | import org.junit.jupiter.api.parallel.Isolated; 26 | 27 | import java.net.URI; 28 | 29 | /** 30 | * Wraps SchemasIT in a Quarkus friendly runner. 31 | */ 32 | @QuarkusIntegrationTest 33 | @Isolated 34 | public class QuarkusSchemasIT extends SchemasIT { 35 | 36 | @TestHTTPResource("/v2") 37 | URI uri; 38 | 39 | @Override 40 | protected URI uri() { 41 | return uri; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/java/org/apache/directory/scim/example/quarkus/QuarkusServiceProviderConfigIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import io.quarkus.test.common.http.TestHTTPResource; 23 | import io.quarkus.test.junit.QuarkusIntegrationTest; 24 | import org.apache.directory.scim.compliance.tests.ServiceProviderConfigIT; 25 | import org.junit.jupiter.api.parallel.Isolated; 26 | 27 | import java.net.URI; 28 | 29 | /** 30 | * Wraps ServiceProviderConfigIT in a Quarkus friendly runner. 31 | */ 32 | @QuarkusIntegrationTest 33 | @Isolated 34 | public class QuarkusServiceProviderConfigIT extends ServiceProviderConfigIT { 35 | 36 | @TestHTTPResource("/v2") 37 | URI uri; 38 | 39 | @Override 40 | protected URI uri() { 41 | return uri; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/java/org/apache/directory/scim/example/quarkus/QuarkusUsersIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.quarkus; 21 | 22 | import io.quarkus.test.common.http.TestHTTPResource; 23 | import io.quarkus.test.junit.QuarkusIntegrationTest; 24 | import org.apache.directory.scim.compliance.tests.UsersIT; 25 | import org.junit.jupiter.api.parallel.Isolated; 26 | 27 | import java.net.URI; 28 | 29 | /** 30 | * Wraps UsersIT in a Quarkus friendly runner. 31 | */ 32 | @QuarkusIntegrationTest 33 | @Isolated 34 | public class QuarkusUsersIT extends UsersIT { 35 | 36 | @TestHTTPResource("/v2") 37 | URI uri; 38 | 39 | @Override 40 | protected URI uri() { 41 | return uri; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-quarkus/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | quarkus.http.test-port=0 20 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-spring-boot/README.md: -------------------------------------------------------------------------------- 1 | Apache Directory SCIMple In Memory Example 2 | ========================================== 3 | 4 | This example project demo's how to: 5 | 6 | * Add a custom SCIM Extension 7 | * Manage Users and Groups (in memory) 8 | 9 | Use this as a starter point on how to integrate Apache Directory SCIMple into your own project. 10 | 11 | Run: `mvn spring-boot:run` and then access one of the endpoints: 12 | 13 | ```bash 14 | # httpie 15 | http :8080/v2/Users 16 | 17 | # curl 18 | curl localhost:8080/v2/Users 19 | ``` 20 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-spring-boot/src/main/java/org/apache/directory/scim/example/spring/ScimpleSpringBootApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.spring; 21 | 22 | import org.apache.directory.scim.server.configuration.ServerConfiguration; 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | import org.springframework.context.annotation.Bean; 26 | 27 | import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.httpBasic; 28 | 29 | @SpringBootApplication 30 | public class ScimpleSpringBootApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(ScimpleSpringBootApplication.class, args); 34 | } 35 | 36 | @Bean 37 | ServerConfiguration serverConfiguration() { 38 | // Set any unique configuration bits 39 | return new ServerConfiguration() 40 | .setId("scimple-spring-boot-example") 41 | .setDocumentationUri("https://github.com/apache/directory-scimple") 42 | 43 | // set the auth scheme 44 | .addAuthenticationSchema(httpBasic()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-spring-boot/src/main/java/org/apache/directory/scim/example/spring/service/InMemorySelfResolverImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.example.spring.service; 21 | 22 | import org.apache.directory.scim.core.repository.SelfIdResolver; 23 | import org.apache.directory.scim.server.exception.UnableToResolveIdResourceException; 24 | 25 | import java.security.Principal; 26 | 27 | import jakarta.ws.rs.core.Response.Status; 28 | import org.springframework.stereotype.Service; 29 | 30 | @Service 31 | public class InMemorySelfResolverImpl implements SelfIdResolver { 32 | 33 | @Override 34 | public String resolveToInternalId(Principal principal) throws UnableToResolveIdResourceException { 35 | throw new UnableToResolveIdResourceException(Status.NOT_IMPLEMENTED, "Caller Principal not available"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server-examples/scim-server-spring-boot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | server.servlet.context-path = /v2 20 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/AttributeDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | public class AttributeDoesNotExistException extends AttributeException { 23 | 24 | private static final long serialVersionUID = 547510233114396694L; 25 | 26 | public AttributeDoesNotExistException() { 27 | } 28 | 29 | public AttributeDoesNotExistException(String message) { 30 | super(message); 31 | } 32 | 33 | public AttributeDoesNotExistException(Throwable cause) { 34 | super(cause); 35 | } 36 | 37 | public AttributeDoesNotExistException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public AttributeDoesNotExistException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 42 | super(message, cause, enableSuppression, writableStackTrace); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/AttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | public class AttributeException extends Exception { 23 | 24 | private static final long serialVersionUID = 547510233114396694L; 25 | 26 | public AttributeException() { 27 | } 28 | 29 | public AttributeException(String message) { 30 | super(message); 31 | } 32 | 33 | public AttributeException(Throwable cause) { 34 | super(cause); 35 | } 36 | 37 | public AttributeException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public AttributeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 42 | super(message, cause, enableSuppression, writableStackTrace); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/BaseScimExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.core.HttpHeaders; 23 | import jakarta.ws.rs.core.Response; 24 | import jakarta.ws.rs.ext.ExceptionMapper; 25 | import org.apache.directory.scim.protocol.Constants; 26 | import org.apache.directory.scim.protocol.data.ErrorResponse; 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | 30 | abstract class BaseScimExceptionMapper implements ExceptionMapper { 31 | /** A logger for this class */ 32 | private static final Logger log = LoggerFactory.getLogger(BaseScimExceptionMapper.class); 33 | 34 | protected abstract ErrorResponse errorResponse(E throwable); 35 | 36 | @Override 37 | public Response toResponse(E throwable) { 38 | Response response = errorResponse(throwable).toResponse(); 39 | // log client errors (e.g. 404s) at debug, and anything else at warn 40 | if (Response.Status.Family.CLIENT_ERROR.equals(response.getStatusInfo().getFamily())) { 41 | log.debug("Returning error status: {}", response.getStatus(), throwable); 42 | } else { 43 | log.warn("Returning error status: {}", response.getStatus(), throwable); 44 | } 45 | response.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, Constants.SCIM_CONTENT_TYPE); 46 | return response; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/EtagGenerationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | public class EtagGenerationException extends Exception { 23 | 24 | public EtagGenerationException(String message) { 25 | super(message); 26 | } 27 | 28 | public EtagGenerationException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/FilterParseExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.core.MediaType; 24 | import jakarta.ws.rs.core.Response.Status; 25 | 26 | import jakarta.ws.rs.ext.Provider; 27 | import org.apache.directory.scim.protocol.Constants; 28 | import org.apache.directory.scim.protocol.ErrorMessageType; 29 | import org.apache.directory.scim.protocol.data.ErrorResponse; 30 | import org.apache.directory.scim.spec.filter.FilterParseException; 31 | 32 | @Provider 33 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 34 | public class FilterParseExceptionMapper extends BaseScimExceptionMapper { 35 | 36 | @Override 37 | protected ErrorResponse errorResponse(FilterParseException exception) { 38 | return new ErrorResponse(Status.BAD_REQUEST, exception.getMessage()) 39 | .setScimType(ErrorMessageType.INVALID_FILTER); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/GenericExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.core.MediaType; 24 | import jakarta.ws.rs.core.Response; 25 | import jakarta.ws.rs.ext.Provider; 26 | import org.apache.directory.scim.protocol.Constants; 27 | import org.apache.directory.scim.protocol.data.ErrorResponse; 28 | 29 | @Provider 30 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 31 | public class GenericExceptionMapper extends BaseScimExceptionMapper { 32 | 33 | @Override 34 | protected ErrorResponse errorResponse(Throwable throwable) { 35 | return new ErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, throwable.getMessage()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/MutabilityExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.core.MediaType; 24 | import jakarta.ws.rs.core.Response.Status; 25 | import jakarta.ws.rs.ext.Provider; 26 | import org.apache.directory.scim.protocol.Constants; 27 | import org.apache.directory.scim.protocol.ErrorMessageType; 28 | import org.apache.directory.scim.protocol.data.ErrorResponse; 29 | import org.apache.directory.scim.spec.filter.FilterParseException; 30 | 31 | @Provider 32 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 33 | public class MutabilityExceptionMapper extends BaseScimExceptionMapper { 34 | 35 | @Override 36 | protected ErrorResponse errorResponse(FilterParseException exception) { 37 | return new ErrorResponse(Status.BAD_REQUEST, exception.getMessage()) 38 | .setScimType(ErrorMessageType.MUTABILITY); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/ScimExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.core.MediaType; 24 | import jakarta.ws.rs.ext.Provider; 25 | import org.apache.directory.scim.protocol.Constants; 26 | import org.apache.directory.scim.protocol.data.ErrorResponse; 27 | import org.apache.directory.scim.protocol.exception.ScimException; 28 | 29 | @Provider 30 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 31 | public class ScimExceptionMapper extends BaseScimExceptionMapper { 32 | 33 | @Override 34 | protected ErrorResponse errorResponse(ScimException e) { 35 | return e.getError(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/UnableToCreateResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.core.Response.Status; 23 | 24 | import org.apache.directory.scim.spec.exception.ResourceException; 25 | 26 | public class UnableToCreateResourceException extends ResourceException { 27 | 28 | private static final long serialVersionUID = -3872700870424005641L; 29 | 30 | public UnableToCreateResourceException(Status status, String message) { 31 | super(status.getStatusCode(), message); 32 | } 33 | 34 | public UnableToCreateResourceException(Status status, String message, Throwable cause) { 35 | super(status.getStatusCode(), message, cause); 36 | } 37 | 38 | public String toString() { 39 | return "UnableToCreateResourceException(" + getStatus() + ", " + getMessage() + ")"; 40 | } 41 | 42 | public boolean equals(final Object o) { 43 | if (o == this) return true; 44 | if (!(o instanceof UnableToCreateResourceException)) return false; 45 | final UnableToCreateResourceException other = (UnableToCreateResourceException) o; 46 | if (!other.canEqual((Object) this)) return false; 47 | if (!super.equals(o)) return false; 48 | return true; 49 | } 50 | 51 | protected boolean canEqual(final Object other) { 52 | return other instanceof UnableToCreateResourceException; 53 | } 54 | 55 | public int hashCode() { 56 | int result = super.hashCode(); 57 | return result; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/UnsupportedFilterExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.core.Response; 23 | import org.apache.directory.scim.protocol.ErrorMessageType; 24 | import org.apache.directory.scim.protocol.data.ErrorResponse; 25 | import org.apache.directory.scim.spec.exception.UnsupportedFilterException; 26 | 27 | public class UnsupportedFilterExceptionMapper extends BaseScimExceptionMapper { 28 | 29 | @Override 30 | protected ErrorResponse errorResponse(UnsupportedFilterException throwable) { 31 | return new ErrorResponse(Response.Status.BAD_REQUEST, ErrorMessageType.INVALID_FILTER.getDetail()) 32 | .setScimType(ErrorMessageType.INVALID_FILTER); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/UnsupportedOperationExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.core.MediaType; 24 | import jakarta.ws.rs.core.Response; 25 | import jakarta.ws.rs.ext.Provider; 26 | import org.apache.directory.scim.protocol.Constants; 27 | import org.apache.directory.scim.protocol.data.ErrorResponse; 28 | 29 | @Provider 30 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 31 | public class UnsupportedOperationExceptionMapper extends BaseScimExceptionMapper { 32 | 33 | @Override 34 | protected ErrorResponse errorResponse(UnsupportedOperationException throwable) { 35 | return new ErrorResponse(Response.Status.NOT_IMPLEMENTED, throwable.getMessage()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/exception/WebApplicationExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.exception; 21 | 22 | import jakarta.ws.rs.Produces; 23 | import jakarta.ws.rs.WebApplicationException; 24 | import jakarta.ws.rs.core.MediaType; 25 | import jakarta.ws.rs.core.Response.Status; 26 | import jakarta.ws.rs.ext.Provider; 27 | 28 | import org.apache.directory.scim.protocol.Constants; 29 | import org.apache.directory.scim.protocol.data.ErrorResponse; 30 | 31 | @Provider 32 | @Produces({Constants.SCIM_CONTENT_TYPE, MediaType.APPLICATION_JSON}) 33 | public class WebApplicationExceptionMapper extends BaseScimExceptionMapper { 34 | 35 | @Override 36 | protected ErrorResponse errorResponse(WebApplicationException e) { 37 | return new ErrorResponse(Status.fromStatusCode(e.getResponse().getStatus()), e.getMessage()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/filter/ApiOriginFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.filter; 21 | 22 | import java.io.IOException; 23 | 24 | import jakarta.ws.rs.container.ContainerRequestContext; 25 | import jakarta.ws.rs.container.ContainerResponseContext; 26 | import jakarta.ws.rs.container.ContainerResponseFilter; 27 | import jakarta.ws.rs.core.MultivaluedMap; 28 | 29 | public class ApiOriginFilter implements ContainerResponseFilter { 30 | 31 | @Override 32 | public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { 33 | MultivaluedMap headers = responseContext.getHeaders(); 34 | headers.add("Access-Control-Allow-Origin", "*"); 35 | headers.add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); 36 | headers.add("Access-Control-Allow-Headers", "Content-Type, Authorization"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/rest/EtagParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.rest; 21 | 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | import org.apache.commons.lang3.StringUtils; 25 | import org.apache.directory.scim.core.repository.ETag; 26 | 27 | public final class EtagParser { 28 | 29 | private EtagParser() { 30 | } 31 | 32 | /** 33 | * Parse comma-separated entity tags 34 | * 35 | * @param value 36 | * @return 37 | * @throws IllegalArgumentException 38 | */ 39 | public static Set parseETag(String value) throws IllegalArgumentException { 40 | if (StringUtils.isNotBlank(value)) { 41 | Set result = new HashSet<>(); 42 | 43 | for (String etag : value.split(",")) { 44 | etag = etag.trim(); 45 | boolean weakTag = false; 46 | 47 | if (etag.startsWith("W/")) { 48 | weakTag = true; 49 | etag = etag.substring(2); 50 | } 51 | 52 | if (etag.startsWith("\"")) { 53 | etag = etag.substring(1); 54 | } 55 | 56 | if (etag.endsWith("\"")) { 57 | etag = etag.substring(0, etag.length() - 1); 58 | } 59 | 60 | result.add(new ETag(etag, weakTag)); 61 | } 62 | return result; 63 | } else { 64 | return null; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/rest/GroupResourceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.rest; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.inject.Inject; 24 | import org.apache.directory.scim.core.repository.RepositoryRegistry; 25 | import org.apache.directory.scim.protocol.GroupResource; 26 | import org.apache.directory.scim.spec.resources.ScimGroup; 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | import org.apache.directory.scim.core.schema.SchemaRegistry; 30 | 31 | @ApplicationScoped 32 | public class GroupResourceImpl extends BaseResourceTypeResourceImpl implements GroupResource { 33 | /** A logger for this class */ 34 | private static final Logger log = LoggerFactory.getLogger(GroupResourceImpl.class); 35 | 36 | @Inject 37 | public GroupResourceImpl(SchemaRegistry schemaRegistry, RepositoryRegistry repositoryRegistry) { 38 | super(schemaRegistry, repositoryRegistry, ScimGroup.class); 39 | } 40 | 41 | public GroupResourceImpl() { 42 | // CDI 43 | this(null, null); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/rest/ScimpleFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.rest; 21 | 22 | import jakarta.ws.rs.core.Feature; 23 | import jakarta.ws.rs.core.FeatureContext; 24 | import jakarta.ws.rs.ext.Provider; 25 | 26 | import java.util.Collection; 27 | import java.util.stream.Stream; 28 | 29 | import static org.apache.directory.scim.server.rest.ScimResourceHelper.*; 30 | 31 | @Provider 32 | public class ScimpleFeature implements Feature { 33 | 34 | @Override 35 | public boolean configure(FeatureContext context) { 36 | Stream.of(EXCEPTION_MAPPER_CLASSES, MEDIA_TYPE_SUPPORT_CLASSES) 37 | .flatMap(Collection::stream) 38 | .forEach(context::register); 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/rest/SearchResourceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.rest; 21 | 22 | import org.apache.directory.scim.protocol.SearchResource; 23 | 24 | public class SearchResourceImpl implements SearchResource { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /scim-server/src/main/java/org/apache/directory/scim/server/rest/UserResourceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.rest; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.inject.Inject; 24 | import org.apache.directory.scim.core.repository.RepositoryRegistry; 25 | import org.apache.directory.scim.protocol.UserResource; 26 | import org.apache.directory.scim.spec.resources.ScimUser; 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | import org.apache.directory.scim.core.schema.SchemaRegistry; 30 | 31 | /** 32 | * @author shawn 33 | * 34 | */ 35 | @ApplicationScoped 36 | public class UserResourceImpl extends BaseResourceTypeResourceImpl implements UserResource { 37 | /** A logger for this class */ 38 | private static final Logger log = LoggerFactory.getLogger(UserResourceImpl.class); 39 | 40 | @Inject 41 | public UserResourceImpl(SchemaRegistry schemaRegistry, RepositoryRegistry repositoryRegistry) { 42 | super(schemaRegistry, repositoryRegistry, ScimUser.class); 43 | } 44 | 45 | public UserResourceImpl() { 46 | // CDI 47 | this(null, null); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /scim-server/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /scim-server/src/main/resources/META-INF/services/jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.server.spi.ScimServerBuildCompatibleExtension 20 | -------------------------------------------------------------------------------- /scim-server/src/test/java/org/apache/directory/scim/server/it/testapp/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.it.testapp; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.enterprise.inject.Produces; 24 | import jakarta.ws.rs.core.Application; 25 | import org.apache.directory.scim.server.configuration.ServerConfiguration; 26 | import org.apache.directory.scim.server.rest.ScimResourceHelper; 27 | 28 | import java.util.Set; 29 | 30 | import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.httpBasic; 31 | 32 | @ApplicationScoped 33 | public class App extends Application { 34 | 35 | @Override 36 | public Set> getClasses() { 37 | return ScimResourceHelper.scimpleFeatureAndResourceClasses(); 38 | } 39 | 40 | @Produces 41 | ServerConfiguration serverConfiguration() { 42 | return new ServerConfiguration() 43 | .setId("scimple-server-its") 44 | .addAuthenticationSchema(httpBasic()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scim-server/src/test/java/org/apache/directory/scim/server/it/testapp/InMemorySelfResolverImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.server.it.testapp; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.ws.rs.core.Response.Status; 24 | import org.apache.directory.scim.server.exception.UnableToResolveIdResourceException; 25 | import org.apache.directory.scim.core.repository.SelfIdResolver; 26 | 27 | import java.security.Principal; 28 | 29 | @ApplicationScoped 30 | public class InMemorySelfResolverImpl implements SelfIdResolver { 31 | 32 | @Override 33 | public String resolveToInternalId(Principal principal) throws UnableToResolveIdResourceException { 34 | throw new UnableToResolveIdResourceException(Status.NOT_IMPLEMENTED, "Caller Principal not available"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /scim-server/src/test/resources/META-INF/services/org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.server.it.JerseyTestServer 20 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol; 21 | 22 | public final class Constants { 23 | 24 | private Constants() { 25 | } 26 | 27 | public static final String SCIM_CONTENT_TYPE = "application/scim+json"; 28 | public static final String PATCH = "PATCH"; 29 | } 30 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/GroupResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol; 21 | 22 | import io.swagger.v3.oas.annotations.tags.Tag; 23 | import jakarta.ws.rs.Path; 24 | 25 | import org.apache.directory.scim.spec.resources.ScimGroup; 26 | 27 | //@formatter:off 28 | /** 29 | * From SCIM Protocol Specification, section 3, page 9 30 | * 31 | * @see Scim spec section 3.2 32 | *

33 | * Resource Endpoint Operations Description 34 | -------- ---------------- ---------------------- -------------------- 35 | Group /Groups GET (Section 3.4.1), Retrieve, add, 36 | POST (Section 3.3), modify Groups. 37 | PUT (Section 3.5.1), 38 | PATCH (Section 3.5.2), 39 | DELETE (Section 3.6) 40 | 41 | * @author chrisharm 42 | * 43 | */ 44 | //@formatter:on 45 | 46 | @Path("Groups") 47 | @Tag(name="SCIM") 48 | public interface GroupResource extends BaseResourceTypeResource { 49 | 50 | } 51 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/UserResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol; 21 | 22 | import io.swagger.v3.oas.annotations.tags.Tag; 23 | import jakarta.ws.rs.Path; 24 | 25 | import org.apache.directory.scim.spec.resources.ScimUser; 26 | 27 | //@formatter:off 28 | /** 29 | * From SCIM Protocol Specification, section 3, page 9 30 | * 31 | * @see Scim spec section 3.2 32 | *

33 | * Resource Endpoint Operations Description 34 | -------- ---------------- ---------------------- -------------------- 35 | User /Users GET (Section 3.4.1), Retrieve, add, 36 | POST (Section 3.3), modify Users. 37 | PUT (Section 3.5.1), 38 | PATCH (Section 3.5.2), 39 | DELETE (Section 3.6) 40 | 41 | * @author chrisharm 42 | * 43 | */ 44 | //@formatter:on 45 | 46 | @Path("Users") 47 | @Tag(name="SCIM") 48 | public interface UserResource extends BaseResourceTypeResource { 49 | } 50 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/adapter/AttributeReferenceAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol.adapter; 21 | 22 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 23 | 24 | import org.apache.directory.scim.spec.filter.attribute.AttributeReference; 25 | 26 | public class AttributeReferenceAdapter extends XmlAdapter { 27 | 28 | @Override 29 | public AttributeReference unmarshal(String string) throws Exception { 30 | if (string == null) { 31 | return null; 32 | } 33 | return new AttributeReference(string); 34 | } 35 | 36 | @Override 37 | public String marshal(AttributeReference attributeReference) throws Exception { 38 | if (attributeReference == null) { 39 | return null; 40 | } 41 | return attributeReference.getFullyQualifiedAttributeName(); 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/adapter/FilterAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol.adapter; 21 | 22 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 23 | 24 | import org.apache.directory.scim.spec.filter.Filter; 25 | 26 | public class FilterAdapter extends XmlAdapter { 27 | 28 | @Override 29 | public Filter unmarshal(String string) throws Exception { 30 | if (string == null) { 31 | return null; 32 | } 33 | return new Filter(string); 34 | } 35 | 36 | @Override 37 | public String marshal(Filter filter) throws Exception { 38 | if (filter == null) { 39 | return null; 40 | } 41 | return filter.getExpression().toFilter(); 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/main/java/org/apache/directory/scim/protocol/data/StatusAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol.data; 21 | 22 | import jakarta.ws.rs.core.Response.Status; 23 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 24 | 25 | public class StatusAdapter extends XmlAdapter { 26 | 27 | @Override 28 | public Status unmarshal(String v) throws Exception { 29 | if (v == null) { 30 | return null; 31 | } 32 | 33 | for (Status status : Status.values()) { 34 | if (status.getStatusCode() == Integer.parseInt(v)) { 35 | return status; 36 | } 37 | } 38 | throw new EnumConstantNotPresentException(Status.class, v); 39 | } 40 | 41 | @Override 42 | public String marshal(Status v) throws Exception { 43 | if (v == null) { 44 | return null; 45 | } 46 | return Integer.toString(v.getStatusCode()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-protocol/src/test/java/org/apache/directory/scim/protocol/adapter/StatusAdapterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.protocol.adapter; 21 | 22 | import jakarta.ws.rs.core.Response.Status; 23 | import org.apache.directory.scim.protocol.data.StatusAdapter; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.assertj.core.api.Assertions.assertThat; 27 | 28 | public class StatusAdapterTest { 29 | 30 | @Test 31 | public void marshal() throws Exception { 32 | String result = new StatusAdapter().marshal(Status.CONFLICT); 33 | assertThat(result).isEqualTo("409"); 34 | } 35 | 36 | @Test 37 | public void marshalNull() throws Exception { 38 | String result = new StatusAdapter().marshal(null); 39 | assertThat(result).isNull(); 40 | } 41 | 42 | @Test 43 | public void unmarshal() throws Exception { 44 | Status result = new StatusAdapter().unmarshal("400"); 45 | assertThat(result).isEqualTo(Status.BAD_REQUEST); 46 | } 47 | 48 | @Test 49 | public void unmarshalNull() throws Exception { 50 | Status result = new StatusAdapter().unmarshal(null); 51 | assertThat(result).isNull(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/antlr4/imports/Core.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grammar Core; 21 | 22 | fragment ALPHA: [a-zA-Z]; 23 | fragment ALPHA_NUM: [a-zA-Z0-9]; 24 | fragment DIGIT: [0-9]; 25 | fragment HEX_DIGIT: [A-F0-9]; -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/antlr4/imports/Json.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grammar Json; 21 | 22 | // Json Number 23 | 24 | NUMBER: (MINUS)? INT (FRAC)? (EXP)?; 25 | DEC_PT: '.'; 26 | fragment DIGIT1_9 : [1-9] ; 27 | fragment DIGIT : [0-9] ; 28 | E: 'e' | 'E'; 29 | EXP: E (MINUS | PLUS)? DIGIT+; 30 | FRAC: DEC_PT DIGIT+; 31 | INT: ZERO | DIGIT1_9 (DIGIT+)?; 32 | MINUS: '-'; 33 | PLUS: '+'; 34 | ZERO: '0'; 35 | 36 | // Json String 37 | STRING 38 | : '"' (ESC | SAFECODEPOINT)* '"'; 39 | fragment ESC 40 | : '\\' (["\\/bfnrt] | UNICODE); 41 | fragment UNICODE 42 | : 'u' HEX HEX HEX HEX; 43 | fragment HEX 44 | : [0-9a-fA-F]; 45 | fragment SAFECODEPOINT 46 | : ~ ["\\\u0000-\u001F]; 47 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/antlr4/imports/Urn.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grammar Urn; 21 | 22 | URN: 'urn:' NID ':' NSS; 23 | fragment NID: LETNUM LETNUMHYP+; // TODO limit to {1,31} 24 | fragment LETNUM: [a-zA-Z0-9]; 25 | fragment LETNUMHYP: LETNUM | '-'; 26 | fragment NSS: URNCHARS+; 27 | fragment URNCHARS: TRANS | '%' HEX HEX; 28 | fragment TRANS: LETNUM | OTHER; 29 | fragment HEX: [a-fA-F0-9]; 30 | fragment OTHER: '(' | ')' | '+' | ',' | '-' | '.' | ':' | '=' | '@' | ';' | '$' | '_' | '!' | '*' | '\''; 31 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/antlr4/org/apache/directory/scim/spec/phonenumber/PhoneNumberParser.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | parser grammar PhoneNumberParser; 21 | 22 | options {tokenVocab = PhoneNumberLexer;} 23 | 24 | phoneNumber: PrefixTel (global=globalNumber | local=localNumber) EOF; 25 | 26 | globalNumber: globalDigits=Plus GlobalNumberDigits (SEMI (PrefixExt Ext | PrefixIsub Isub))? parameter*; 27 | 28 | localNumber: localDigits=localNumberDigits (SEMI (PrefixExt Ext | PrefixIsub Isub))? (SEMI|ParamTerm) phoneContext parameter*; 29 | 30 | phoneContext: PrefixPhoneContext (dn=DomainName | (CtxPlus dig=GlobalNumberDigits)); 31 | 32 | localNumberDigits: (DIGIT | HEX_ALPHA | STAR | POUND | VisualSeparator | DOT | DASH)* (DIGIT | HEX_ALPHA | STAR | POUND) (DIGIT | HEX_ALPHA | STAR | POUND | VisualSeparator | DOT | DASH)*; 33 | 34 | parameter: (SEMI|ParamTerm) (ParamName (ParamWithValue ParamValue)? ); 35 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/adapter/Iso8601DateTimeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.adapter; 21 | 22 | import java.text.SimpleDateFormat; 23 | import java.util.Date; 24 | 25 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 26 | 27 | public class Iso8601DateTimeAdapter extends XmlAdapter { 28 | 29 | private static final String ISO_8601_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SS"; 30 | private SimpleDateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_TIME_FORMAT); 31 | 32 | @Override 33 | public String marshal(Date date) 34 | { 35 | if (date == null) 36 | { 37 | return null; 38 | } 39 | 40 | return dateFormat.format(date); 41 | } 42 | 43 | @Override 44 | public Date unmarshal(String date) throws Exception 45 | { 46 | if (date == null || date.isEmpty()) 47 | { 48 | return null; 49 | } 50 | 51 | return dateFormat.parse(date); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/adapter/LocalDateTimeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.adapter; 21 | 22 | import java.time.LocalDateTime; 23 | import java.time.format.DateTimeFormatter; 24 | 25 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 26 | 27 | public class LocalDateTimeAdapter extends XmlAdapter { 28 | 29 | private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ISO_DATE_TIME; 30 | 31 | @Override 32 | public LocalDateTime unmarshal(String v) throws Exception { 33 | if (v == null) { 34 | return null; 35 | } 36 | return LocalDateTime.parse(v, FORMATTER); 37 | } 38 | 39 | @Override 40 | public String marshal(LocalDateTime v) throws Exception { 41 | if (v == null) { 42 | return null; 43 | } 44 | return FORMATTER.format(v); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/adapter/PatchOperationPathAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.adapter; 21 | 22 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 23 | import org.apache.directory.scim.spec.patch.PatchOperationPath; 24 | 25 | public class PatchOperationPathAdapter extends XmlAdapter{ 26 | 27 | @Override 28 | public PatchOperationPath unmarshal(String v) throws Exception { 29 | if (v == null) { 30 | return null; 31 | } 32 | return PatchOperationPath.fromString(v); 33 | } 34 | 35 | @Override 36 | public String marshal(PatchOperationPath v) throws Exception { 37 | if (v == null) { 38 | return null; 39 | } 40 | return v.toString(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/annotation/ScimExtensionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target({ElementType.TYPE}) 29 | public @interface ScimExtensionType { 30 | 31 | String id(); 32 | String name() default ""; 33 | boolean required() default false; 34 | String description() default ""; 35 | } -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/annotation/ScimResourceIdReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.FIELD) 29 | public @interface ScimResourceIdReference { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/annotation/ScimResourceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target({ElementType.TYPE}) 30 | public @interface ScimResourceType { 31 | 32 | String id(); 33 | String name() default ""; 34 | String description() default ""; 35 | String endpoint(); 36 | String schema(); 37 | } -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/annotation/ScimType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target({ElementType.TYPE}) 30 | public @interface ScimType { 31 | } -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/ConflictResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class ConflictResourceException extends ResourceException { 23 | 24 | public ConflictResourceException(String message) { 25 | super(409, message); 26 | } 27 | 28 | public ConflictResourceException(String message, Throwable cause) { 29 | super(409, message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/InvalidExtensionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class InvalidExtensionException extends RuntimeException { 23 | 24 | private static final long serialVersionUID = -4113730866775103565L; 25 | 26 | public InvalidExtensionException(String what) { 27 | super(what); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/MutabilityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | /** 23 | * Thrown when a client attempts to update a ScimResource's attribute/sub-attribute that does not support being updated. 24 | * e.g. The attribute is read-only, or is immutable but already has a value. 25 | */ 26 | public class MutabilityException extends RuntimeException { 27 | 28 | public MutabilityException(String message) { 29 | super(message); 30 | } 31 | 32 | public MutabilityException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/ResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class ResourceException extends Exception { 23 | 24 | private final int status; 25 | 26 | public ResourceException(int statusCode, String message) { 27 | super(message); 28 | this.status = statusCode; 29 | } 30 | 31 | public ResourceException(int statusCode, String message, Throwable cause) { 32 | super(message, cause); 33 | this.status = statusCode; 34 | } 35 | 36 | public int getStatus() { 37 | return this.status; 38 | } 39 | 40 | public String toString() { 41 | return "ResourceException(status=" + this.getStatus() + ", message=" + this.getMessage() + ")"; 42 | } 43 | 44 | public boolean equals(final Object o) { 45 | if (o == this) return true; 46 | if (!(o instanceof ResourceException)) return false; 47 | final ResourceException other = (ResourceException) o; 48 | if (!other.canEqual((Object) this)) return false; 49 | if (!super.equals(o)) return false; 50 | if (this.getStatus() != other.getStatus()) return false; 51 | return true; 52 | } 53 | 54 | protected boolean canEqual(final Object other) { 55 | return other instanceof ResourceException; 56 | } 57 | 58 | public int hashCode() { 59 | final int PRIME = 59; 60 | int result = super.hashCode(); 61 | result = result * PRIME + this.getStatus(); 62 | return result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class ResourceNotFoundException extends ResourceException { 23 | 24 | public ResourceNotFoundException(String resourceId) { 25 | super(404, message(resourceId)); 26 | } 27 | 28 | public ResourceNotFoundException(String resourceId, Throwable cause) { 29 | super(404, message(resourceId), cause); 30 | } 31 | 32 | private static String message(String resourceId) { 33 | return "Resource " +resourceId + " not found."; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/ScimResourceInvalidException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class ScimResourceInvalidException extends RuntimeException { 23 | 24 | private static final long serialVersionUID = -3378968149599082798L; 25 | 26 | public ScimResourceInvalidException(String message) { 27 | super(message); 28 | } 29 | public ScimResourceInvalidException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/exception/UnsupportedFilterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.exception; 21 | 22 | public class UnsupportedFilterException extends RuntimeException { 23 | 24 | public UnsupportedFilterException(String message) { 25 | super(message); 26 | } 27 | 28 | public UnsupportedFilterException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/CompareOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | public enum CompareOperator { 23 | 24 | EQ, // equal 25 | NE, // not equal 26 | CO, // contains 27 | SW, // starts with 28 | EW, // ends with 29 | PR, // present (has value) 30 | GT, // greater than 31 | GE, // greater than or equal 32 | LT, // greater than 33 | LE; // greater than or equal 34 | } 35 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/FilterExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | import java.io.Serializable; 23 | import java.util.function.Function; 24 | 25 | public interface FilterExpression extends Serializable { 26 | 27 | String toFilter(); 28 | 29 | void setAttributePath(String urn, String parentAttributeName); 30 | 31 | String toUnqualifiedFilter(); 32 | 33 | default U map(Function mapper) { 34 | return mapper.apply(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/FilterParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | /** 23 | * @author stevemoyer 24 | * 25 | */ 26 | public class FilterParseException extends Exception { 27 | 28 | /** 29 | * 30 | */ 31 | private static final long serialVersionUID = 1L; 32 | 33 | /** 34 | * 35 | */ 36 | public FilterParseException() { 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public FilterParseException(String message) { 43 | super(message); 44 | } 45 | 46 | /** 47 | * @param cause 48 | */ 49 | public FilterParseException(Throwable cause) { 50 | super(cause); 51 | } 52 | 53 | /** 54 | * @param message 55 | * @param cause 56 | */ 57 | public FilterParseException(String message, Throwable cause) { 58 | super(message, cause); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/LogicalOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | public enum LogicalOperator { 23 | 24 | AND, 25 | OR; 26 | } 27 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/SortOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | import jakarta.xml.bind.annotation.XmlEnumValue; 23 | 24 | import java.util.Arrays; 25 | 26 | public enum SortOrder { 27 | @XmlEnumValue("ascending") 28 | ASCENDING("ascending"), 29 | @XmlEnumValue("descending") 30 | DESCENDING("descending"); 31 | 32 | private final String value; 33 | 34 | SortOrder(String value) { 35 | this.value = value; 36 | } 37 | 38 | public static SortOrder fromString(String value) { 39 | return Arrays.stream(values()) 40 | .filter(order -> order.value.equals(value)) 41 | .findFirst() 42 | .orElseThrow(() -> new IllegalArgumentException("Argument is not a valid SortOrder: " + value)); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/filter/ValueFilterExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | public interface ValueFilterExpression { 23 | 24 | String toFilter(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/phonenumber/PhoneNumberParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.phonenumber; 21 | 22 | /** 23 | * @author heidielliott 24 | * 25 | */ 26 | public class PhoneNumberParseException extends Exception { 27 | 28 | /** 29 | * 30 | */ 31 | private static final long serialVersionUID = 1L; 32 | 33 | /** 34 | * 35 | */ 36 | public PhoneNumberParseException() { 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public PhoneNumberParseException(String message) { 43 | super(message); 44 | } 45 | 46 | /** 47 | * @param cause 48 | */ 49 | public PhoneNumberParseException(Throwable cause) { 50 | super(cause); 51 | } 52 | 53 | /** 54 | * @param message 55 | * @param cause 56 | */ 57 | public PhoneNumberParseException(String message, Throwable cause) { 58 | super(message, cause); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/resources/ScimExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.resources; 21 | 22 | import java.io.Serializable; 23 | 24 | import jakarta.xml.bind.annotation.XmlRootElement; 25 | 26 | 27 | @XmlRootElement(name = "ScimExtension") 28 | public interface ScimExtension extends Serializable { 29 | 30 | String getUrn(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/resources/TypedAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.resources; 21 | 22 | @FunctionalInterface 23 | public interface TypedAttribute { 24 | 25 | String getType(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/schema/AttributeContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.schema; 21 | 22 | import java.io.Serializable; 23 | import java.util.Set; 24 | 25 | import org.apache.directory.scim.spec.schema.Schema.Attribute; 26 | 27 | public interface AttributeContainer extends Serializable { 28 | 29 | String getUrn(); 30 | 31 | Set getAttributes(); 32 | 33 | Attribute getAttribute(String attributeName); 34 | } 35 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/schema/ScimSpecSchema.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.schema; 21 | 22 | import java.util.Set; 23 | 24 | @Deprecated 25 | /** 26 | * @deprecated will be removed in the near future, use {@link org.apache.directory.scim.core.schema.SchemaRegistry SchemaRegistry} instead. 27 | */ 28 | public class ScimSpecSchema { 29 | 30 | final static Set schemaNames = Set.of( 31 | "urn:ietf:params:scim:schemas:core:2.0:Group", 32 | "urn:ietf:params:scim:schemas:core:2.0:ResourceType", 33 | "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig", 34 | "urn:ietf:params:scim:schemas:core:2.0:User", 35 | "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" 36 | ); 37 | 38 | public static Set getSchemaNames() { 39 | return schemaNames; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/schema/ScimType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.schema; 21 | 22 | public interface ScimType { 23 | 24 | /** 25 | * ScimTypes are generally implemented as Java enums but when we're generating 26 | * hashcodes, we need access to the name of the enum element rather than the 27 | * ordinal. 28 | * 29 | * @return a String containing the enum value's name 30 | */ 31 | String name(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/validator/Urn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.validator; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | import static java.lang.annotation.ElementType.FIELD; 27 | import static java.lang.annotation.ElementType.METHOD; 28 | import static java.lang.annotation.ElementType.PARAMETER; 29 | import static java.lang.annotation.ElementType.TYPE_USE; 30 | 31 | import jakarta.validation.Constraint; 32 | import jakarta.validation.Payload; 33 | 34 | @Constraint(validatedBy = UrnValidator.class) 35 | @Target( { TYPE_USE, METHOD, FIELD, PARAMETER }) 36 | @Retention(RetentionPolicy.RUNTIME) 37 | public @interface Urn 38 | { 39 | String message() default "The urn is malformed"; 40 | 41 | Class[] groups() default {}; 42 | 43 | Class[] payload() default {}; 44 | } 45 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/main/java/org/apache/directory/scim/spec/validator/UrnValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.validator; 21 | 22 | import jakarta.validation.ConstraintValidator; 23 | import jakarta.validation.ConstraintValidatorContext; 24 | 25 | public class UrnValidator implements ConstraintValidator { 26 | 27 | private static final String URN_RFC2141_REGEX = "^urn:[a-zA-Z0-9][a-zA-Z0-9-]{0,31}:(?:[a-zA-Z0-9()+,\\-.:=@;$_!*']|%[0-9a-fA-F]{2})+$"; 28 | 29 | @Override 30 | public void initialize(Urn validator) { 31 | } 32 | 33 | @Override 34 | public boolean isValid(String urn, ConstraintValidatorContext context) { 35 | if (urn == null || urn.isEmpty()) { 36 | return true; 37 | } 38 | 39 | return urn.matches(URN_RFC2141_REGEX); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/ObjectMapperFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec; 21 | 22 | import com.fasterxml.jackson.annotation.JsonInclude; 23 | import com.fasterxml.jackson.databind.AnnotationIntrospector; 24 | import com.fasterxml.jackson.databind.ObjectMapper; 25 | import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; 26 | import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; 27 | import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector; 28 | import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; 29 | 30 | public class ObjectMapperFactory { 31 | 32 | private final static ObjectMapper objectMapper = createObjectMapper(); 33 | 34 | public static ObjectMapper getObjectMapper() { 35 | return objectMapper; 36 | } 37 | 38 | private static ObjectMapper createObjectMapper() { 39 | ObjectMapper objectMapper = new ObjectMapper(); 40 | 41 | objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); 42 | 43 | objectMapper.registerModule(new JakartaXmlBindAnnotationModule()); 44 | 45 | AnnotationIntrospector pair = new AnnotationIntrospectorPair( 46 | new JakartaXmlBindAnnotationIntrospector(objectMapper.getTypeFactory()), 47 | new JacksonAnnotationIntrospector()); 48 | objectMapper.setAnnotationIntrospector(pair); 49 | 50 | return objectMapper; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/filter/FilterBuilderPresentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class FilterBuilderPresentTest { 27 | 28 | @Test 29 | public void testAttributePresent() throws FilterParseException { 30 | Filter filter = FilterBuilder.create().present("address.streetAddress").build(); 31 | Filter expected = new Filter("address.streetAddress PR"); 32 | assertThat(filter).isEqualTo(expected); 33 | } 34 | 35 | @Test 36 | public void testStartsWith() throws FilterParseException { 37 | Filter filter = FilterBuilder.create() 38 | .present("address.streetAddress") 39 | .and(f -> f.equalTo("address.region", "CA")) 40 | .build(); 41 | Filter expected = new Filter("address.streetAddress PR AND address.region EQ \"CA\""); 42 | assertThat(filter).isEqualTo(expected); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/filter/FilterBuilderStringTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class FilterBuilderStringTest { 27 | 28 | @Test 29 | public void testEndsWith() throws FilterParseException { 30 | Filter filter = FilterBuilder.create().endsWith("address.streetAddress", "Way").build(); 31 | Filter expected = new Filter("address.streetAddress EW \"Way\""); 32 | assertThat(filter).isEqualTo(expected); 33 | } 34 | 35 | @Test 36 | public void testStartsWith() throws FilterParseException { 37 | Filter filter = FilterBuilder.create().startsWith("address.streetAddress", "133").build(); 38 | Filter expected = new Filter("address.streetAddress SW \"133\""); 39 | assertThat(filter).isEqualTo(expected); 40 | } 41 | 42 | @Test 43 | public void testContains() throws FilterParseException { 44 | Filter filter = FilterBuilder.create().contains("address.streetAddress", "MacDuff").build(); 45 | Filter expected = new Filter("address.streetAddress CO \"MacDuff\""); 46 | assertThat(filter).isEqualTo(expected); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/filter/FilterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.filter; 21 | 22 | import org.junit.jupiter.api.Assertions; 23 | import org.junit.jupiter.params.ParameterizedTest; 24 | import org.junit.jupiter.params.provider.MethodSource; 25 | import org.slf4j.Logger; 26 | import org.slf4j.LoggerFactory; 27 | 28 | public class FilterTest extends AbstractLexerParserTest { 29 | 30 | private static final Logger LOG = LoggerFactory.getLogger(FilterTest.class); 31 | 32 | @SuppressWarnings("unused") 33 | private static String[] getAllFilters() { 34 | return ALL; 35 | } 36 | 37 | @ParameterizedTest 38 | @MethodSource("getAllFilters") 39 | public void test(String filterText) throws Exception { 40 | LOG.debug("Running Filter Parser test on input: {}", filterText); 41 | Filter filter = new Filter(filterText); 42 | FilterExpression expression = filter.getExpression(); 43 | LOG.debug("Parsed String: {}", expression.toFilter()); 44 | Assertions.assertNotNull(expression); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/patch/PatchOperationPathTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.patch; 21 | 22 | import org.junit.jupiter.api.Assertions; 23 | import org.junit.jupiter.params.ParameterizedTest; 24 | import org.junit.jupiter.params.provider.MethodSource; 25 | import org.slf4j.Logger; 26 | import org.slf4j.LoggerFactory; 27 | 28 | public class PatchOperationPathTest { 29 | /** A logger for this class */ 30 | private static final Logger log = LoggerFactory.getLogger(PatchOperationPathTest.class); 31 | 32 | public static String[] pathValues() { 33 | return new String[] { "members", 34 | "name.familyName", 35 | "addresses[type eq \"work\"]", 36 | "members[value eq \"2819c223-7f76-453a-919d-413861904646\"]", 37 | "members[value eq \"2819c223-7f76-453a-919d-413861904646\"].displayName" }; 38 | } 39 | 40 | @ParameterizedTest 41 | @MethodSource("pathValues") 42 | public void testPathParsing(String value) throws Exception { 43 | PatchOperationPath path = PatchOperationPath.fromString(value); 44 | log.debug("ValuePathExpression: {}", path.getValuePathExpression()); 45 | 46 | String result = path.toString(); 47 | log.debug(result); 48 | Assertions.assertNotNull(path.getValuePathExpression()); 49 | Assertions.assertEquals(value.toLowerCase(), result.toLowerCase()); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/schema/MapperTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spec.schema; 21 | 22 | import org.junit.jupiter.params.ParameterizedTest; 23 | import org.junit.jupiter.params.provider.MethodSource; 24 | 25 | import java.text.ParseException; 26 | import java.time.Instant; 27 | import java.util.*; 28 | 29 | import static org.junit.jupiter.api.Assertions.assertEquals; 30 | 31 | 32 | public class MapperTest { 33 | 34 | static final String[] ISO_DATETIME_EXAMPLES = { 35 | "2015-04-26T01:37:17+00:00", 36 | "2015-04-26T01:37:17Z" 37 | }; 38 | 39 | static String[] getIsoDateTimeExamples() { 40 | return ISO_DATETIME_EXAMPLES; 41 | } 42 | 43 | @ParameterizedTest 44 | @MethodSource("getIsoDateTimeExamples") 45 | public void testConvertDateTimeFromString(String isoDateTime) throws ParseException { 46 | Mapper mapper = new Mapper(); 47 | Instant instant = mapper.convertDateTime(isoDateTime); 48 | TimeZone timeZone = new SimpleTimeZone(0, "GMT"); 49 | GregorianCalendar calendar = new GregorianCalendar(timeZone); 50 | calendar.setTime(Date.from(instant)); 51 | assertEquals(2015, calendar.get(Calendar.YEAR)); 52 | assertEquals(3, calendar.get(Calendar.MONTH)); 53 | assertEquals(26, calendar.get(Calendar.DATE)); 54 | assertEquals(1, calendar.get(Calendar.HOUR_OF_DAY)); 55 | assertEquals(37, calendar.get(Calendar.MINUTE)); 56 | assertEquals(17, calendar.get(Calendar.SECOND)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /scim-spec/scim-spec-schema/src/test/resources/schemas/Group.json: -------------------------------------------------------------------------------- 1 | { 2 | "id":"urn:ietf:params:scim:schemas:core:2.0:Group", 3 | "name":"Group", 4 | "description":"Group", 5 | "attributes":[ 6 | { 7 | "name":"displayName", 8 | "type":"string", 9 | "multiValued":false, 10 | "description":"Human readable name for the Group. REQUIRED.", 11 | "required":false, 12 | "caseExact":false, 13 | "mutability":"readWrite", 14 | "returned":"default", 15 | "uniqueness":"none" 16 | }, 17 | { 18 | "name":"members", 19 | "type":"complex", 20 | "multiValued":true, 21 | "description":"A list of members of the Group.", 22 | "required":false, 23 | "subAttributes":[ 24 | { 25 | "name":"value", 26 | "type":"string", 27 | "multiValued":false, 28 | "description":"Identifier of the member of this Group.", 29 | "required":false, 30 | "caseExact":false, 31 | "mutability":"immutable", 32 | "returned":"default", 33 | "uniqueness":"none" 34 | }, 35 | { 36 | "name":"$ref", 37 | "type":"reference", 38 | "referenceTypes":[ 39 | "User", 40 | "Group" 41 | ], 42 | "multiValued":false, 43 | "description":"The URI of the corresponding to the member resource of this Group.", 44 | "required":false, 45 | "caseExact":false, 46 | "mutability":"immutable", 47 | "returned":"default", 48 | "uniqueness":"none" 49 | }, 50 | { 51 | "name":"type", 52 | "type":"string", 53 | "multiValued":false, 54 | "description":"A label indicating the type of resource; e.g., 'User' or 'Group'.", 55 | "required":false, 56 | "caseExact":false, 57 | "canonicalValues":[ 58 | "User", 59 | "Group" 60 | ], 61 | "mutability":"immutable", 62 | "returned":"default", 63 | "uniqueness":"none" 64 | } 65 | ], 66 | "mutability":"readWrite", 67 | "returned":"default" 68 | } 69 | ], 70 | "meta":{ 71 | "resourceType":"Schema", 72 | "location":"/v2/Schemas/urn:ietf:params:scim:schemas:core:2.0:Group" 73 | } 74 | } -------------------------------------------------------------------------------- /scim-test/pom.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.apache.directory.scimple 23 | scimple 24 | 1.0.0-SNAPSHOT 25 | 26 | 27 | scim-test 28 | SCIMple - Test 29 | 30 | 31 | org.apache.directory.scim.test 32 | 33 | 34 | 35 | 36 | org.apache.directory.scimple 37 | scim-spec-schema 38 | 39 | 40 | 44 | 45 | org.junit.jupiter 46 | junit-jupiter 47 | provided 48 | 49 | 50 | org.assertj 51 | assertj-core 52 | compile 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /scim-test/src/main/java/org/apache/directory/scim/test/assertj/ScimGroupAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.test.assertj; 21 | 22 | import org.apache.directory.scim.spec.resources.GroupMembership; 23 | import org.apache.directory.scim.spec.resources.ScimGroup; 24 | import org.assertj.core.api.AbstractAssert; 25 | 26 | import static org.assertj.core.api.Assertions.assertThat; 27 | 28 | public class ScimGroupAssert extends AbstractAssert { 29 | 30 | protected ScimGroupAssert(ScimGroup scimGroup) { 31 | super(scimGroup, ScimGroupAssert.class); 32 | } 33 | 34 | public ScimGroupAssert membersHasSize(int expected) { 35 | isNotNull(); 36 | assertMembersNotNull(); 37 | assertThat(actual.getMembers()).hasSize(expected); 38 | return this; 39 | } 40 | 41 | public ScimGroupAssert containsMembers(GroupMembership... expected) { 42 | isNotNull(); 43 | assertMembersNotNull(); 44 | assertThat(actual.getMembers()).contains(expected); 45 | return this; 46 | } 47 | 48 | @SafeVarargs 49 | public final ScimGroupAssert containsOnlyMembers(GroupMembership... groupMemberships) { 50 | isNotNull(); 51 | assertThat(actual.getMembers()) 52 | .as("ScimGroup.members") 53 | .containsOnly(groupMemberships); 54 | return this; 55 | } 56 | 57 | private void assertMembersNotNull() { 58 | assertThat(actual.getMembers()).isNotNull(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /scim-test/src/main/java/org/apache/directory/scim/test/assertj/ScimpleAssertions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.test.assertj; 21 | 22 | import org.apache.directory.scim.spec.patch.PatchOperation; 23 | import org.apache.directory.scim.spec.resources.ScimGroup; 24 | import org.assertj.core.api.Condition; 25 | 26 | public final class ScimpleAssertions { 27 | 28 | public static IterablePatchOperationAssert scimAssertThat(Iterable actual) { 29 | return new IterablePatchOperationAssert(actual); 30 | } 31 | 32 | public static PatchOperationAssert scimAssertThat(PatchOperation actual) { 33 | return new PatchOperationAssert(actual); 34 | } 35 | 36 | public static ScimGroupAssert scimAssertThat(ScimGroup actual) { 37 | return new ScimGroupAssert(actual); 38 | } 39 | 40 | public static Condition patchOpMatching(PatchOperation.Type type, String path) { 41 | return patchOpMatching(type, path, null); 42 | } 43 | 44 | public static Condition patchOpMatching(PatchOperation.Type type, String path, Object value) { 45 | return new PatchOperationAssert.PatchOperationCondition(type, path, value); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /scim-test/src/main/java/org/apache/directory/scim/test/stub/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.test.stub; 21 | 22 | public enum Order { 23 | 24 | FIRST("first"), 25 | SECOND("second"), 26 | THIRD("third"), 27 | FOURTH("fourth"); 28 | 29 | Order(String value) { 30 | this.value = value; 31 | } 32 | 33 | private final String value; 34 | 35 | public String getValue() { 36 | return value; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return value; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /scim-tools/src/main/java/org/apache/directory/scim/tools/lint/LintException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.tools.lint; 21 | 22 | public class LintException extends Exception { 23 | 24 | public LintException(String message) { 25 | super(message); 26 | } 27 | 28 | public LintException(String message, Throwable cause) { 29 | super(message, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scim-tools/src/test/resources/examples/group-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas":[ 3 | "urn:ietf:params:scim:schemas:core:2.0:Group" 4 | ], 5 | "id":"e9e30dba-f08f-4109-8486-d5c6a331660a", 6 | "displayName":"Tour Guides", 7 | "members":[ 8 | { 9 | "value":"2819c223-7f76-453a-919d-413861904646", 10 | "$ref":"https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646", 11 | "display":"Babs Jensen" 12 | }, 13 | { 14 | "value":"902c246b-6245-4190-8e05-00816be7344a", 15 | "$ref":"https://example.com/v2/Users/902c246b-6245-4190-8e05-00816be7344a", 16 | "display":"Mandy Pepperidge" 17 | } 18 | ], 19 | "meta":{ 20 | "resourceType":"Group", 21 | "created":"2010-01-23T04:56:22Z", 22 | "lastModified":"2011-05-13T04:42:34Z", 23 | "version":"W\/\"3694e05e9dff592\"", 24 | "location":"https://example.com/v2/Groups/e9e30dba-f08f-4109-8486-d5c6a331660a" 25 | } 26 | } -------------------------------------------------------------------------------- /scim-tools/src/test/resources/examples/minimal-user-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas":[ 3 | "urn:ietf:params:scim:schemas:core:2.0:User" 4 | ], 5 | "id":"2819c223-7f76-453a-919d-413861904646", 6 | "userName":"bjensen@example.com", 7 | "meta":{ 8 | "resourceType":"User", 9 | "created":"2010-01-23T04:56:22Z", 10 | "lastModified":"2011-05-13T04:42:34Z", 11 | "version":"W\/\"3694e05e9dff590\"", 12 | "location":"https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646" 13 | } 14 | } -------------------------------------------------------------------------------- /scim-tools/src/test/resources/examples/resource-type-group-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas":[ 3 | "urn:ietf:params:scim:schemas:core:2.0:ResourceType" 4 | ], 5 | "id":"Group", 6 | "name":"Group", 7 | "endpoint":"/Groups", 8 | "description":"Group", 9 | "schema":"urn:ietf:params:scim:schemas:core:2.0:Group", 10 | "meta":{ 11 | "location":"https://example.com/v2/ResourceTypes/Group", 12 | "resourceType":"ResourceType" 13 | } 14 | } -------------------------------------------------------------------------------- /scim-tools/src/test/resources/examples/resource-type-user-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas":[ 3 | "urn:ietf:params:scim:schemas:core:2.0:ResourceType" 4 | ], 5 | "id":"User", 6 | "name":"User", 7 | "endpoint":"/Users", 8 | "description":"User Account", 9 | "schema":"urn:ietf:params:scim:schemas:core:2.0:User", 10 | "schemaExtensions":[ 11 | { 12 | "schema":"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", 13 | "required":true 14 | } 15 | ], 16 | "meta":{ 17 | "location":"https://example.com/v2/ResourceTypes/User", 18 | "resourceType":"ResourceType" 19 | } 20 | } -------------------------------------------------------------------------------- /src/ci-templates/release-failure-summary.md: -------------------------------------------------------------------------------- 1 | Release of tag `${gitRef}` with POM version `${project.version}` failed ❌ 2 | 3 | You may need to clean up the following: 4 | - The [Nexus staging repository](https://repository.apache.org/#stagingRepositories) (empty if Maven build failed): ${nexusStagingUrl} 5 | - The staged Source bundle: ${svnDistUrl} 6 | 7 | To re-run the release, you will need to delete the tag and re-push it. 8 | -------------------------------------------------------------------------------- /src/ci-templates/release-success-summary.md: -------------------------------------------------------------------------------- 1 | The release of tag `${gitRef}` with POM version `${project.version}` has been staged ✅ 2 | 3 | The next step is to check if the release is reproducible by running a Maven build locally 4 | using against the source dist zip and the tag. 5 | 6 | For the source bundle you can run a command similar to: 7 | 8 | ```bash 9 | # create a tmp dir 10 | cd $(mktemp -d) 11 | 12 | # Download the source bundle: 13 | curl -s "${nexusStagingUrl}/org/apache/directory/scimple/scimple/${project.version}/scimple-${project.version}-source-release.zip" -O 14 | 15 | # extract the source zip 16 | unzip scimple-${project.version}-source-release.zip 17 | cd scimple-${project.version} 18 | 19 | # rebuild the source bundle and verify 20 | ./mvnw clean verify artifact:compare \ 21 | -Papache-release \ 22 | --threads=1 \ 23 | -Dgpg.skip \ 24 | -Dreference.repo=${nexusStagingUrl} 25 | ``` 26 | 27 | From your SCIMple git repository build the `${gitRef}` tag run: 28 | ```bash 29 | # If you haven't cloned the repo, run: 30 | # git clone ${project.scm.url}.git 31 | # cd directory-scimple 32 | 33 | # checkout the tag 34 | git checkout ${gitRef} 35 | 36 | # rebuild the source bundle and verify 37 | ./mvnw clean verify artifact:compare \ 38 | -Papache-release \ 39 | --threads=1 \ 40 | -Dgpg.skip \ 41 | -Dreference.repo=${nexusStagingUrl} 42 | ``` 43 | 44 | If that was successful, start the vote email thread, suggested email template: 45 | 46 | ```txt 47 | Subject: [VOTE] Release Apache Directory ${project.name} ${project.version} 48 | 49 | This is a call to vote in favor of releasing Apache Directory ${project.name} version ${project.version}. 50 | 51 | We solved # issues: 52 | (see below for suggestion) 53 | 54 | Maven Staging Repository: 55 | ${nexusStagingUrl} 56 | 57 | Dist Staging Url: 58 | ${svnDistUrl} 59 | 60 | Guide to testing staged releases: 61 | https://maven.apache.org/guides/development/guide-testing-releases.html 62 | 63 | Vote open for 72 hours. 64 | 65 | [ ] +1 66 | [ ] +0 67 | [ ] -1 (please include reasoning) 68 | ``` 69 | -------------------------------------------------------------------------------- /src/ci-templates/snapshot-success-summary.md: -------------------------------------------------------------------------------- 1 | The SNAPSHOT build from `${gitRef}` with POM version [`${project.version}`](https://repository.apache.org/#nexus-search;gav~org.apache.directory.scimple~~${project.version}~~) has been deployed ✅ 2 | 3 | Changes in this build since the last release: 4 | -------------------------------------------------------------------------------- /src/scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Sets release version, creates tag, and pushes tag to 'origin' 23 | # ---------------------------------------------------------------------------- 24 | script_name=$0 25 | function usage { 26 | echo "usage: ${script_name} [release-version]" 27 | echo " Sets release version, creates tag, and pushes tag to 'origin'" 28 | exit 1 29 | } 30 | 31 | if [ "$#" -ne 1 ]; then 32 | usage 33 | fi 34 | 35 | version="${1}" 36 | tag="v${version}" 37 | echo "Updating version to: ${version}" 38 | ./mvnw versions:set -DnewVersion=${version} -N 39 | 40 | git commit -am "[release] Setting version to ${version}" 41 | 42 | echo "Creating the tag: ${tag}" 43 | git tag --sign ${tag} -m "[release] ${version}" 44 | git push origin ${tag} 45 | -------------------------------------------------------------------------------- /support/spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.spring.ScimpleSpringConfiguration 20 | -------------------------------------------------------------------------------- /support/spring-boot/src/test/java/org/apache/directory/scim/spring/it/app/ScimpleSpringApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spring.it.app; 21 | 22 | import org.apache.directory.scim.server.configuration.ServerConfiguration; 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | import org.springframework.context.annotation.Bean; 26 | 27 | import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.httpBasic; 28 | 29 | @SpringBootApplication 30 | public class ScimpleSpringApp { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(ScimpleSpringApp.class, args); 34 | } 35 | 36 | @Bean 37 | ServerConfiguration serverConfiguration() { 38 | return new ServerConfiguration() 39 | .addAuthenticationSchema(httpBasic()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /support/spring-boot/src/test/java/org/apache/directory/scim/spring/it/app/SpringScimServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.directory.scim.spring.it.app; 21 | 22 | import org.apache.directory.scim.compliance.junit.EmbeddedServerExtension; 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.context.ConfigurableApplicationContext; 25 | 26 | import java.net.URI; 27 | 28 | public class SpringScimServer implements EmbeddedServerExtension.ScimTestServer { 29 | 30 | private ConfigurableApplicationContext context; 31 | 32 | @Override 33 | public URI start(int port) { 34 | context = SpringApplication.run(ScimpleSpringApp.class, 35 | "--server.servlet.context-path=/v2", 36 | "--server.port=" + port 37 | ); 38 | return URI.create("http://localhost:" + port + "/v2"); 39 | } 40 | 41 | @Override 42 | public void shutdown() { 43 | context.stop(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /support/spring-boot/src/test/resources/META-INF/services/org.apache.directory.scim.compliance.junit.EmbeddedServerExtension$ScimTestServer: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | org.apache.directory.scim.spring.it.app.SpringScimServer 20 | --------------------------------------------------------------------------------