> 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 super FilterExpression, U> 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 extends Payload>[] 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 |
--------------------------------------------------------------------------------