Commit ddf393ca authored by Romain Ferrari's avatar Romain Ferrari

Adding audit log on evaluate method. Exporting sources to jar

parent b915f82c
......@@ -24,20 +24,20 @@
<copyrightOwner>Thales Services - ThereSIS</copyrightOwner>
<jdk.source>1.7</jdk.source>
<jdk.target>1.7</jdk.target>
<aspectj.version>1.7.4</aspectj.version>
<debug>false</debug>
</properties>
<dependencies>
<!-- Authzforce optionnal dependencies -->
<!-- <dependency> -->
<!-- <groupId>com.thalesgroup.authzforce</groupId> -->
<!-- <artifactId>authzforce-audit</artifactId> -->
<!-- <version>2.0.1</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.11</version>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
</dependency>
<!-- /Authzforce optionnal dependencies -->
<!-- Authzforce dependencies -->
<dependency>
<groupId>com.thalesgroup.authzforce.core</groupId>
......@@ -114,6 +114,34 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>${debug}</verbose>
<showWeaveInfo>${debug}</showWeaveInfo>
<outxml>${debug}</outxml>
<complianceLevel>${jdk.source}</complianceLevel>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
</configuration>
</plugin>
<!-- Maven compiler configuration -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
......@@ -125,6 +153,9 @@
<goal>testCompile</goal>
</goals>
<configuration>
<verbose>${debug}</verbose>
<showWeaveInfo>${debug}</showWeaveInfo>
<outxml>${debug}</outxml>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
</configuration>
......@@ -290,17 +321,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>default</id>
<phase>compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
......@@ -346,6 +366,22 @@
<catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>false</attach>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -124,7 +124,6 @@ public class AuditAspect {
// Used to display and clean the audit log pool
case DISPLAY:
LOGGER.info(AuditLogs.getInstance().toString());
System.out.println(AuditLogs.getInstance().toString());
break;
default:
LOGGER.error("Type unknown: " + annotation.type());
......
......@@ -358,7 +358,7 @@ public class PDP
// }
// for (Request Request : requests)
// {
ResponseCtx response = this.evaluate(requestList);
ResponseCtx response = this.evaluatePrivate(requestList);
responses.add(response);
}
}
......@@ -379,8 +379,15 @@ public class PDP
* the request to evaluate
*
* @return a response paired to the request
*
* @deprecated Use evaluateList instead
*/
public ResponseCtx evaluate(Request request)
@Audit(type = Audit.Type.DISPLAY)
public ResponseCtx evaluate(Request request) {
return evaluatePrivate(request);
}
private ResponseCtx evaluatePrivate(Request request)
{
String hash = "";
......
......@@ -21,6 +21,7 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.AnnotationIntrospector;
......@@ -56,10 +57,10 @@ public final class AuditLogs {
protected static volatile AuditLogs INSTANCE;
protected static HashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog> audits;
protected static ConcurrentHashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog> audits;
private AuditLogs() {
audits = new HashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog>();
audits = new ConcurrentHashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog>();
}
public synchronized static AuditLogs getInstance() {
......@@ -87,7 +88,7 @@ public final class AuditLogs {
public synchronized static void addAudit(
com.thalesgroup.authzforce.audit.schema.pdp.AuditLog audit) {
if (audits == null) {
audits = new HashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog>();
audits = new ConcurrentHashMap<String, com.thalesgroup.authzforce.audit.schema.pdp.AuditLog>();
}
try {
MessageDigest digest = MessageDigest.getInstance(HASH_ALG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment