You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/01/27 11:22:47 UTC
[04/19] cxf-fediz git commit: FEDIZ-155 - Move .java components out
of idp webapp and into a separate JAR
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationService.java
deleted file mode 100644
index 2034dca..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationService.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("applications")
-public interface ApplicationService {
-
- @GET
- @PreAuthorize("hasRole('APPLICATION_LIST')")
- Applications getApplications(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("2") int size,
- @QueryParam("expand") @DefaultValue("all") List<String> expand,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{realm}")
- @PreAuthorize("hasRole('APPLICATION_LIST')")
- Application getApplication(@PathParam("realm") String realm,
- @QueryParam("expand") @DefaultValue("all") List<String> expand);
-
- @POST
- @PreAuthorize("hasRole('APPLICATION_CREATE')")
- Response addApplication(@Context UriInfo ui, Application service);
-
- @PUT
- @Path("{realm}")
- @PreAuthorize("hasRole('APPLICATION_UPDATE')")
- Response updateApplication(@Context UriInfo ui, @PathParam("realm") String realm, Application application);
-
- @DELETE
- @Path("{realm}")
- @PreAuthorize("hasRole('APPLICATION_DELETE')")
- Response deleteApplication(@PathParam("realm") String realm);
-
- @POST
- @Path("{realm}/claims")
- @PreAuthorize("hasRole('APPLICATION_UPDATE')")
- Response addClaimToApplication(@Context UriInfo ui, @PathParam("realm") String realm, RequestClaim claim);
-
- @DELETE
- @Path("{realm}/claims/{claimType}")
- @PreAuthorize("hasRole('APPLICATION_UPDATE')")
- Response removeClaimFromApplication(@Context UriInfo ui, @PathParam("realm") String realm,
- @PathParam("claimType") String claimType);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationServiceImpl.java
deleted file mode 100644
index 1b2f6ff..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ApplicationServiceImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
-import org.apache.cxf.fediz.service.idp.service.ApplicationDAO;
-import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ApplicationServiceImpl implements ApplicationService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(ApplicationServiceImpl.class);
-
- @Autowired
- private ApplicationDAO applicationDAO;
-
- @Autowired
- private ClaimDAO claimDAO;
-
- @Override
- public Applications getApplications(int start, int size, List<String> expand, UriInfo uriInfo) {
- List<Application> applications = applicationDAO.getApplications(start, size, expand);
-
- for (Application a : applications) {
- URI self = uriInfo.getAbsolutePathBuilder().path(a.getRealm()).build();
- a.setHref(self);
- }
-
- Applications list = new Applications();
- list.setApplications(applications);
- return list;
- }
-
- @Override
- public Application getApplication(String realm, List<String> expand) {
- Application application = applicationDAO.getApplication(realm, expand);
- if (application == null) {
- throw new NotFoundException();
- } else {
- return application;
- }
- }
-
- @Override
- public Response addApplication(UriInfo ui, Application application) {
- LOG.info("add Service config");
- if (application.getRequestedClaims() != null && application.getRequestedClaims().size() > 0) {
- LOG.warn("Application resource contains sub resource 'claims'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- Application createdApplication = applicationDAO.addApplication(application);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdApplication.getRealm());
- return Response.created(location).entity(application).build();
- }
-
- @Override
- public Response updateApplication(UriInfo ui, String realm, Application application) {
- if (!realm.equals(application.getRealm().toString())) {
- throw new BadRequestException();
- }
- if (application.getRequestedClaims() != null && application.getRequestedClaims().size() > 0) {
- LOG.warn("Application resource contains sub resource 'claims'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- applicationDAO.updateApplication(realm, application);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response deleteApplication(String realm) {
- applicationDAO.deleteApplication(realm);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response addClaimToApplication(UriInfo ui, String realm, RequestClaim claim) {
- Application application = applicationDAO.getApplication(realm, null);
- if (application.getRequestedClaims().contains(claim)) {
- LOG.warn("Claim '" + claim.getClaimType() + "' already added");
- //[TODO] Status.CONFLICT correct if the relation to with Claim already exists
- throw new WebApplicationException(Status.CONFLICT);
- }
- Claim foundClaim = claimDAO.getClaim(claim.getClaimType().toString());
- RequestClaim rc = new RequestClaim(foundClaim);
- application.getRequestedClaims().add(rc);
- applicationDAO.addClaimToApplication(application, claim);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response removeClaimFromApplication(UriInfo ui, String realm, String claimType) {
- Application application = applicationDAO.getApplication(realm, null);
-
- RequestClaim foundItem = null;
- for (RequestClaim item : application.getRequestedClaims()) {
- if (item.getClaimType().toString().equals(claimType)) {
- foundItem = item;
- break;
- }
- }
- if (foundItem == null) {
- LOG.warn("Claim '" + claimType + "' not found");
- throw new WebApplicationException(Status.NOT_FOUND);
- }
- application.getRequestedClaims().remove(foundItem);
- applicationDAO.removeClaimFromApplication(application, foundItem);
-
- return Response.noContent().build();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Applications.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Applications.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Applications.java
deleted file mode 100644
index 5773a07..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Applications.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-
-@XmlRootElement(name = "applications", namespace = "http://org.apache.cxf.fediz/")
-public class Applications {
-
- private Collection<Application> applications;
-
- public Applications() {
- }
-
- public Applications(Collection<Application> applications) {
- this.applications = applications;
- }
-
- @XmlElementRef
- public Collection<Application> getApplications() {
- return applications;
- }
-
- public void setApplications(Collection<Application> applications) {
- this.applications = applications;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimService.java
deleted file mode 100644
index 47dac60..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimService.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("claims")
-public interface ClaimService {
-
- @GET
- @PreAuthorize("hasRole('CLAIM_LIST')")
- Response getClaims(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("2") int size,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{claimType}")
- @PreAuthorize("hasRole('CLAIM_READ')")
- Claim getClaim(@PathParam("claimType") String claimType);
-
- @POST
- @PreAuthorize("hasRole('CLAIM_CREATE')")
- Response addClaim(@Context UriInfo ui, Claim claim);
-
- @PUT
- @Path("{claimType}")
- @PreAuthorize("hasRole('CLAIM_UPDATE')")
- Response updateClaim(@Context UriInfo ui, @PathParam("claimType") String claimType, Claim claim);
-
- @DELETE
- @Path("{claimType}")
- @PreAuthorize("hasRole('CLAIM_DELETE')")
- Response deleteClaim(@PathParam("claimType") String claimType);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimServiceImpl.java
deleted file mode 100644
index 141bfab..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/ClaimServiceImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ClaimServiceImpl implements ClaimService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(ClaimServiceImpl.class);
-
- @Autowired
- private ClaimDAO claimDAO;
-
- @Override
- public Response getClaims(int start, int size, UriInfo uriInfo) {
- List<Claim> claims = claimDAO.getClaims(start, size);
-
- for (Claim c : claims) {
- URI self = uriInfo.getAbsolutePathBuilder().path(c.getClaimType().toString()).build();
- c.setHref(self);
- }
-
- Claims list = new Claims();
- list.setClaims(claims);
-
-
- //return Response.ok(list).type(MediaType.APPLICATION_JSON_TYPE).build();
- return Response.ok(list).build();
- }
-
- @Override
- public Response addClaim(UriInfo ui, Claim claim) {
- LOG.info("add Claim config");
-
- Claim createdClaim = claimDAO.addClaim(claim);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdClaim.getClaimType().toString());
- return Response.created(location).entity(claim).build();
- }
-
- @Override
- public Claim getClaim(String claimType) {
- Claim claim = claimDAO.getClaim(claimType);
- if (claim == null) {
- throw new NotFoundException();
- } else {
- return claim;
- }
- }
-
- @Override
- public Response updateClaim(UriInfo ui, String claimType, Claim claim) {
- if (!claimType.equals(claim.getClaimType().toString())) {
- throw new BadRequestException();
- }
- claimDAO.updateClaim(claimType, claim);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response deleteClaim(String claimType) {
- claimDAO.deleteClaim(claimType);
-
- return Response.noContent().build();
- }
-
-
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Claims.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Claims.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Claims.java
deleted file mode 100644
index 891effd..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Claims.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-
-@XmlRootElement(name = "claims", namespace = "http://org.apache.cxf.fediz/")
-public class Claims {
-
- private Collection<Claim> claims;
-
- public Claims() {
- }
-
- public Claims(Collection<Claim> claims) {
- this.claims = claims;
- }
-
- @XmlElementRef
- public Collection<Claim> getClaims() {
- return claims;
- }
-
- public void setClaims(Collection<Claim> claims) {
- this.claims = claims;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementService.java
deleted file mode 100644
index 4bc392c..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementService.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("entitlements")
-public interface EntitlementService {
-
- @GET
- @PreAuthorize("hasRole('ENTITLEMENT_LIST')")
- Entitlements getEntitlements(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("5") int size,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{name}")
- @PreAuthorize("hasRole('ENTITLEMENT_READ')")
- Entitlement getEntitlement(@PathParam("name") String name);
-
- @POST
- @PreAuthorize("hasRole('ENTITLEMENT_CREATE')")
- Response addEntitlement(@Context UriInfo ui, Entitlement entitlement);
-
- @PUT
- @Path("{name}")
- @PreAuthorize("hasRole('ENTITLEMENT_UPDATE')")
- Response updateEntitlement(@Context UriInfo ui, @PathParam("name") String name, Entitlement entitlement);
-
- @DELETE
- @Path("{name}")
- @PreAuthorize("hasRole('ENTITLEMENT_DELETE')")
- Response deleteEntitlement(@PathParam("name") String name);
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementServiceImpl.java
deleted file mode 100644
index 9c89c04..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/EntitlementServiceImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.service.EntitlementDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class EntitlementServiceImpl implements EntitlementService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(EntitlementServiceImpl.class);
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Override
- public Entitlements getEntitlements(int start, int size, UriInfo uriInfo) {
- List<Entitlement> entitlements = entitlementDAO.getEntitlements(start, size);
-
- Entitlements list = new Entitlements();
- list.setEntitlements(entitlements);
-
- return list;
- }
-
- @Override
- public Response addEntitlement(UriInfo ui, Entitlement entitlement) {
- Entitlement createdEntitlement = entitlementDAO.addEntitlement(entitlement);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdEntitlement.getName());
-
- LOG.debug("Entitlement '" + createdEntitlement.getName() + "' added");
- return Response.created(location).entity(entitlement).build();
- }
-
- @Override
- public Entitlement getEntitlement(String name) {
- Entitlement entitlement = entitlementDAO.getEntitlement(name);
- if (entitlement == null) {
- throw new NotFoundException();
- } else {
- return entitlement;
- }
- }
-
- @Override
- public Response updateEntitlement(UriInfo ui, String name, Entitlement entitlement) {
- if (!name.equals(entitlement.getName())) {
- throw new BadRequestException();
- }
- entitlementDAO.updateEntitlement(name, entitlement);
-
- LOG.debug("Entitlement '" + entitlement.getName() + "' updated");
- return Response.noContent().build();
- }
-
- @Override
- public Response deleteEntitlement(String name) {
- entitlementDAO.deleteEntitlement(name);
-
- LOG.debug("Entitlement '" + name + "' deleted");
- return Response.noContent().build();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Entitlements.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Entitlements.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Entitlements.java
deleted file mode 100644
index 8f2e91a..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Entitlements.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-
-@XmlRootElement(name = "entitlements", namespace = "http://org.apache.cxf.fediz/")
-public class Entitlements {
-
- private Collection<Entitlement> entitlements;
-
- public Entitlements() {
- }
-
- public Entitlements(Collection<Entitlement> entitlements) {
- this.entitlements = entitlements;
- }
-
- @XmlElementRef
- public Collection<Entitlement> getEntitlements() {
- return entitlements;
- }
-
- public void setEntitlements(Collection<Entitlement> entitlements) {
- this.entitlements = entitlements;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpService.java
deleted file mode 100644
index b4692e8..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpService.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("idps")
-public interface IdpService {
-
- @GET
- @PreAuthorize("hasRole('IDP_LIST')")
- Idps getIdps(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("2") int size,
- @QueryParam("expand") @DefaultValue("all") List<String> expand,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{realm}")
- @PreAuthorize("hasRole('IDP_READ')")
- Idp getIdp(@PathParam("realm") String realm,
- @QueryParam("expand") @DefaultValue("all") List<String> expand);
-
- @POST
- @PreAuthorize("hasRole('IDP_CREATE')")
- Response addIdp(@Context UriInfo ui, Idp idp);
-
- @PUT
- @Path("{realm}")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response updateIdp(@Context UriInfo ui, @PathParam("realm") String realm, Idp idp);
-
- @DELETE
- @Path("{realm}")
- @PreAuthorize("hasRole('IDP_DELETE')")
- Response deleteIdp(@PathParam("realm") String realm);
-
- @POST
- @Path("{realm}/applications")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response addApplicationToIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- Application application);
-
- @DELETE
- @Path("{realm}/applications/{realmApplication}")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response removeApplicationFromIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- @PathParam("realmApplication") String applicationRealm);
-
- @POST
- @Path("{realm}/trusted-idps")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response addTrustedIdpToIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- TrustedIdp trustedIdp);
-
- @DELETE
- @Path("{realm}/trusted-idps/{realmTrustedIdp}")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response removeTrustedIdpFromIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- @PathParam("realmTrustedIdp") String trustedIdpRealm);
-
- @POST
- @Path("{realm}/claims")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response addClaimToIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- Claim claim);
-
- @DELETE
- @Path("{realm}/claims/{claimType}")
- @PreAuthorize("hasRole('IDP_UPDATE')")
- Response removeClaimFromIdp(@Context UriInfo ui, @PathParam("realm") String realm,
- @PathParam("claimType") String claimType);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpServiceImpl.java
deleted file mode 100644
index d4b5c40..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/IdpServiceImpl.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Application;
-import org.apache.cxf.fediz.service.idp.domain.Claim;
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-import org.apache.cxf.fediz.service.idp.service.ApplicationDAO;
-import org.apache.cxf.fediz.service.idp.service.ClaimDAO;
-import org.apache.cxf.fediz.service.idp.service.IdpDAO;
-import org.apache.cxf.fediz.service.idp.service.TrustedIdpDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class IdpServiceImpl implements IdpService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(IdpServiceImpl.class);
-
- @Autowired
- private IdpDAO idpDAO;
-
- @Autowired
- private ApplicationDAO applicationDAO;
-
- @Autowired
- private TrustedIdpDAO trustedIdpDAO;
-
- @Autowired
- private ClaimDAO claimDAO;
-
- @Override
- public Idps getIdps(int start, int size, List<String> expand, UriInfo uriInfo) {
- List<Idp> idps = idpDAO.getIdps(start, size, expand);
-
- Idps list = new Idps();
- list.setIdps(idps);
- return list;
- }
-
- @Override
- public Idp getIdp(String realm, List<String> expand) {
- Idp idp = idpDAO.getIdp(realm, expand);
- if (idp == null) {
- LOG.warn("IdP not found for realm {}", realm);
- throw new NotFoundException();
- } else {
- return idp;
- }
- }
-
- @Override
- public Response addIdp(UriInfo ui, Idp idp) {
- LOG.info("add IDP config");
- if (idp.getApplications() != null && idp.getApplications().size() > 0) {
- LOG.warn("IDP resource contains sub resource 'applications'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- if (idp.getTrustedIdps() != null && idp.getTrustedIdps().size() > 0) {
- LOG.warn("IDP resource contains sub resource 'trusted-idps'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- Idp createdIdp = idpDAO.addIdp(idp);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdIdp.getRealm());
- return Response.created(location).entity(idp).build();
- }
-
- @Override
- public Response updateIdp(UriInfo ui, String realm, Idp idp) {
- if (!realm.equals(idp.getRealm().toString())) {
- throw new BadRequestException();
- }
- if (idp.getApplications() != null && idp.getApplications().size() > 0) {
- LOG.warn("IDP resource contains sub resource 'applications'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- if (idp.getTrustedIdps() != null && idp.getTrustedIdps().size() > 0) {
- LOG.warn("IDP resource contains sub resource 'trusted-idps'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- idpDAO.updateIdp(realm, idp);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response deleteIdp(String realm) {
- idpDAO.deleteIdp(realm);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response addApplicationToIdp(UriInfo ui, String realm, Application application) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
- for (Application idpApplication : idp.getApplications()) {
- if (idpApplication.getRealm() != null && idpApplication.getRealm().equals(application.getRealm())) {
- LOG.warn("Application '" + application.getRealm() + "' already added");
- throw new WebApplicationException(Status.CONFLICT);
- }
- }
- Application application2 = applicationDAO.getApplication(application.getRealm(), null);
- idpDAO.addApplicationToIdp(idp, application2);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response removeApplicationFromIdp(UriInfo ui, String realm, String applicationRealm) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
-
- Application foundItem = null;
- for (Application item : idp.getApplications()) {
- if (item.getRealm().equals(applicationRealm)) {
- foundItem = item;
- break;
- }
- }
- if (foundItem == null) {
- LOG.warn("Application '" + applicationRealm + "' not found");
- throw new WebApplicationException(Status.NOT_FOUND);
- }
- idpDAO.removeApplicationFromIdp(idp, foundItem);
-
- return Response.noContent().build();
- }
-
-
-
-
- @Override
- public Response addTrustedIdpToIdp(UriInfo ui, String realm, TrustedIdp trustedIdp) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
- for (TrustedIdp idpTrustedIdp : idp.getTrustedIdps()) {
- if (idpTrustedIdp.getRealm() != null && idpTrustedIdp.getRealm().equals(trustedIdp.getRealm())) {
- LOG.warn("Trusted IDP '" + trustedIdp.getRealm() + "' already added");
- throw new WebApplicationException(Status.CONFLICT);
- }
- }
- TrustedIdp trustedIpd2 = trustedIdpDAO.getTrustedIDP(trustedIdp.getRealm());
-
- idpDAO.addTrustedIdpToIdp(idp, trustedIpd2);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response removeTrustedIdpFromIdp(UriInfo ui, String realm, String trustedIdpRealm) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
-
- TrustedIdp foundItem = null;
- for (TrustedIdp item : idp.getTrustedIdps()) {
- if (item.getRealm().equals(trustedIdpRealm)) {
- foundItem = item;
- break;
- }
- }
- if (foundItem == null) {
- LOG.warn("Trusted IDP '" + trustedIdpRealm + "' not found");
- throw new WebApplicationException(Status.NOT_FOUND);
- }
- idpDAO.removeTrustedIdpFromIdp(idp, foundItem);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response addClaimToIdp(UriInfo ui, String realm, Claim claim) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
- for (Claim idpClaim : idp.getClaimTypesOffered()) {
- if (idpClaim.getClaimType() != null
- && idpClaim.getClaimType().toString().equals(claim.getClaimType().toString())) {
- LOG.warn("Claim '" + claim.getClaimType() + "' already added");
- throw new WebApplicationException(Status.CONFLICT);
- }
- }
- Claim claim2 = claimDAO.getClaim(claim.getClaimType().toString());
- idpDAO.addClaimToIdp(idp, claim2);
-
- return Response.noContent().build();
- }
-
- @Override
- public Response removeClaimFromIdp(UriInfo ui, String realm, String claimType) {
- Idp idp = idpDAO.getIdp(realm, Arrays.asList("all"));
-
- Claim foundItem = null;
- for (Claim item : idp.getClaimTypesOffered()) {
- if (item.getClaimType().toString().equals(claimType)) {
- foundItem = item;
- break;
- }
- }
- if (foundItem == null) {
- LOG.warn("Claim '" + claimType + "' not found");
- throw new WebApplicationException(Status.NOT_FOUND);
- }
- idpDAO.removeClaimFromIdp(idp, foundItem);
-
- return Response.noContent().build();
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Idps.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Idps.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Idps.java
deleted file mode 100644
index 08d7f50..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Idps.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.Idp;
-
-@XmlRootElement(name = "idps", namespace = "http://org.apache.cxf.fediz/")
-public class Idps {
-
- private Collection<Idp> idps;
-
- public Idps() {
- }
-
- public Idps(Collection<Idp> idps) {
- this.idps = idps;
- }
-
- @XmlElementRef
- public Collection<Idp> getIdps() {
- return idps;
- }
-
- public void setIdps(Collection<Idp> idps) {
- this.idps = idps;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/QueryResourceInfoComparator.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/QueryResourceInfoComparator.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/QueryResourceInfoComparator.java
deleted file mode 100644
index 1e87bfc..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/QueryResourceInfoComparator.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.jaxrs.ext.ResourceComparator;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
-import org.apache.cxf.jaxrs.model.OperationResourceInfo;
-import org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
-import org.apache.cxf.jaxrs.model.Parameter;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.message.Message;
-
-public class QueryResourceInfoComparator extends OperationResourceInfoComparator implements ResourceComparator {
-
- public QueryResourceInfoComparator() {
- super(null, null);
- }
-
- @Override
- public int compare(final ClassResourceInfo cri1, final ClassResourceInfo cri2, final Message message) {
- // Leave Class selection to CXF
- return 0;
- }
-
- @Override
- public int compare(final OperationResourceInfo oper1, final OperationResourceInfo oper2, final Message message) {
- // Check if CXF can make a decision
- int cxfResult = super.compare(oper1, oper2);
- if (cxfResult != 0) {
- return cxfResult;
- }
-
- int op1Counter = getMatchingRate(oper1, message);
- int op2Counter = getMatchingRate(oper2, message);
-
- return op1Counter == op2Counter
- ? 0
- : op1Counter < op2Counter
- ? 1
- : -1;
- }
-
- /**
- * This method calculates a number indicating a good or bad match between values provided within the request and
- * expected method parameters. A higher number means a better match.
- *
- * @param operation The operation to be rated, based on contained parameterInfo values.
- * @param message A message containing query and header values from user request
- * @return A positive or negative number, indicating a good match between query and method
- */
- protected int getMatchingRate(final OperationResourceInfo operation, final Message message) {
- List<Parameter> params = operation.getParameters();
- if (params == null || params.isEmpty()) {
- return 0;
- }
-
- // Get Request QueryParams
- String query = (String) message.get(Message.QUERY_STRING);
- String path = (String) message.get(Message.REQUEST_URI);
- Map<String, List<String>> qParams = JAXRSUtils.getStructuredParams(query, "&", true, false);
- Map<String, List<String>> mParams = JAXRSUtils.getMatrixParams(path, true);
- // Get Request Headers
- Map<?, ?> qHeader = (java.util.Map<?, ?>) message.get(Message.PROTOCOL_HEADERS);
-
- int rate = 0;
- for (Parameter p : params) {
- switch (p.getType()) {
- case QUERY:
- if (qParams.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- case MATRIX:
- if (mParams.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- case HEADER:
- if (qHeader.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- default:
- break;
- }
- }
- return rate;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java
deleted file mode 100644
index c7a1e1e..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RestServiceExceptionMapper.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import javax.validation.ConstraintViolationException;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.dao.DataRetrievalFailureException;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.security.access.AccessDeniedException;
-
-@Provider
-public class RestServiceExceptionMapper implements ExceptionMapper<Exception> {
-
- public static final String APPLICATION_ERROR_CODE = "X-Application-Error-Code";
-
- public static final String APPLICATION_ERROR_INFO = "X-Application-Error-Info";
-
- private static final String BASIC_REALM_UNAUTHORIZED = "Basic realm=\"Apache Fediz authentication\"";
-
- private static final Logger LOG = LoggerFactory.getLogger(RestServiceExceptionMapper.class);
-
- @Override
- public Response toResponse(final Exception ex) {
- LOG.warn("Exception occured processing REST request: " + ex.getMessage(), ex);
-
- if (ex instanceof AccessDeniedException) {
- return Response.status(Response.Status.UNAUTHORIZED).
- header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED).
- build();
- }
- if (ex instanceof ConstraintViolationException) {
- ConstraintViolationException cve = (ConstraintViolationException)ex;
- LOG.debug("{}\n{}", ex.getMessage(), cve.getConstraintViolations().toString());
- return buildResponse(Response.Status.BAD_REQUEST, ex);
- }
- if (ex instanceof DataIntegrityViolationException) {
- return buildResponse(Response.Status.CONFLICT, ex);
- }
-
- if (ex instanceof EmptyResultDataAccessException) {
- return buildResponse(Response.Status.NOT_FOUND, ex);
- }
-
- if (ex instanceof DataRetrievalFailureException) {
- return buildResponse(Response.Status.NOT_FOUND, ex);
- }
-
- // Rest is interpreted as InternalServerError
- return buildResponse(Response.Status.INTERNAL_SERVER_ERROR, ex);
- }
-
- Response buildResponse(final Status status, final Exception ex) {
- ResponseBuilder responseBuilder = Response.status(status);
- return responseBuilder.header(APPLICATION_ERROR_CODE, ex.getClass().getName())
- .header(APPLICATION_ERROR_INFO, ex.getMessage())
- .status(status).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleService.java
deleted file mode 100644
index 27d498c..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleService.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.domain.Role;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("roles")
-public interface RoleService {
-
- @GET
- @PreAuthorize("hasRole('ROLE_LIST')")
- Roles getRoles(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("2") int size,
- @QueryParam("expand") @DefaultValue("all") List<String> expand,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{name}")
- @PreAuthorize("hasRole('ROLE_CREATE')")
- Role getRole(@PathParam("name") String realm,
- @QueryParam("expand") @DefaultValue("all") List<String> expand);
-
- @POST
- @PreAuthorize("hasRole('ROLE_CREATE')")
- Response addRole(@Context UriInfo ui, Role role);
-
- @PUT
- @Path("{name}")
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- Response updateRole(@Context UriInfo ui, @PathParam("name") String name, Role role);
-
- @DELETE
- @Path("{name}")
- @PreAuthorize("hasRole('ROLE_DELETE')")
- Response deleteRole(@PathParam("name") String name);
-
- @POST
- @Path("{name}/entitlements")
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- Response addEntitlementToRole(@Context UriInfo ui, @PathParam("name") String name, Entitlement entitlement);
-
- @DELETE
- @Path("{name}/entitlements/{entitlementName}")
- @PreAuthorize("hasRole('ROLE_UPDATE')")
- Response removeEntitlementFromRole(@Context UriInfo ui, @PathParam("name") String name,
- @PathParam("entitlementName") String entitlementName);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleServiceImpl.java
deleted file mode 100644
index 24ff339..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RoleServiceImpl.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.Entitlement;
-import org.apache.cxf.fediz.service.idp.domain.Role;
-import org.apache.cxf.fediz.service.idp.service.EntitlementDAO;
-import org.apache.cxf.fediz.service.idp.service.RoleDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RoleServiceImpl implements RoleService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(RoleServiceImpl.class);
-
- @Autowired
- private RoleDAO roleDAO;
-
- @Autowired
- private EntitlementDAO entitlementDAO;
-
- @Override
- public Roles getRoles(int start, int size, List<String> expand, UriInfo uriInfo) {
- List<Role> roles = roleDAO.getRoles(start, size, expand);
-
- Roles list = new Roles();
- list.setRoles(roles);
- return list;
- }
-
- @Override
- public Role getRole(String name, List<String> expand) {
- Role role = roleDAO.getRole(name, expand);
- if (role == null) {
- throw new NotFoundException();
- } else {
- return role;
- }
- }
-
- @Override
- public Response addRole(UriInfo ui, Role role) {
- if (role.getEntitlements() != null && role.getEntitlements().size() > 0) {
- LOG.warn("Role resource contains sub resource 'entitlements'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- Role createdRole = roleDAO.addRole(role);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdRole.getName());
-
- LOG.debug("Role '" + role.getName() + "' added");
- return Response.created(location).entity(role).build();
- }
-
- @Override
- public Response updateRole(UriInfo ui, String name, Role role) {
- if (!name.equals(role.getName().toString())) {
- throw new BadRequestException();
- }
- if (role.getEntitlements() != null && role.getEntitlements().size() > 0) {
- LOG.warn("Role resource contains sub resource 'entitlements'");
- throw new WebApplicationException(Status.BAD_REQUEST);
- }
- roleDAO.updateRole(name, role);
-
- LOG.debug("Role '" + role.getName() + "' updated");
- return Response.noContent().build();
- }
-
- @Override
- public Response deleteRole(String name) {
- roleDAO.deleteRole(name);
-
- LOG.debug("Role '" + name + "' deleted");
- return Response.noContent().build();
- }
-
- @Override
- public Response addEntitlementToRole(UriInfo ui, String name, Entitlement entitlement) {
- Role role = roleDAO.getRole(name, null);
-
- Entitlement foundEntitlement = entitlementDAO.getEntitlement(entitlement.getName());
- roleDAO.addEntitlementToRole(role, foundEntitlement);
-
- LOG.debug("Entitlement '" + entitlement.getName() + "' added to Role '" + name + "'");
- return Response.noContent().build();
- }
-
- @Override
- public Response removeEntitlementFromRole(UriInfo ui, String name, String entitlementName) {
- Role role = roleDAO.getRole(name, null);
- Entitlement entitlement = entitlementDAO.getEntitlement(entitlementName);
-
- roleDAO.removeEntitlementFromRole(role, entitlement);
-
- LOG.debug("Entitlement '" + entitlementName + "' removed from Role '" + name + "'");
- return Response.noContent().build();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Roles.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Roles.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Roles.java
deleted file mode 100644
index 6ecd2f2..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/Roles.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.Role;
-
-@XmlRootElement(name = "roles", namespace = "http://org.apache.cxf.fediz/")
-public class Roles {
-
- private Collection<Role> roles;
-
- public Roles() {
- }
-
- public Roles(Collection<Role> roles) {
- this.roles = roles;
- }
-
- @XmlElementRef
- public Collection<Role> getRoles() {
- return roles;
- }
-
- public void setRoles(Collection<Role> roles) {
- this.roles = roles;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootService.java
deleted file mode 100644
index 86d8a3b..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-public interface RootService {
-
- @HEAD
- Response head(@Context UriInfo uriInfo);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootServiceImpl.java
deleted file mode 100644
index 03eb6da..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/RootServiceImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-
-public class RootServiceImpl implements RootService {
-
- public RootServiceImpl() {
- }
-
- public Response head(UriInfo uriInfo) {
- UriBuilder absolute = uriInfo.getBaseUriBuilder();
- URI claimUrl = absolute.clone().path("claims").build();
- URI idpUrl = absolute.clone().path("idps").build();
- URI applicationUrl = absolute.clone().path("applications").build();
- URI trustedIdpUrl = absolute.clone().path("trusted-idps").build();
- URI rolesUrl = absolute.clone().path("roles").build();
- URI entitlementsUrl = absolute.clone().path("entitlements").build();
- javax.ws.rs.core.Link claims = javax.ws.rs.core.Link.fromUri(claimUrl).rel("claims")
- .type("application/xml").build();
- javax.ws.rs.core.Link idps = javax.ws.rs.core.Link.fromUri(idpUrl).rel("idps")
- .type("application/xml").build();
- javax.ws.rs.core.Link applications = javax.ws.rs.core.Link.fromUri(applicationUrl).rel("applications")
- .type("application/xml").build();
- javax.ws.rs.core.Link trustedIdps = javax.ws.rs.core.Link.fromUri(trustedIdpUrl).rel("trusted-idps")
- .type("application/xml").build();
- javax.ws.rs.core.Link roles = javax.ws.rs.core.Link.fromUri(rolesUrl).rel("roles")
- .type("application/xml").build();
- javax.ws.rs.core.Link entitlements = javax.ws.rs.core.Link.fromUri(entitlementsUrl).rel("entitlements")
- .type("application/xml").build();
-
- Response.ResponseBuilder builder = Response.ok().links(
- claims, idps, applications, trustedIdps, roles, entitlements);
- return builder.build();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpService.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpService.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpService.java
deleted file mode 100644
index b76d91d..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpService.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-
-@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-@Path("trusted-idps")
-public interface TrustedIdpService {
-
- @GET
- @PreAuthorize("hasRole('TRUSTEDIDP_LIST')")
- TrustedIdps getTrustedIDPs(@QueryParam("start") int start,
- @QueryParam("size") @DefaultValue("2") int size,
- @Context UriInfo uriInfo);
-
- @GET
- @Path("{realm}")
- @PreAuthorize("hasRole('TRUSTEDIDP_READ')")
- TrustedIdp getTrustedIDP(@PathParam("realm") String realm);
-
- @POST
- @PreAuthorize("hasRole('TRUSTEDIDP_CREATE')")
- Response addTrustedIDP(@Context UriInfo ui, TrustedIdp trustedIdp);
-
- @PUT
- @Path("{realm}")
- @PreAuthorize("hasRole('TRUSTEDIDP_UPDATE')")
- Response updateTrustedIDP(@Context UriInfo ui, @PathParam("realm") String realm, TrustedIdp trustedIdp);
-
- @DELETE
- @Path("{realm}")
- @PreAuthorize("hasRole('TRUSTEDIDP_DELETE')")
- Response deleteTrustedIDP(@PathParam("realm") String realm);
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpServiceImpl.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpServiceImpl.java
deleted file mode 100644
index e01c80b..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdpServiceImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-import org.apache.cxf.fediz.service.idp.service.TrustedIdpDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class TrustedIdpServiceImpl implements TrustedIdpService {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(TrustedIdpServiceImpl.class);
-
- @Autowired
- private TrustedIdpDAO trustedIdpDAO;
-
-
- @Override
- public Response updateTrustedIDP(UriInfo ui, String realm, TrustedIdp trustedIdp) {
- if (!realm.equals(trustedIdp.getRealm().toString())) {
- throw new BadRequestException();
- }
- trustedIdpDAO.updateTrustedIDP(realm, trustedIdp);
-
- return Response.noContent().build();
- }
-
- @Override
- public TrustedIdps getTrustedIDPs(int start, int size, UriInfo uriInfo) {
- List<TrustedIdp> trustedIdps = trustedIdpDAO.getTrustedIDPs(start, size);
-
- TrustedIdps list = new TrustedIdps();
- list.setTrustedIDPs(trustedIdps);
- return list;
- }
-
- @Override
- public TrustedIdp getTrustedIDP(String realm) {
- return this.trustedIdpDAO.getTrustedIDP(realm);
- }
-
- @Override
- public Response addTrustedIDP(UriInfo ui, TrustedIdp trustedIDP) {
- LOG.info("add Trusted IDP config");
-
- TrustedIdp createdTrustedIdp = trustedIdpDAO.addTrustedIDP(trustedIDP);
-
- UriBuilder uriBuilder = UriBuilder.fromUri(ui.getRequestUri());
- uriBuilder.path("{index}");
- URI location = uriBuilder.build(createdTrustedIdp.getRealm());
- return Response.created(location).entity(trustedIDP).build();
- }
-
- @Override
- public Response deleteTrustedIDP(String realm) {
- trustedIdpDAO.deleteTrustedIDP(realm);
-
- return Response.noContent().build();
- }
-
-
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bf309400/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdps.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdps.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdps.java
deleted file mode 100644
index ea57acd..0000000
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/rest/TrustedIdps.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cxf.fediz.service.idp.rest;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.cxf.fediz.service.idp.domain.TrustedIdp;
-
-@XmlRootElement(name = "trustedIdps", namespace = "http://org.apache.cxf.fediz/")
-public class TrustedIdps {
-
- private Collection<TrustedIdp> trustedIDPs;
-
- public TrustedIdps() {
- }
-
- public TrustedIdps(Collection<TrustedIdp> trustedIDPs) {
- this.trustedIDPs = trustedIDPs;
- }
-
- @XmlElementRef
- public Collection<TrustedIdp> getTrustedIDPs() {
- return trustedIDPs;
- }
-
- public void setTrustedIDPs(Collection<TrustedIdp> trustedIDPs) {
- this.trustedIDPs = trustedIDPs;
- }
-}
\ No newline at end of file