Commit 4b4f3e2f authored by cdanger's avatar cdanger

- Fixed #29

- Updated license headers
- Upgraded dependency authzforce-ce-jaxrs-utils: 1.3.1
- README refactoring
parent 7be03b6a
......@@ -40,14 +40,15 @@ applications, AuthzForce also provides a PDP engine as a Java library in
- [Features](#features)
- [Limitations](#limitations)
- [Quality Assurance](#quality-assurance)
- [Install](#install)
- [Documentation](#documentation)
- [Training Courses](#training-courses)
- [Usage](#usage)
- [Testing](#testing)
- [Support](#support)
- [Security](#security---vulnerability-reporting)
- [Security](#security-vulnerability-reporting)
- [Contributing](#contributing)
- [Testing](#testing)
- [Quality Assurance](#quality-assurance)
- [License](#license)
## Features
......@@ -173,7 +174,26 @@ are not supported:
`urn:oasis:names:tc:xacml:3.0:function:access-permitted`;
- [Algorithms planned for future deprecation](http://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html#_Toc325047257).
If you are interested in those, you can ask for [support](#Support).
If you are interested in those, you can ask for [support](#support).
## Quality Assurance
This project is part of [FIWARE](https://fiware.org/) and has been rated as
follows:
- **Version Tested:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Version&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.version&colorB=blue)
- **Documentation:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Completeness&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.docCompleteness&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Usability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.docSoundness&colorB=blue)
- **Responsiveness:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Time%20to%20Respond&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.timeToCharge&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Time%20to%20Fix&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.timeToFix&colorB=blue)
- **FIWARE Testing:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Tests%20Passed&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.failureRate&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Scalability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.scalability&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Performance&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.performance&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Stability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.stability&colorB=blue)
## Install
......@@ -193,6 +213,17 @@ Once you downloaded the distribution of your preference, check the [documentatio
For links to the documentation of a release, please go to the specific
[release page](https://github.com/authzforce/server/releases).
## Training Courses
### Academy Courses
- [AuthzForce](https://fiware-academy.readthedocs.io/en/latest/security/authzforce/)
### Tutorials
The following tutorials on **AuthzForce Server** are available:
- 405. [Identity Management - XACML Rule-based Permissions](https://fiware-tutorials.readthedocs.io/en/latest/xacml-access-rules/).
- 406. [Identity Management - Administrating XACML Rules](https://fiware-tutorials.readthedocs.io/en/latest/administrating-xacml/);
## Usage
This section gives examples of usage and PEP code with a web service authorization module.
......@@ -218,6 +249,15 @@ forwards the request to the web service implementation if the decision is
Permit, else rejects it. For more information, see the Javadoc of
[RESTfulPdpBasedAuthzInterceptorTest](webapp/src/test/java/org/ow2/authzforce/webapp/test/pep/cxf/RESTfulPdpBasedAuthzInterceptorTest.java).
## Testing
To run unit tests, install Maven and type
```console
mvn test
```
## Support
You should use
......@@ -290,35 +330,6 @@ The sources for the manuals are located in
11. Create a release on Github with a description based on the
[release description template](release.description.tmpl.md), replacing M/m/P
with the new major/minor/patch versions.
# Testing
To run unit tests, install Maven and type
```console
mvn test
```
## Quality Assurance
This project is part of [FIWARE](https://fiware.org/) and has been rated as
follows:
- **Version Tested:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Version&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.version&colorB=blue)
- **Documentation:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Completeness&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.docCompleteness&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Usability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.docSoundness&colorB=blue)
- **Responsiveness:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Time%20to%20Respond&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.timeToCharge&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Time%20to%20Fix&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.timeToFix&colorB=blue)
- **FIWARE Testing:**
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Tests%20Passed&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.failureRate&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Scalability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.scalability&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Performance&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.performance&colorB=blue)
![ ](https://img.shields.io/badge/dynamic/json.svg?label=Stability&url=https://fiware.github.io/catalogue/json/authzforce.json&query=$.stability&colorB=blue)
---
## License
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-server</artifactId>
<version>8.0.2-SNAPSHOT</version>
<version>8.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>authzforce-ce-server-dist</artifactId>
......
......@@ -39,7 +39,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Djavax.xml.accessExternalSchema=http -Xms1024m -Xmx1024m -XX:+UseConcMarkSweepGC -server"
ENV AUTHZFORCE_SERVER_VERSION="8.0.2-SNAPSHOT"
ENV AUTHZFORCE_SERVER_VERSION="8.1.0-SNAPSHOT"
ENV AUTHZFORCE_SERVER_DOWNLOAD_URL="http://repo1.maven.org/maven2/org/ow2/authzforce/authzforce-ce-server-dist/$AUTHZFORCE_SERVER_VERSION/authzforce-ce-server-dist-$AUTHZFORCE_SERVER_VERSION.deb"
# Download and install Authzforce Server (service starts automatically)
......
......@@ -4,24 +4,24 @@
<parent>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-parent</artifactId>
<version>7.3.0</version>
<version>7.5.1</version>
</parent>
<artifactId>authzforce-ce-server</artifactId>
<!-- FIWARE Versioning + Version must be equal or higher than 'authzforce-ce-rest-api-model' dependency in 'rest-service' module -->
<version>8.0.2-SNAPSHOT</version>
<version>8.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>AuthzForce CE Server</description>
<url>${project.url}</url>
<properties>
<git.url.base>https://github.com/authzforce/server</git.url.base>
<authzforce-ce-core.version>13.2.0</authzforce-ce-core.version>
<authzforce-ce-core-pap-api.version>9.2.0</authzforce-ce-core-pap-api.version>
<authzforce-ce-core.version>13.3.1</authzforce-ce-core.version>
<authzforce-ce-core-pap-api.version>10.0.0</authzforce-ce-core-pap-api.version>
<!-- Version must be compatible with authzforce-ce-core and authzforce-ce-core-pap-api versions above. -->
<authzforce-ce-pap-dao-flat-file.version>10.0.0</authzforce-ce-pap-dao-flat-file.version>
<authzforce-ce-pap-dao-flat-file.version>11.0.0</authzforce-ce-pap-dao-flat-file.version>
<productId>authzforce-ce-server</productId>
<productName>AuthzForce CE Server</productName>
<productMaintainer>Thales Services SAS</productMaintainer>
<productMaintainer>THALES</productMaintainer>
</properties>
<scm>
<connection>scm:git:${git.url.base}.git</connection>
......@@ -40,17 +40,17 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${artifactId.prefix}-core-pdp-testutils</artifactId>
<artifactId>authzforce-ce-core-pdp-testutils</artifactId>
<version>${authzforce-ce-core.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${artifactId.prefix}-core-pap-api</artifactId>
<artifactId>authzforce-ce-core-pap-api</artifactId>
<version>${authzforce-ce-core-pap-api.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${artifactId.prefix}-pap-dao-flat-file</artifactId>
<artifactId>authzforce-ce-pap-dao-flat-file</artifactId>
<version>${authzforce-ce-pap-dao-flat-file.version}</version>
</dependency>
<dependency>
......
......@@ -4,7 +4,7 @@
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-server</artifactId>
<!-- Version must be equal or higher than authzforce-ce-rest-api-model dependency -->
<version>8.0.2-SNAPSHOT</version>
<version>8.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>authzforce-ce-server-rest-service</artifactId>
......@@ -39,7 +39,7 @@
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-jaxrs-utils</artifactId>
<version>1.2.0</version>
<version>1.3.1</version>
</dependency>
</dependencies>
<build>
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......@@ -38,10 +38,6 @@ import javax.ws.rs.core.Response.Status;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Request;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Response;
import org.json.JSONObject;
import org.ow2.authzforce.core.pap.api.dao.DomainDao;
import org.ow2.authzforce.core.pap.api.dao.DomainDaoClient;
......@@ -52,7 +48,6 @@ import org.ow2.authzforce.core.pap.api.dao.ReadableDomainProperties;
import org.ow2.authzforce.core.pap.api.dao.ReadablePdpProperties;
import org.ow2.authzforce.core.pap.api.dao.TooManyPoliciesException;
import org.ow2.authzforce.core.pap.api.dao.WritablePdpProperties;
import org.ow2.authzforce.core.pdp.api.io.PdpEngineInoutAdapter;
import org.ow2.authzforce.rest.api.jaxrs.AttributeProvidersResource;
import org.ow2.authzforce.rest.api.jaxrs.DomainPropertiesResource;
import org.ow2.authzforce.rest.api.jaxrs.DomainResource;
......@@ -79,6 +74,10 @@ import org.w3._2005.atom.Relation;
import com.google.common.escape.Escaper;
import com.google.common.net.UrlEscapers;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Request;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Response;
/**
* Domain Resource implementation. Each domain managed by {@link DomainsResourceImpl} is an instance of this class.
*
......@@ -86,16 +85,14 @@ import com.google.common.net.UrlEscapers;
* Domain DAO implementation class
*
*/
public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl, PolicyResourceImpl>> implements DomainDaoClient<DAO>, DomainResource, DomainPropertiesResource, PapResource,
PdpResource, PoliciesResource, AttributeProvidersResource, PdpPropertiesResource, PrpPropertiesResource
public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl, PolicyResourceImpl>>
implements DomainDaoClient<DAO>, DomainResource, DomainPropertiesResource, PapResource, PdpResource, PoliciesResource, AttributeProvidersResource, PdpPropertiesResource, PrpPropertiesResource
{
/**
* Escapes strings so they can be safely included in URL path segments
*/
public static final Escaper URL_PATH_SEGMENT_ESCAPER = UrlEscapers.urlPathSegmentEscaper();
private static final InternalServerErrorException NULL_PDP_INTERNAL_SERVER_ERROR_EXCEPTION = new InternalServerErrorException(
"PDP is in erroneous state. Please contact the domain or system administrator.");
private static final ClientErrorException ADD_POLICY_CONFLICT_EXCEPTION = new ClientErrorException("PolicySet already exists with same PolicySetId and Version", Status.CONFLICT);
private static final NotFoundException NOT_FOUND_EXCEPTION = new NotFoundException();
private static final BadRequestException INVALID_ARG_BAD_REQUEST_EXCEPTION = new BadRequestException("Invalid argument");
......@@ -131,14 +128,14 @@ public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl,
*
*
*/
public static class Factory<DOMAIN_DAO extends DomainDao<PolicyVersionResourceImpl, PolicyResourceImpl>> implements
DomainDaoClient.Factory<PolicyVersionResourceImpl, PolicyResourceImpl, DOMAIN_DAO, DomainResourceImpl<DOMAIN_DAO>>
public static class Factory<DOMAIN_DAO extends DomainDao<PolicyVersionResourceImpl, PolicyResourceImpl>>
implements DomainDaoClient.Factory<PolicyVersionResourceImpl, PolicyResourceImpl, DOMAIN_DAO, DomainResourceImpl<DOMAIN_DAO>>
{
private static final IllegalArgumentException ILLEGAL_DOMAIN_ID_ARGUMENT_EXCEPTION = new IllegalArgumentException("Domain ID for domain resource undefined");
private static final IllegalArgumentException ILLEGAL_DOMAIN_DAO_ARGUMENT_EXCEPTION = new IllegalArgumentException("Domain DAO for domain resource undefined");
@Override
public DomainResourceImpl<DOMAIN_DAO> getInstance(final String domainId, final DOMAIN_DAO domainDAO)
public DomainResourceImpl<DOMAIN_DAO> getInstance(final String domainId, final Builder<DOMAIN_DAO> domainDAO) throws IOException
{
if (domainId == null)
{
......@@ -164,11 +161,11 @@ public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl,
private final String domainId;
private final DAO domainDAO;
private DomainResourceImpl(final String domainId, final DAO domainDAO)
private DomainResourceImpl(final String domainId, final Builder<DAO> domainDaoBuilder) throws IOException
{
assert domainDAO != null;
assert domainDaoBuilder != null;
this.domainId = domainId;
this.domainDAO = domainDAO;
this.domainDAO = domainDaoBuilder.build();
}
@Override
......@@ -296,25 +293,13 @@ public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl,
@Override
public Response requestPolicyDecision(final Request request)
{
final PdpEngineInoutAdapter<Request, Response> pdp = domainDAO.getXacmlJaxbPdp();
if (pdp == null)
{
throw NULL_PDP_INTERNAL_SERVER_ERROR_EXCEPTION;
}
return pdp.evaluate(request);
return domainDAO.evaluatePolicyDecision(request);
}
@Override
public JSONObject requestPolicyDecisionXacmlJson(final JSONObject request)
{
final PdpEngineInoutAdapter<JSONObject, JSONObject> pdp = domainDAO.getXacmlJsonPdp();
if (pdp == null)
{
throw NULL_PDP_INTERNAL_SERVER_ERROR_EXCEPTION;
}
return pdp.evaluate(request);
return domainDAO.evaluatePolicyDecision(request);
}
@Override
......@@ -626,7 +611,7 @@ public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl,
features.add(new Feature(pdpFeature.getId(), pdpFeature.getType(), pdpFeature.isEnabled()));
}
return new PdpProperties(features, props.getRootPolicyRefExpression(), new ApplicablePolicies(props.getApplicableRootPolicyRef(), props.getApplicableRefPolicyRefs()),
XML_DATATYPE_FACTORY.newXMLGregorianCalendar(cal));
XML_DATATYPE_FACTORY.newXMLGregorianCalendar(cal));
}
@Override
......@@ -662,7 +647,7 @@ public class DomainResourceImpl<DAO extends DomainDao<PolicyVersionResourceImpl,
allFeatures.add(new Feature(pdpFeature.getId(), pdpFeature.getType(), pdpFeature.isEnabled()));
}
return new PdpProperties(allFeatures, allProps.getRootPolicyRefExpression(), new ApplicablePolicies(allProps.getApplicableRootPolicyRef(), allProps.getApplicableRefPolicyRefs()),
XML_DATATYPE_FACTORY.newXMLGregorianCalendar(cal));
XML_DATATYPE_FACTORY.newXMLGregorianCalendar(cal));
}
@Override
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
#
# Copyright (C) 2012-2018 Thales Services SAS.
# Copyright (C) 2012-2019 THALES.
#
# This file is part of AuthzForce CE.
#
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-server</artifactId>
<version>8.0.2-SNAPSHOT</version>
<version>8.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>authzforce-ce-server-upgrader</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-server</artifactId>
<version>8.0.2-SNAPSHOT</version>
<version>8.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>authzforce-ce-server-webapp</artifactId>
......@@ -94,8 +94,8 @@
<artifactId>cxf-rt-rs-service-description</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${artifactId.prefix}-pap-dao-flat-file</artifactId>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-pap-dao-flat-file</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
......@@ -165,6 +165,12 @@
<version>${cxf.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-logging</artifactId>
<version>${cxf.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......@@ -31,12 +31,6 @@ import java.util.Iterator;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import org.ow2.authzforce.rest.api.jaxrs.DomainResource;
import org.ow2.authzforce.rest.api.xmlns.DomainProperties;
import org.slf4j.Logger;
......@@ -50,6 +44,8 @@ import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import org.w3._2005.atom.Link;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
/**
* Tests specific to the special 'superadmin' domain for managing and enforcing the AuthzForce REST API access policy (controls access to all the REST API itself including all domains). For example,
* the admin policy may have a rule/policy such that only the Domain_Admin of domain X (contextualized role) is allowed to do all actions on path '/domains/X' or '/domains/X/*' except DELETE
......@@ -59,18 +55,7 @@ public class AdminDomainTest extends RestServiceTest
{
private static final Logger LOGGER = LoggerFactory.getLogger(AdminDomainTest.class);
private static final FileFilter DIRECTORY_FILTER = new FileFilter()
{
@Override
public boolean accept(final File pathname)
{
return pathname.isDirectory();
}
};
private WebClient httpHeadClient;
private static final FileFilter DIRECTORY_FILTER = pathname -> pathname.isDirectory();
private DomainAPIHelper testDomainHelper = null;
......@@ -93,7 +78,7 @@ public class AdminDomainTest extends RestServiceTest
@Parameters({ "remote.base.url", "enableFastInfoset", "enableDoSMitigation", "org.ow2.authzforce.domains.sync.interval", "enablePdpOnly" })
@BeforeTest()
public void beforeTest(@Optional final String remoteAppBaseUrl, @Optional("false") final boolean enableFastInfoset, @Optional("true") final boolean enableDoSMitigation,
@Optional("-1") final int domainSyncIntervalSec, @Optional("false") final boolean enablePdpOnly) throws Exception
@Optional("-1") final int domainSyncIntervalSec, @Optional("false") final boolean enablePdpOnly) throws Exception
{
startServerAndInitCLient(remoteAppBaseUrl, enableFastInfoset ? ClientType.FAST_INFOSET : ClientType.XML, enableDoSMitigation, domainSyncIntervalSec, enablePdpOnly);
}
......@@ -131,16 +116,6 @@ public class AdminDomainTest extends RestServiceTest
assertNotNull(testDomain, String.format("Error retrieving (admin) domain ID=%s", testDomainId));
this.testDomainHelper = new DomainAPIHelper(testDomainId, testDomain, unmarshaller, pdpModelHandler);
final ClientConfiguration apiProxyClientConf = WebClient.getConfig(domainsAPIProxyClient);
final String appBaseUrl = apiProxyClientConf.getEndpoint().getEndpointInfo().getAddress();
httpHeadClient = WebClient.create(appBaseUrl, true);
if (LOGGER.isDebugEnabled())
{
final ClientConfiguration builderConf = WebClient.getConfig(httpHeadClient);
builderConf.getInInterceptors().add(new LoggingInInterceptor());
builderConf.getOutInterceptors().add(new LoggingOutInterceptor());
}
assertNotNull(testDomain, String.format("Error retrieving domain ID=%s", testDomainId));
}
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......
/**
* Copyright (C) 2012-2018 Thales Services SAS.
* Copyright (C) 2012-2019 THALES.
*
* This file is part of AuthzForce CE.
*
......@@ -31,6 +31,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicBoolean;
......@@ -43,20 +44,16 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.validation.Schema;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Target;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.startup.Tomcat;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.apache.cxf.feature.Feature;
import org.apache.cxf.interceptor.FIStaxInInterceptor;
import org.apache.cxf.interceptor.FIStaxOutInterceptor;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
......@@ -65,7 +62,7 @@ import org.apache.cxf.jaxrs.utils.schemas.SchemaHandler;
import org.apache.tomcat.util.descriptor.web.ContextEnvironment;
import org.apache.tomcat.util.descriptor.web.NamingResources;
import org.ow2.authzforce.core.pdp.impl.PdpModelHandler;
import org.ow2.authzforce.core.pdp.testutil.ext.xmlns.TestAttributeProvider;
import org.ow2.authzforce.core.pdp.testutil.ext.xmlns.TestAttributeProviderDescriptor;
import org.ow2.authzforce.pap.dao.flatfile.FlatFileDAOUtils;
import org.ow2.authzforce.pap.dao.flatfile.xmlns.DomainProperties;
import org.ow2.authzforce.rest.api.jaxrs.DomainsResource;
......@@ -79,6 +76,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySet;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Target;
@ContextConfiguration(locations = { "classpath:META-INF/spring/client.xml" })
abstract class RestServiceTest extends AbstractTestNGSpringContextTests
{
......@@ -161,7 +162,7 @@ abstract class RestServiceTest extends AbstractTestNGSpringContextTests
{
try
{
JAXB_CTX = JAXBContext.newInstance(Resources.class, DomainProperties.class, TestAttributeProvider.class);
JAXB_CTX = JAXBContext.newInstance(Resources.class, DomainProperties.class, TestAttributeProviderDescriptor.class);
}
catch (final JAXBException e)
{
......@@ -256,7 +257,7 @@ abstract class RestServiceTest extends AbstractTestNGSpringContextTests
}
private static Tomcat startServer(final int port, final boolean enableFastInfoset, final boolean enableDoSMitigation, final int domainSyncIntervalSec, final boolean enablePdpOnly,
final boolean addSampleDomain) throws ServletException, IllegalArgumentException, IOException, LifecycleException
final boolean addSampleDomain) throws ServletException, IllegalArgumentException, IOException, LifecycleException
{
/*
* Make sure the domains directory exists and is empty
......@@ -353,7 +354,7 @@ abstract class RestServiceTest extends AbstractTestNGSpringContextTests
}
protected void startServerAndInitCLient(final String remoteAppBaseUrl, final ClientType clientType, final boolean enableDoSMitigation, final int domainSyncIntervalSec, final boolean enablePdpOnly)
throws Exception
throws Exception
{