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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
public class JerseyApplication extends Application {

private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(JerseyApplication.class);

@Override
public Set<Class<?>> getClasses() {
return ScimResourceHelper.scimpleFeatureAndResourceClasses();
Expand All @@ -53,11 +53,11 @@ public Set<Class<?>> getClasses() {
@Produces
ServerConfiguration serverConfiguration() {
return new ServerConfiguration()
// Set any unique configuration bits
.setId("scimple-jersey4-example")
.setDocumentationUri("https://github.com/apache/directory-scimple")
// set the auth scheme too
.addAuthenticationSchema(oauthBearer());
// Informational only, returned by /ServiceProviderConfig.
// This does not enforce authentication. Use oauthBearer() or httpBasic() as appropriate.
.addAuthenticationSchema(oauthBearer());
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,31 @@
/**
* 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* 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.
*/
* 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.jersey4.service;

Expand All @@ -41,16 +41,16 @@
import org.apache.directory.scim.spec.resources.ScimGroup;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

@Named
@ApplicationScoped
public class InMemoryGroupService implements Repository<ScimGroup> {

private final Map<String, ScimGroup> groups = new HashMap<>();
private final Map<String, ScimGroup> groups = new ConcurrentHashMap<>();

private SchemaRegistry schemaRegistry;

Expand Down Expand Up @@ -89,7 +89,7 @@ public ScimGroup create(ScimGroup resource, ScimRequestContext requestContext) t

// check to make sure the group doesn't already exist
boolean existingGroupFound = groups.values().stream()
.anyMatch(group -> resource.getExternalId().equals(group.getExternalId()));
.anyMatch(group -> resource.getExternalId().equals(group.getExternalId()));
if (existingGroupFound) {
// HTTP leaking into data layer
throw new UnableToCreateResourceException(Response.Status.CONFLICT, "Group '" + resource.getExternalId() + "' already exists.");
Expand All @@ -105,7 +105,6 @@ public ScimGroup update(String id, ScimGroup resource, ScimRequestContext reques
if (!groups.containsKey(id)) {
throw new ResourceNotFoundException(id);
}

groups.put(id, resource);
return resource;
}
Expand All @@ -115,7 +114,6 @@ public ScimGroup patch(String id, List<PatchOperation> patchOperations, ScimRequ
if (!groups.containsKey(id)) {
throw new ResourceNotFoundException(id);
}

ScimGroup resource = patchHandler.apply(get(id, requestContext), patchOperations);
groups.put(id, resource);
return resource;
Expand All @@ -139,10 +137,10 @@ public FilterResponse<ScimGroup> find(Filter filter, ScimRequestContext requestC
long startIndex = requestContext.getPageRequest().map(PageRequest::getStartIndex).map(it -> it - 1).orElse(0);

List<ScimGroup> result = groups.values().stream()
.skip(startIndex)
.limit(count)
.filter(FilterExpressions.inMemory(filter, schemaRegistry.getSchema(ScimGroup.SCHEMA_URI)))
.toList();
.skip(startIndex)
.limit(count)
.filter(FilterExpressions.inMemory(filter, schemaRegistry.getSchema(ScimGroup.SCHEMA_URI)))
.toList();

return new FilterResponse<>(result, result.size());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* 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.
*/
* 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.jersey4.service;

Expand Down Expand Up @@ -50,7 +50,7 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* Creates a singleton (effectively) Repository<ScimUser> with a memory-based
* Creates a singleton (effectively) {@code Repository<ScimUser>} with a memory-based
* persistence layer.
*
* @author Chris Harm &lt;crh5255@psu.edu&gt;
Expand Down Expand Up @@ -156,7 +156,6 @@ public ScimUser patch(String id, List<PatchOperation> patchOperations, ScimReque
return resource;
}


/**
* @see Repository#get(java.lang.String, ScimRequestContext)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
public class JerseyApplication extends Application {

private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(JerseyApplication.class);

@Override
public Set<Class<?>> getClasses() {
return ScimResourceHelper.scimpleFeatureAndResourceClasses();
Expand All @@ -53,11 +53,11 @@ public Set<Class<?>> getClasses() {
@Produces
ServerConfiguration serverConfiguration() {
return new ServerConfiguration()
// Set any unique configuration bits
.setId("scimple-jersey-example")
.setDocumentationUri("https://github.com/apache/directory-scimple")
// set the auth scheme too
.addAuthenticationSchema(oauthBearer());
// Informational only, returned by /ServiceProviderConfig.
// This does not enforce authentication. Use oauthBearer() or httpBasic() as appropriate.
.addAuthenticationSchema(oauthBearer());
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,31 @@
/**
* 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
import org.apache.directory.scim.spec.resources.ScimGroup;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

@Named
@ApplicationScoped
public class InMemoryGroupService implements Repository<ScimGroup> {

private final Map<String, ScimGroup> groups = new HashMap<>();
private final Map<String, ScimGroup> groups = new ConcurrentHashMap<>();

private SchemaRegistry schemaRegistry;

Expand Down Expand Up @@ -105,7 +105,6 @@ public ScimGroup update(String id, ScimGroup resource, ScimRequestContext reques
if (!groups.containsKey(id)) {
throw new ResourceNotFoundException(id);
}

groups.put(id, resource);
return resource;
}
Expand All @@ -115,7 +114,6 @@ public ScimGroup patch(String id, List<PatchOperation> patchOperations, ScimRequ
if (!groups.containsKey(id)) {
throw new ResourceNotFoundException(id);
}

ScimGroup resource = patchHandler.apply(get(id, requestContext), patchOperations);
groups.put(id, resource);
return resource;
Expand Down

This file was deleted.

Loading
Loading