Skip to content

Commit

Permalink
OIDC provider (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani authored Apr 3, 2024
1 parent 9bf2c32 commit 7749095
Show file tree
Hide file tree
Showing 152 changed files with 5,084 additions and 4,184 deletions.
3 changes: 2 additions & 1 deletion src/modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses />.
-->
<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/maven-v4_0_0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Expand All @@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.
* along with this program.
*
* ====================================================================
*
Expand All @@ -29,22 +29,20 @@

import it.geosolutions.geostore.core.model.UserGroup;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.util.List;

/**
* Class ExtGroupList.
*
*
* @author Mirco Bertelli (mirco.bertelli at geo-solutions.it)
*
*/
@XmlRootElement(name = "ExtGroupList")
public class ExtGroupList {
private long count;

private long count;

private List<UserGroup> list;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Expand All @@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.
* along with this program.
*
* ====================================================================
*
Expand All @@ -30,17 +30,15 @@

import it.geosolutions.geostore.core.model.Resource;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.util.List;

/**
* Class ExtResourceList.
*
*
* @author Tobia di Pisa (tobia.dipisa at geo-solutions.it)
*
*/
@XmlRootElement(name = "ExtResourceList")
public class ExtResourceList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Expand All @@ -16,7 +16,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.
* along with this program.
*
* ====================================================================
*
Expand All @@ -30,17 +30,15 @@

import it.geosolutions.geostore.core.model.User;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.util.List;

/**
* Class ExtUserList.
*
*
* @author Tobia di Pisa (tobia.dipisa at geo-solutions.it)
*
*/
@XmlRootElement(name = "ExtUserList")
public class ExtUserList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Expand All @@ -17,7 +17,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.
* along with this program.
*
* ====================================================================
*
Expand All @@ -36,131 +36,123 @@
import it.geosolutions.geostore.services.rest.exception.BadRequestWebEx;
import it.geosolutions.geostore.services.rest.exception.InternalErrorWebEx;
import it.geosolutions.geostore.services.rest.exception.NotFoundWebEx;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.springframework.security.access.annotation.Secured;

import javax.annotation.security.RolesAllowed;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.SecurityContext;

import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.springframework.security.access.annotation.Secured;

/**
* Interface RESTExtJsService.
*
*
* @author Tobia di Pisa (tobia.dipisa at geo-solutions.it)
*
*/
public interface RESTExtJsService {

@GET
@Path("/search/{nameLike}")
@Produces({ MediaType.APPLICATION_JSON })
@Secured({ "ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS" })
@Produces({MediaType.APPLICATION_JSON})
@Secured({"ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS"})
String getAllResources(@Context SecurityContext sc,
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit)
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit)
throws BadRequestWebEx;

@GET
@Path("/search/category/{categoryName}")
@Produces({ MediaType.APPLICATION_JSON })
@Secured({ "ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS" })
@Produces({MediaType.APPLICATION_JSON})
@Secured({"ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS"})
String getResourcesByCategory(@Context SecurityContext sc,
@PathParam("categoryName") String categoryName,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
@PathParam("categoryName") String categoryName,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
throws BadRequestWebEx, InternalErrorWebEx;

@GET
@Path("/search/category/{categoryName}/{resourceNameLike}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
@RolesAllowed({ "ADMIN", "USER", "GUEST" })
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
@RolesAllowed({"ADMIN", "USER", "GUEST"})
String getResourcesByCategory(@Context SecurityContext sc,
@PathParam("categoryName") String categoryName,
@PathParam("resourceNameLike") String resourceNameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
@PathParam("categoryName") String categoryName,
@PathParam("resourceNameLike") String resourceNameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
throws BadRequestWebEx, InternalErrorWebEx;

@GET
@Path("/search/category/{categoryName}/{resourceNameLike}/{extraAttributes}")
@Produces({ MediaType.APPLICATION_JSON })
@RolesAllowed({ "ADMIN", "USER", "GUEST" })
@Produces({MediaType.APPLICATION_JSON})
@RolesAllowed({"ADMIN", "USER", "GUEST"})
String getResourcesByCategory(@Context SecurityContext sc,
@PathParam("categoryName") String categoryName,
@PathParam("resourceNameLike") String resourceNameLike,
@PathParam("extraAttributes") String extraAttributes,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
@PathParam("categoryName") String categoryName,
@PathParam("resourceNameLike") String resourceNameLike,
@PathParam("extraAttributes") String extraAttributes,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData)
throws BadRequestWebEx, InternalErrorWebEx;

@POST
@GET
@Path("/search/list")
@Produces({ MediaType.TEXT_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_XML })
@Secured({ "ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS" })
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML})
@Secured({"ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS"})
ExtResourceList getExtResourcesList(@Context SecurityContext sc,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData,
@Multipart("filter") SearchFilter filter)
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes,
@QueryParam("includeData") @DefaultValue("false") boolean includeData,
@Multipart("filter") SearchFilter filter)
throws BadRequestWebEx, InternalErrorWebEx;

@GET
@Path("/search/users/{nameLike}")
@Produces({ MediaType.APPLICATION_JSON })
@Secured({ "ROLE_ADMIN"})
@Produces({MediaType.APPLICATION_JSON})
@Secured({"ROLE_ADMIN"})
ExtUserList getUsersList(@Context SecurityContext sc,
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes)
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("includeAttributes") @DefaultValue("false") boolean includeAttributes)
throws BadRequestWebEx;

/**
* Search for groups by name and return paginated results.
* @param sc security context
*
* @param sc security context
* @param nameLike a substring in the name
* @param start the n-th group shown as first in results.
* @param limit max entries per page
* @param all if <code>true</code> return also 'everyone' group
* @param start the n-th group shown as first in results.
* @param limit max entries per page
* @param all if <code>true</code> return also 'everyone' group
* @return
* @throws BadRequestWebEx
*/
@GET
@Path("/search/groups/{nameLike}")
@Produces({ MediaType.TEXT_XML, MediaType.APPLICATION_JSON })
@Secured({ "ROLE_ADMIN", "ROLE_USER"})
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
@Secured({"ROLE_ADMIN", "ROLE_USER"})
ExtGroupList getGroupsList(@Context SecurityContext sc,
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("all") @DefaultValue("false") boolean all)
@PathParam("nameLike") String nameLike,
@QueryParam("start") Integer start,
@QueryParam("limit") Integer limit,
@QueryParam("all") @DefaultValue("false") boolean all)
throws BadRequestWebEx;

@GET
@Path("/resource/{id}")
@Produces({ MediaType.TEXT_XML, MediaType.APPLICATION_JSON })
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_ANONYMOUS" })
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
@Secured({"ROLE_USER", "ROLE_ADMIN", "ROLE_ANONYMOUS"})
ShortResource getResource(@Context SecurityContext sc,
@PathParam("id") long id)
throws NotFoundWebEx;
@PathParam("id") long id)
throws NotFoundWebEx;
}
Loading

0 comments on commit 7749095

Please sign in to comment.