Skip to content

Commit

Permalink
Creating Alfresco 5 Compatibility Branch
Browse files Browse the repository at this point in the history
This branch contains latests patches over Alfresco 5 compatible release
  • Loading branch information
angelborroy-ks committed Nov 14, 2018
1 parent 669ee4f commit 321bf2e
Show file tree
Hide file tree
Showing 150 changed files with 130 additions and 193 deletions.
Empty file modified Alfresco-ESign-Cert-OOTB-addon-review.md
100644 → 100755
Empty file.
Empty file modified LICENSE.md
100644 → 100755
Empty file.
14 changes: 5 additions & 9 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,10 @@ This module uses a software digital certificate or a cryptographic hardware supp
The plugin is licensed under the [LGPL v3.0](http://www.gnu.org/licenses/lgpl-3.0.html).

**State**
Current addon release 1.8.2 is ***PROD***
Current addon release 1.6.2 is ***PROD***

**Compatibility**
The current version has been developed using Alfresco 5.0.d and Alfresco SDK 2.1.1, although it runs in Alfresco 5.1.x

* Use 1.7.1 for Alfresco 201707 (aka Alfresco 5.2)

* Use 1.8.0+ for Alfresco 201806 (aka Alfresco 6.0)
The current version has been developed using Alfresco 5.0.d and Alfresco SDK 2.1.1, although it runs in Alfresco 5.1.x

Browser compatibility: 100% supported (refer previous paragraph)

Expand All @@ -88,8 +84,8 @@ Downloading the ready-to-deploy-plugin
--------------------------------------
The binary distribution is made of two amp files:

* [repo AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.8.2/esign-cert-repo.amp)
* [share AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.8.2/esign-cert-share.amp)
* [repo AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.6.2/esign-cert-repo.amp)
* [share AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.6.2/esign-cert-share.amp)

You can install them by using standard [Alfresco deployment tools](http://docs.alfresco.com/community/tasks/amp-install.html)

Expand Down Expand Up @@ -271,4 +267,4 @@ Pending features to be included (aka "wishlist"):
* [Alberto Ramírez Losilla](https://www.linkedin.com/in/alramlo/)
* Mikel Asla
* Maria Tsiakmaki
* [Sergio Campoy](https://es.linkedin.com/in/sergio-campoy-arnau-79697568)
* [Sergio Campoy](https://es.linkedin.com/in/sergio-campoy-arnau-79697568)
Empty file modified esign-cert-ng2/.angular-cli.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/.editorconfig
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/.gitignore
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions esign-cert-ng2/.vscode/settings.json

This file was deleted.

Empty file modified esign-cert-ng2/README.md
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/e2e/app.e2e-spec.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/e2e/app.po.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/e2e/tsconfig.e2e.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/karma.conf.js
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/ng-package.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/package-lock.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/package.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/protractor.conf.js
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/public_api.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/app.component.css
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/app.component.html
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/app.component.spec.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/app.component.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/app.module.ts
100644 → 100755
Empty file.
Empty file.
Empty file modified esign-cert-ng2/src/app/modules/signature/signature.component.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/modules/signature/signature.model.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/modules/signature/signature.module.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/app/modules/signature/signature.service.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/assets/.gitkeep
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/environments/environment.prod.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/environments/environment.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/favicon.ico
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/index.html
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/main.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/polyfills.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/styles.css
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/test.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/tsconfig.app.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/tsconfig.spec.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/src/typings.d.ts
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/tsconfig.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/tslint.json
100644 → 100755
Empty file.
Empty file modified esign-cert-ng2/yarn.lock
100644 → 100755
Empty file.
91 changes: 44 additions & 47 deletions esign-cert-repo/pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,66 @@
<modelVersion>4.0.0</modelVersion>
<groupId>es.keensoft.alfresco</groupId>
<artifactId>esign-cert-repo</artifactId>
<version>1.8.2</version>
<version>1.7.2</version>
<name>esign-cert-repo Repository AMP project</name>
<packaging>amp</packaging>
<description>Manages the lifecycle of the esign-cert-repo Repository AMP (Alfresco Module Package)</description>

<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-parent</artifactId>
<version>2.1.1</version>
</parent>

<!--
SDK properties have sensible defaults in the SDK parent,
but you can override the properties below to use another version.
For more available properties see the alfresco-sdk-parent POM.
-->
<properties>
<app.amp.output.folder>${project.build.directory}/${project.artifactId}-${project.version}</app.amp.output.folder>
<!-- Compile with Java 7, default is 5 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<!-- The following are default values for data location and Alfresco Community version.
Uncomment if you need to change (Note. current default version for Enterprise edition is 5.0.1)
<alfresco.version>5.0.d</alfresco.version>
<alfresco.data.location>/absolute/path/to/alf_data_dev</alfresco.data.location> -->

<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
<app.log.root.level>WARN</app.log.root.level>
-->

<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
<env>local</env>
-->
</properties>

<!-- Here we realize the connection with the Alfresco selected platform
(e.g.version and edition) -->
<dependencyManagement>
<dependencies>
<!-- Setup what versions of the different Alfresco artifacts that will be used (depends on alfresco.version),
so we don't have to specify version in any of the dependency definitions in our POM.
For more info see:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies
-->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<!-- Following dependencies are needed for compiling Java code in src/main/java;
<scope>provided</scope> is inherited for each of the following;
for more info, please refer to alfresco-platform-distribution POM -->
<dependency>
<groupId>org.alfresco</groupId>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
<version>6.37</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-remote-api</artifactId>
<version>6.23</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

<!-- Google JSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
Expand All @@ -59,28 +79,13 @@
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
<version>5.1.3</version>
</dependency>

</dependencies>

<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/amp</directory>
<filtering>true</filtering>
<targetPath>${app.amp.output.folder}</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>2.1.1</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>

<profiles>
Expand Down Expand Up @@ -133,12 +138,4 @@
</dependencies>
</profile> -->
</profiles>

<repositories>
<repository>
<id>alfresco-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
</repositories>

</project>
Empty file modified esign-cert-repo/run.bat
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified esign-cert-repo/src/main/amp/module.properties
100644 → 100755
Empty file.
Empty file.
21 changes: 9 additions & 12 deletions esign-cert-repo/src/main/java/es/alfatec/alfresco/AlfatecSignUtils.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.SignatureException;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
Expand All @@ -30,9 +31,9 @@

import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.PdfPKCS7;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.security.PdfPKCS7;

import es.alfatec.alfresco.webscripts.bean.PrintSignatureInformation;
import es.keensoft.alfresco.model.SignModel;
Expand Down Expand Up @@ -83,7 +84,7 @@ public AcroFields getDocumentAcroFields(NodeRef document) throws IOException {
return acroFields;
}

public boolean isSignOk(NodeRef document) throws IOException, AlfatecException{
public boolean isSignOk(NodeRef document) throws IOException, AlfatecException, SignatureException{
String documentName = (String)nodeService.getProperty(document, ContentModel.PROP_NAME);

boolean isDocumentSigned = isDocumentSigned(document);
Expand All @@ -99,16 +100,12 @@ public boolean isSignOk(NodeRef document) throws IOException, AlfatecException{
}
PdfPKCS7 pk = acroFields.verifySignature(name);

try {
if (pk.verify()){
return true;
}
else{
logger.warn("Sign is not valid on document "+documentName);
return false;
}
} catch (Exception e) {
throw new AlfatecException(e.getMessage(), HttpServletResponse.SC_CONFLICT);
if (pk.verify()){
return true;
}
else{
logger.warn("Sign is not valid on document "+documentName);
return false;
}
}
return false;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.security.SignatureException;
import java.util.List;

import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void execute(WebScriptRequest request, WebScriptResponse response) throws
}catch(AlfatecException exception){
response.setStatus(exception.getResultCode());
response.getWriter().write(exception.getExceptionMessage());
}catch(IOException | DocumentException exception){
}catch(IOException | DocumentException | SignatureException exception){
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write("Opps... There was an uncontrolled error. Please contact with your support team.");
}finally{
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.IOException;
import java.security.SignatureException;

import javax.servlet.http.HttpServletResponse;

Expand Down Expand Up @@ -50,7 +51,7 @@ public void execute(WebScriptRequest request, WebScriptResponse response) throws
}catch(AlfatecException exception){
response.setStatus(exception.getResultCode());
response.getWriter().write(exception.getExceptionMessage());
}catch(IOException exception){
}catch(IOException | SignatureException exception){
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write("Opps... There was an uncontrolled error. Please contact with your support team.");
}finally{
Expand Down
3 changes: 2 additions & 1 deletion esign-cert-repo/src/main/java/es/alfatec/alfresco/webscripts/SignatureReportInfo.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.IOException;
import java.security.SignatureException;

import javax.servlet.http.HttpServletResponse;

Expand Down Expand Up @@ -59,7 +60,7 @@ public void execute(WebScriptRequest request, WebScriptResponse response) throws
}catch(AlfatecException exception){
response.setStatus(exception.getResultCode());
response.getWriter().write(exception.getExceptionMessage());
}catch(IOException exception){
}catch(IOException | SignatureException exception){
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write("Opps... There was an uncontrolled error. Please contact with your support team.");
}finally{
Expand Down
Empty file.
Empty file.
Empty file.
Loading

0 comments on commit 321bf2e

Please sign in to comment.