Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
<version.slf4j>2.0.16</version.slf4j>
<version.antlr4>4.13.2</version.antlr4>
<version.resteasy>7.0.1.Final</version.resteasy>
<version.spring-boot>3.5.7</version.spring-boot>

<!-- build against Spring Boot 3.x, test against 3 and 4 (until 3 is end of life) -->
<version.spring-boot3>3.5.8</version.spring-boot3>
<version.spring-boot4>4.0.0</version.spring-boot4>
<!-- default surefire/failsafe arg lines to empty-->
<jacoco.argline />
<jacoco.it.argline />
Expand All @@ -68,6 +69,7 @@
<module>scim-server-examples/scim-server-jersey</module>
<module>scim-server-examples/scim-server-quarkus</module>
<module>scim-server-examples/scim-server-spring-boot</module>
<module>scim-server-examples/scim-server-spring-boot-4</module>
<module>support/spring-boot</module>
<module>scim-tools</module>
<module>scim-compliance-tests</module>
Expand Down Expand Up @@ -728,11 +730,6 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.14</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${version.spring-boot}</version>
</plugin>
<plugin>
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions scim-server-examples/scim-server-spring-boot-4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Apache Directory SCIMple In Memory Example
==========================================

This example project demo's how to:

* Add a custom SCIM Extension
* Manage Users and Groups (in memory)

Use this as a starter point on how to integrate Apache Directory SCIMple into your own project.

Run: `mvn spring-boot:run` and then access one of the endpoints:

```bash
# httpie
http :8080/v2/Users

# curl
curl localhost:8080/v2/Users
```
88 changes: 88 additions & 0 deletions scim-server-examples/scim-server-spring-boot-4/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!-- Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.directory.scimple</groupId>
<artifactId>scimple</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

<artifactId>scim-server-spring-boot4</artifactId>
<name>SCIMple - Server - Examples - Spring Boot 4</name>

<properties>
<module.name>org.apache.directory.scim.example.springboot4</module.name>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${version.spring-boot4}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.directory.scimple</groupId>
<artifactId>scim-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.directory.scimple</groupId>
<artifactId>scim-server</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${version.spring-boot4}</version>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.directory.scim.example.spring;

import org.apache.directory.scim.server.configuration.ServerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import static org.apache.directory.scim.spec.schema.ServiceProviderConfiguration.AuthenticationSchema.httpBasic;

@SpringBootApplication
public class ScimpleSpringBootApplication {

public static void main(String[] args) {
SpringApplication.run(ScimpleSpringBootApplication.class, args);
}

@Bean
ServerConfiguration serverConfiguration() {
// Set any unique configuration bits
return new ServerConfiguration()
.setId("scimple-spring-boot-example")
.setDocumentationUri("https://github.com/apache/directory-scimple")

// set the auth scheme
.addAuthenticationSchema(httpBasic());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.directory.scim.example.spring.extensions;

import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.apache.directory.scim.spec.annotation.ScimAttribute;
import org.apache.directory.scim.spec.annotation.ScimExtensionType;
import org.apache.directory.scim.spec.resources.ScimExtension;
import org.apache.directory.scim.spec.schema.Schema;

/**
* Allows a User's lucky number to be passed as part of the User's entry via
* the SCIM protocol.
*
* @author Chris Harm &lt;crh5255@psu.edu&gt;
*/
@XmlRootElement( name = "LuckyNumberExtension", namespace = "http://www.psu.edu/schemas/psu-scim" )
@XmlAccessorType(XmlAccessType.NONE)
@ScimExtensionType(id = LuckyNumberExtension.SCHEMA_URN, description="Lucky Numbers", name="LuckyNumbers", required=true)
public class LuckyNumberExtension implements ScimExtension {

public static final String SCHEMA_URN = "urn:mem:params:scim:schemas:extension:LuckyNumberExtension";

@ScimAttribute(returned=Schema.Attribute.Returned.DEFAULT, required=true)
@XmlElement
private long luckyNumber;

/**
* Provides the URN associated with this extension which, as defined by the
* SCIM specification is the extension's unique identifier.
*
* @return The extension's URN.
*/
@Override
public String getUrn() {
return SCHEMA_URN;
}

public long getLuckyNumber() {
return this.luckyNumber;
}

public LuckyNumberExtension setLuckyNumber(long luckyNumber) {
this.luckyNumber = luckyNumber;
return this;
}

public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof LuckyNumberExtension)) return false;
final LuckyNumberExtension other = (LuckyNumberExtension) o;
if (!other.canEqual((Object) this)) return false;
if (this.getLuckyNumber() != other.getLuckyNumber()) return false;
return true;
}

protected boolean canEqual(final Object other) {
return other instanceof LuckyNumberExtension;
}

public int hashCode() {
final int PRIME = 59;
int result = 1;
final long $luckyNumber = this.getLuckyNumber();
result = result * PRIME + (int) ($luckyNumber >>> 32 ^ $luckyNumber);
return result;
}

public String toString() {
return "LuckyNumberExtension(luckyNumber=" + this.getLuckyNumber() + ")";
}
}
Loading