Skip to content

Commit

Permalink
Merge pull request #189 from getyoti/release-2.8.0
Browse files Browse the repository at this point in the history
Release 2.8.0
  • Loading branch information
MrBurtyyy authored May 18, 2020
2 parents b0687fa + 27d8f5c commit 6e4fe69
Show file tree
Hide file tree
Showing 110 changed files with 2,940 additions and 72 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ The Modules above explained
1) [Spring Boot Auto Configuration](#spring-boot-auto-configuration) -
Description of utilising Spring Boot

1) [Running the Example](#running-the-example) -
Running the Spring example project
1) [Running the Examples](#running-the-examples) -
Running the Spring example projects

1) [Breaking changes and enhancements made in v2.0.0](#breaking-changes-and-enhancements-made-in-v2.0.0) -
Things you need to know when migrating from 1.x to 2.x
Expand Down Expand Up @@ -104,13 +104,13 @@ If you are using Maven, you need to add the following dependency:
<dependency>
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk-impl</artifactId>
<version>2.7.1</version>
<version>2.8.0</version>
</dependency>
```

If you are using Gradle, here is the dependency to add:

`compile group: 'com.yoti', name: 'yoti-sdk-impl', version: '2.7.1'`
`compile group: 'com.yoti', name: 'yoti-sdk-impl', version: '2.8.0'`

You will find all classes packaged under `com.yoti.api`

Expand Down Expand Up @@ -341,9 +341,12 @@ As a convenience, if your application happens to use Spring Boot, you can utilis

For more information and to see an example of this in use take a look at the [Spring Boot Auto Configuration module](/yoti-sdk-spring-boot-auto-config).

## Running the Example
## Running the Examples

Instructions on how to run the Spring example project can be found in the [yoti-sdk-spring-boot-example](/yoti-sdk-spring-boot-example) folder.
Instructions on how to run the Spring example projects can be found at the following:

1. [Yoti App](/yoti-sdk-spring-boot-example)
1. [Doc Scan](/examples/doc-scan)

## Breaking changes and enhancements made in v2.0.0

Expand Down
203 changes: 203 additions & 0 deletions examples/doc-scan/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@

# Created by https://www.gitignore.io/api/java,maven,intellij,eclipse,osx,linux,vim,windows

### Java ###
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties


### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*


### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

application.yml
*.pem
10 changes: 10 additions & 0 deletions examples/doc-scan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Doc Scan Example

## Running the example

1. Move into the Doc Scan example directory i.e. `cd examples/doc-scan`
1. Place the PEM file from Yoti Hub into `src/main/resources`
1. Rename the [application.yml.example](src/main/resources/application.yml.example) file to `application.yml` and fill in the required values (`sdkId` and `accessSecurityKey`)
1. Build the application with `mvn clean package`
1. Run the application from the root folder with `java -jar target/doc-scan-demo-1.0.0.jar`
1. Visit `https://localhost:8443`
72 changes: 72 additions & 0 deletions examples/doc-scan/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.yoti.docscan.demo</groupId>
<artifactId>doc-scan-demo</artifactId>
<version>1.0.0</version>
<name>doc-scan-demo</name>
<description>Example project using Java Doc Scan SDK</description>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk-impl</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.24.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Binary file added examples/doc-scan/server.keystore.jks
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.yoti.docscan.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DocScanDemoApplication {

public static void main(String[] args) {
SpringApplication.run(DocScanDemoApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.yoti.docscan.demo.config;

import com.yoti.api.client.ClassPathKeySource;
import com.yoti.api.client.KeyPairSource;
import com.yoti.api.client.docs.DocScanClient;
import com.yoti.api.client.docs.DocScanClientBuilder;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;

@Configuration
@ConditionalOnClass(DocScanClient.class)
@EnableConfigurationProperties({ DocScanConfig.class })
public class DocScanAutoConfiguration {

private static final Logger LOGGER = LoggerFactory.getLogger(DocScanAutoConfiguration.class);

private DocScanConfig properties;
private ResourceLoader resourceLoader;

@Autowired
public DocScanAutoConfiguration(DocScanConfig properties,
ResourceLoader resourceLoader) {
this.properties = properties;
this.resourceLoader = resourceLoader;
}

@Bean
@ConditionalOnMissingBean(DocScanClient.class)
public DocScanClient getDocScanClient(@Qualifier("docScanPem") final KeyPairSource keyPairSource) {
LOGGER.info("Configuring Doc Scan client with {} and {}.", properties, keyPairSource);
return DocScanClientBuilder.newInstance()
.withClientSdkId(properties.getSdkId())
.withKeyPairSource(keyPairSource)
.build();
}

@Bean(name = "docScanPem")
public KeyPairSource getDocScanKeyPairSource() {
return ClassPathKeySource.fromClasspath(properties.getPemFileLocation());
}

}
Loading

0 comments on commit 6e4fe69

Please sign in to comment.