Sample application

A sample Fortress client application is provided to help developers to integrate third-party apps with Viafirma Fortress. This basic web application shows how to use the main API services:

  • Retrieve user information (to check if it has active certificates and IDPs).
  • User authentication.
  • Authorization request to sign a document.
  • PAdES and XAdES signature.
  • Batch signature.

Source code

Prerequisites

Request credentials from the commercial department:

  • client_id. In this example it will be sample_app
  • client_secret. In this example it will be 12345

Quickstart

The sample application is based on Spring Boot and includes an embedded Tomcat server to simplify the execution.

  • The app can be imported in any IDE and execute com.viafirma.fortress.demo.FortressDemoApplication class.
  • Once imported, you must configure the credentials provided in the fortress-demo.properties file located in /src/main/resource, for example:
    fortress.demo.api.url=https://sandbox.viafirma.com/fortress/
    fortress.demo.api.client_id=sample_app
    fortress.demo.api.client_secret=12345
    
    Once set up, you will be able to:
    • Start the application with the command mvn spring-boot:run.
    • Compile the application with mvn clean package and deploy the WAR to a Tomcat container or run it directly:
java -jar target/viafirma-fortress-demo.war

Testing the application

Once the application has started, the main page is accesible in any web browser:

http://localhost:8080/fortress-demo/

it is also available in the sandbox environment:

https://sandbox.viafirma.com/fortress-demo/

Login screen

The first interface (login screen) is just used to get Fortress user code. Please enter a valid user code (for instance, 12345678Z) and any password (it will not be checked). If the user code does not exist, user will not be able to check authentication or digital signature with a centralized digital certificate.

Main screen

If the entered user has certificates / IDPs associated, authentication and signing buttons are enabled, with different options to sign documents: PDF (PAdES), XML (XAdES) or batch signature.

User authentication

Test user 12345678Z can be used, with PIN IDP 1234 and OTP (soft token) IDP based on Google Authenticator, scanning the attached QR Code:

OTP

results matching ""

    No results matching ""