diff --git a/src/pom.xml b/src/pom.xml index b8965aa6..8150c3af 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -131,7 +131,7 @@ services - + web diff --git a/src/services/core/webtest/src/main/resources/log4j.xml b/src/services/core/webtest/src/main/resources/log4j.xml index 268dd48b..35cc5e71 100644 --- a/src/services/core/webtest/src/main/resources/log4j.xml +++ b/src/services/core/webtest/src/main/resources/log4j.xml @@ -1,53 +1,30 @@ - - - - - - - logs/ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/services/core/webtest/src/main/webapp/WEB-INF/web.xml b/src/services/core/webtest/src/main/webapp/WEB-INF/web.xml index e416ba7e..3ae12c5f 100755 --- a/src/services/core/webtest/src/main/webapp/WEB-INF/web.xml +++ b/src/services/core/webtest/src/main/webapp/WEB-INF/web.xml @@ -27,7 +27,7 @@ - org.apache.logging.log4j.web.Log4jServletContextListener + org.springframework.web.util.Log4jConfigListener diff --git a/src/web/pom.xml b/src/web/pom.xml new file mode 100644 index 00000000..1519dd3e --- /dev/null +++ b/src/web/pom.xml @@ -0,0 +1,528 @@ + + + + 4.0.0 + + + org.geoserver.geofence + geofence + 3.5-SNAPSHOT + + + org.geoserver.geofence + geofence-web + 3.5-SNAPSHOT + pom + + GeoFence - Web + + + ${project.version} + 25-SNAPSHOT + + 4.2.5.RELEASE + 4.0.4.RELEASE + + 1.2.1 + 1.4 + 2.1 + 3.1.5 + + 3.6.0.Final + 1.1.0 + 2.2.3 + 2.2 + + 3.8.0.GA + + + + + webapp + + + + GeoSolutions + http://www.geo-solutions.it + + 2011 + + + + maven-restlet + Restlet Maven Repository + https://maven.restlet.talend.com/ + + false + + + + + + + + + + + + org.geoserver.geofence + geofence-model-internal + ${geofence-version} + + + + org.geoserver.geofence + geofence-persistence + ${geofence-version} + + + + org.geoserver.geofence + geofence-services-api + ${geofence-version} + + + + org.geoserver.geofence + geofence-services-impl + ${geofence-version} + + + + org.geoserver.geofence + geofence-login-api + ${geofence-version} + + + + org.geoserver.geofence + geofence-login-impl + ${geofence-version} + + + + org.geoserver.geofence + geofence-generic-api + ${geofence-version} + + + + org.geoserver.geofence + geofence-rest-impl + ${geofence-version} + + + + org.geoserver.geofence + geofence-ldap + ${geofence-version} + + + + + + + it.geosolutions + geoserver-manager + 1.6.0 + + + + + + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-asm + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + + org.springframework + spring-expression + ${spring.version} + + + + org.springframework.security + spring-security-acl + ${spring.security.version} + + + org.springframework + spring-expression + + + + + org.springframework.security + spring-security-core + ${spring.security.version} + + + org.springframework + spring-expression + + + + + org.springframework.security + spring-security-taglibs + ${spring.security.version} + + + org.springframework + spring-expression + + + + + + + org.springframework + spring-test + ${spring.version} + test + + + commons-collections + commons-collections + + + xerces + xercesImpl + + + + + + + org.opengis + geoapi + 2.3-M1 + + + org.opengis + geoapi-dummy-pending + 2.3-M1 + + + org.opengis + geoapi-pending + 2.3-M1 + + + net.java.dev.jsr-275 + jsr-275 + 1.0-beta-2 + + + + + + + org.geotools + gt-main + ${gt-version} + + + org.geotools + gt-api + ${gt-version} + + + org.geotools + gt-referencing + ${gt-version} + + + org.geotools + gt-metadata + ${gt-version} + + + org.geotools + gt-shapefile + ${gt-version} + + + org.geotools + gt-epsg-extension + ${gt-version} + + + org.geotools + gt-epsg-wkt + ${gt-version} + + + org.geotools + gt-epsg-hsql + ${gt-version} + + + org.geotools + gt-epsg-h2 + ${gt-version} + + + org.geotools + gt-wms + ${gt-version} + + + org.geotools + gt-wfs + ${gt-version} + + + org.geotools + gt-wfs-ng + ${gt-version} + + + + + + + + commons-lang + commons-lang + 2.3 + + + commons-io + commons-io + 1.4 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-dbcp + commons-dbcp + 1.2.2 + + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} + + + commons-collections + commons-collections + 3.2.2 + + + commons-codec + commons-codec + 1.4 + + + + + + + javax.xml.ws + jaxws-api + ${jaxws-version} + + + javax.jws + jsr181-api + + + + + org.apache.cxf + cxf-rt-bindings-http + ${cxf-version} + + + org.apache.cxf + cxf-rt-transports-http + ${cxf-version} + + + org.apache.cxf + cxf-rt-transports-http-jetty + ${cxf-version} + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf-version} + + + org.apache.geronimo.specs + geronimo-annotation_1.0_spec + + + org.apache.geronimo.specs + geronimo-javamail_1.4_spec + + + + + org.apache.cxf + cxf-rt-bindings-soap + ${cxf-version} + + + org.apache.geronimo.specs + geronimo-javamail_1.4_spec + + + + + org.apache.cxf + cxf-rt-databinding-aegis + ${cxf-version} + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf-version} + + + org.apache.cxf + cxf-rt-ws-security + ${cxf-version} + + + + + + + org.postgis + postgis-jdbc + ${postgis.jdbc.version} + + + org.postgis + postgis-stubs + + + + + org.postgresql + postgresql + ${postgresql.jdbc.version} + + + org.locationtech.jts + jts-core + 1.15.1 + + + + + + + dom4j + dom4j + 1.6.1 + + + + + + + log4j + log4j + 1.2.17 + + + + + + + javax.servlet + servlet-api + 2.5 + provided + + + + + + org.codehaus.jettison + jettison + 1.2 + + + + + + org.hibernatespatial + hibernate-spatial-postgis + ${hibernate-spatial-version} + + + + org.hibernatespatial + hibernate-spatial-oracle + ${hibernate-spatial-version} + + + + org.hibernatespatial + hibernate-spatial-h2-geodb + ${hibernate-spatial-version} + + + + + diff --git a/src/web/webapp/pom.xml b/src/web/webapp/pom.xml new file mode 100644 index 00000000..0cd365ff --- /dev/null +++ b/src/web/webapp/pom.xml @@ -0,0 +1,359 @@ + + + + 4.0.0 + + + org.geoserver.geofence + geofence-web + 3.5-SNAPSHOT + + + org.geoserver.geofence + geofence-webapp + war + + GeoFence - Webapp + + + UTF-8 + + + + + + + + + commons-lang + commons-lang + + + commons-collections + commons-collections + + + + + + + + commons-codec + commons-codec + + + + + + + org.geoserver.geofence + geofence-model-internal + + + + org.geoserver.geofence + geofence-services-api + + + + org.geoserver.geofence + geofence-services-impl + + + + org.geoserver.geofence + geofence-login-impl + + + + org.geoserver.geofence + geofence-rest-impl + + + + org.geoserver.geofence + geofence-ldap + + + + + + + dom4j + dom4j + + + + + + + log4j + log4j + + + + + + + org.codehaus.jettison + jettison + + + javax.servlet + servlet-api + provided + + + + + + + javax.xml.ws + jaxws-api + + + + org.apache.cxf + cxf-rt-transports-http + + + org.apache.cxf + cxf-rt-transports-http-jetty + + + org.apache.cxf + cxf-rt-frontend-jaxws + + + org.apache.cxf + cxf-rt-frontend-jaxrs + + + org.apache.cxf + cxf-rt-bindings-soap + + + org.apache.cxf + cxf-rt-databinding-aegis + + + org.apache.cxf + cxf-rt-ws-security + + + + + + + + + + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + org.springframework + spring-core + + + org.springframework + spring-aop + + + org.springframework + spring-tx + + + org.springframework + spring-orm + + + org.springframework + spring-jdbc + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + + + org.springframework + spring-test + test + + + commons-collections + commons-collections + + + xerces + xercesImpl + + + + + + + + + junit + junit + 4.7 + test + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + utf8 + 1.5 + 1.5 + + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.26 + + + /geofence + + + + 9191 + 60000 + + + manual + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + copy-spatial-dependencies + prepare-package + + + copy + + + + + + org.hibernatespatial + hibernate-spatial-postgis + + + org.hibernatespatial + hibernate-spatial-oracle + + + org.hibernatespatial + hibernate-spatial-h2-geodb + + + ${project.build.directory}/geofence/WEB-INF/spatial-lib/ + + + + + + + geofence + + + + + + + + + postgis + + + org.hibernatespatial + hibernate-spatial-postgis + + + + + h2 + + true + + + + org.hibernatespatial + hibernate-spatial-h2-geodb + + + org.opengeo + geodb + 0.9 + + + + + oracle + + + org.hibernatespatial + hibernate-spatial-oracle + + + + + diff --git a/src/web/webapp/src/main/java/org/geoserver/geofence/StartupService.java b/src/web/webapp/src/main/java/org/geoserver/geofence/StartupService.java new file mode 100644 index 00000000..f0646c08 --- /dev/null +++ b/src/web/webapp/src/main/java/org/geoserver/geofence/StartupService.java @@ -0,0 +1,47 @@ +/* (c) 2014 - 2017 Open Source Geospatial Foundation - all rights reserved + * This code is licensed under the GPL 2.0 license, available at the root + * application directory. + */ + +package org.geoserver.geofence; + +import org.geoserver.geofence.core.model.GFUser; +import org.geoserver.geofence.login.util.MD5Util; +import org.geoserver.geofence.services.GFUserAdminServiceImpl; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * The Class StartupService. + */ +public class StartupService implements InitializingBean +{ + private static final Logger LOGGER = LogManager.getLogger(StartupService.class); + + @Autowired + GFUserAdminServiceImpl gfUserAdminService; + + + public void afterPropertiesSet() throws Exception { + long cnt = gfUserAdminService.getCount(null); + if(cnt == 0) { + LOGGER.warn("No GF users found. Creating the default admin."); + + GFUser user = new GFUser(); + user.setFullName("Default admin"); + user.setName("admin"); + user.setPassword(MD5Util.getHash("geofence")); + user.setEnabled(Boolean.TRUE); + gfUserAdminService.insert(user); + } + } + + public void setGfUserAdminService(GFUserAdminServiceImpl gfUserAdminService) { + this.gfUserAdminService = gfUserAdminService; + } +} diff --git a/src/web/webapp/src/main/resources/applicationContext-Service.xml b/src/web/webapp/src/main/resources/applicationContext-Service.xml new file mode 100644 index 00000000..48fc3ffb --- /dev/null +++ b/src/web/webapp/src/main/resources/applicationContext-Service.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/web/webapp/src/main/resources/applicationContext-client.xml b/src/web/webapp/src/main/resources/applicationContext-client.xml new file mode 100644 index 00000000..52806bcb --- /dev/null +++ b/src/web/webapp/src/main/resources/applicationContext-client.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + ${geofence-ovr} + + + + + + + + + + + + + + + + + + + + + + + + classpath*:geofence-datasource.properties + classpath:geofence-externalize-aux.properties + classpath*:geofence-global.properties + classpath*:geofence-ldap.properties + + + + + + + + + classpath*:geofence-global-ovr.properties + file:${geofence.dir}/geofence-global-ovr.properties + ${geofence-ovr} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties b/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties new file mode 100644 index 00000000..4f4fd8e4 --- /dev/null +++ b/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties @@ -0,0 +1,27 @@ +# (c) 2014 - 2017 Open Source Geospatial Foundation - all rights reserved +# This code is licensed under the GPL 2.0 license, available at the root +# application directory. + +################################################################################ +## These are default values, please DO NOT modify this file. +## If you need to customise these values, please create a new property file +## outside the webapp dir, and put into the system var "-Dgeofence-ovr" the +## path of your file. +## +## Take as example the file geofence-datasource-ovr.properties.sample which also +## contains some info about each setting. +################################################################################ + +geofenceVendorAdapter.databasePlatform=org.hibernatespatial.geodb.GeoDBDialect +geofenceDataSource.driverClassName=org.h2.Driver +geofenceDataSource.url=jdbc:h2:geofence_db/geofence +geofenceDataSource.username=sa +geofenceDataSource.password=sa +geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=public + +geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=update +geofenceEntityManagerFactory.jpaPropertyMap[javax.persistence.validation.mode]=none +geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.apply_to_ddl]=false +geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.autoregister_listeners]=false + +### END ######################################################################## diff --git a/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties.sample b/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties.sample new file mode 100644 index 00000000..1c822172 --- /dev/null +++ b/src/web/webapp/src/main/resources/geofence-datasource-ovr.properties.sample @@ -0,0 +1,108 @@ +################################################################################ +## GeoFence property override file +## +################################################################################ +## If you need more info about this file, please check the doc about +## Spring's PropertyOverrideConfigurer +################################################################################ + +################################################################################ +## Override DB connection parameters + +################################################################################ +## When customizing the backend DBMS, make sure you have in your classpath both +## the proper JDBC driver jar and the hibernate dialect. +## Also make sure to only have one dialect jar in your classpath. + +#geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect +#geofenceDataSource.driverClassName=org.postgresql.Driver +#geofenceDataSource.url=jdbc:postgresql://localhost:5432/geofence +#geofenceDataSource.username=geofence_test +#geofenceDataSource.password=geofence_test +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geofence_test + + +################################################################################ +## Other setup entries +################################################################################ +## hbm2ddl.auto may assume one of these values: +## - validate: validates the DB schema at startup against the internal model. May fail on oracle spatial. +## - update: updates the schema, according to the internal model. Updating automatically the production DB is dangerous. +## - create-drop: drop the existing schema and recreates it according to the internal model. REALLY DANGEROUS, YOU WILL LOSE YOUR DATA. +## You may want not to redefine the property entirely, in order to leave the defult value (no action). + +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate +#geofenceEntityManagerFactory.jpaPropertyMap[javax.persistence.validation.mode]=none +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.apply_to_ddl]=false +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.validator.autoregister_listeners]=false + +## +## ShowSQL is set to true in the configuration file; putting showsql=false in +## this file, you can easily check that this override file has been properly applied. + +# geofenceVendorAdapter.generateDdl=false +# geofenceVendorAdapter.showSql=false + +################################################################################ +## Disable second level cache. +## This is needed in a geofence-clustered environment. + +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.cache.use_second_level_cache]=false + +################################################################################ +## Use external ehcache configuration file. +## Useful to change cache settings, for example diskStore path. +#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.cache.provider_configuration_file_resource_path]=file:/path/to/geofence-ehcache-override.xml + + +################################################################################ +## Configure map base layer + +#geofenceGlobalConfiguration.baseLayerURL=http://vmap0.tiles.osgeo.org/wms/vmap0 +#geofenceGlobalConfiguration.baseLayerName=Vmap0 +#geofenceGlobalConfiguration.baseLayerTitle=OSGeo base map +#geofenceGlobalConfiguration.baseLayerFormat=image/png +#geofenceGlobalConfiguration.baseLayerStyle= +#geofenceGlobalConfiguration.mapCenterLon=0 +#geofenceGlobalConfiguration.mapCenterLat=0 +#geofenceGlobalConfiguration.mapZoom=2 + +################################################################################ +## LDAP + +##### Switch the DAOs from DB to LDAP +#geofence_dao_registry.selectedType = LDAP + +##### LDAP directory connection params +#geofenceLdapSource.url = ldap://10.10.100.4:11389 +#geofenceLdapSource.base = dc=comune,dc=intranet +#geofenceLdapSource.userDn = cn=queryuser,ou=OU2,ou=OU1,dc=comune,dc=intranet +#geofenceLdapSource.password = secret + +##### Max number of records retrieved +#geofenceLdapTemplate.defaultCountLimit = 100 + +##### User filters +### Base LDAP tree node for users +#gsUserDAO_LDAP.searchBase = ou=Users,ou=OU2,ou=OU1 +### Filter used to get all users +#gsUserDAO_LDAP.searchFilter = objectClass=user + +##### Group filters +## Base LDAP tree node for groups +#userGroupDAO_LDAP.searchBase = OU=Groups,OU=OU3 +## Filter used to get all groups +#userGroupDAO_LDAP.searchFilter = objectClass=group + +##### Mapping LDAP user attributes to internal +#geofenceLdapUserMapper.map[id] = distinguishedName +#geofenceLdapUserMapper.map[username] = cn +#geofenceLdapUserMapper.map[email] = mail +#geofenceLdapUserMapper.map[name] = givenName +#geofenceLdapUserMapper.map[surname] = sn +#geofenceLdapUserMapper.map[password] = + +##### Mapping LDAP group attributes to internal +#geofenceLdapGroupMapper.map[id] = distinguishedName +#geofenceLdapGroupMapper.map[groupname] = cn +#geofenceLdapGroupMapper.map[member] = member diff --git a/src/web/webapp/src/main/resources/geofence-datasource.properties b/src/web/webapp/src/main/resources/geofence-datasource.properties new file mode 100644 index 00000000..5b0e4b9c --- /dev/null +++ b/src/web/webapp/src/main/resources/geofence-datasource.properties @@ -0,0 +1,5 @@ +# /* (c) 2014 Open Source Geospatial Foundation - all rights reserved +# * This code is licensed under the GPL 2.0 license, available at the root +# * application directory. +# */ +# diff --git a/src/web/webapp/src/main/resources/log4j.xml b/src/web/webapp/src/main/resources/log4j.xml new file mode 100644 index 00000000..40608286 --- /dev/null +++ b/src/web/webapp/src/main/resources/log4j.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/web/webapp/src/main/webapp/WEB-INF/dispatcher-servlet.xml b/src/web/webapp/src/main/webapp/WEB-INF/dispatcher-servlet.xml new file mode 100644 index 00000000..516ea674 --- /dev/null +++ b/src/web/webapp/src/main/webapp/WEB-INF/dispatcher-servlet.xml @@ -0,0 +1,10 @@ + + + diff --git a/src/web/webapp/src/main/webapp/WEB-INF/remoting-servlet.xml b/src/web/webapp/src/main/webapp/WEB-INF/remoting-servlet.xml new file mode 100644 index 00000000..22a00b2c --- /dev/null +++ b/src/web/webapp/src/main/webapp/WEB-INF/remoting-servlet.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + diff --git a/src/web/webapp/src/main/webapp/WEB-INF/web.xml b/src/web/webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..0749887a --- /dev/null +++ b/src/web/webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,80 @@ + + + + + + contextConfigLocation + + classpath*:/applicationContext-common.xml + classpath:applicationContext-client.xml + classpath*:applicationContext.xml + + + + + + log4jConfiguration + log4j.xml + + + + log4jExposeWebAppRoot + false + + + + org.springframework.web.util.Log4jConfigListener + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + + + + + + + dispatcher + org.springframework.web.servlet.DispatcherServlet + 1 + + + + + CXFServlet + org.apache.cxf.transport.servlet.CXFServlet + + + + CXFServlet + /rest/* + + + + + remoting + org.springframework.web.servlet.DispatcherServlet + 1 + + + + remoting + /remoting/* + + +