-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from bcgov/add-bceid-starter
Adding bceid lib
- Loading branch information
Showing
23 changed files
with
2,319 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# spring-bceid-starter | ||
|
||
A stater to facilitate usage of bceid service. | ||
|
||
## Usage | ||
|
||
Add spring-bceid-starter as a maven dependency | ||
|
||
```xml | ||
<dependencies> | ||
<dependency> | ||
<groupId>ca.bc.gov.open</groupId> | ||
<artifactId>spring-bceid-starter</artifactId> | ||
<version>0.1.2</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
## Configuration | ||
|
||
| name | definition | required | | ||
| --- | --- | --- | | ||
| [bcgov.bceid.service.uri](#cgovbceidserviceuri) | String | Yes | | ||
| [bcgov.bceid.service.username](#bcgovbceidserviceusername) | String | Yes | | ||
| [bcgov.bceid.service.password](#bcgovbceidservicepassword) | String | Yes | | ||
| [bcgov.bceid.service.onlineServiceId](#bcgovbceidserviceonlineServiceId) | String | Yes | | ||
|
||
#### bcgov.bceid.service.uri | ||
|
||
* Value type is String | ||
|
||
Sets the BCeID service URI | ||
|
||
#### bcgov.bceid.service.username | ||
|
||
* Value type is String | ||
|
||
Sets the username used to set basic authentication on the BCeID service | ||
|
||
#### bcgov.bceid.service.password | ||
|
||
* Value type is String | ||
|
||
Sets the password used to set basic authentication on the BCeID service | ||
|
||
#### bcgov.bceid.service.onlineServiceId | ||
|
||
* Value type is String | ||
|
||
Sets the onlineServiceId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>ca.bc.gov.open</groupId> | ||
<artifactId>spring-bceid-starter</artifactId> | ||
<version>0.1.2</version> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<spring-boot.version>2.2.4.RELEASE</spring-boot.version> | ||
<org.mapstruct.version>1.3.1.Final</org.mapstruct.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web-services</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-tomcat</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</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>org.apache.cxf</groupId> | ||
<artifactId>cxf-rt-frontend-jaxws</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-rt-transports-http</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-rt-transports-http-jetty</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mapstruct</groupId> | ||
<artifactId>mapstruct</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ca.bc.gov.open</groupId> | ||
<artifactId>spring-starters-bom</artifactId> | ||
<version>0.1.2</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.5.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>org.mapstruct</groupId> | ||
<artifactId>mapstruct-processor</artifactId> | ||
<version>${org.mapstruct.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- WSDL to Java generator --> | ||
<plugin> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-codegen-plugin</artifactId> | ||
<version>3.3.7</version> | ||
<executions> | ||
<execution> | ||
<id>generate-sources</id> | ||
<phase>generate-sources</phase> | ||
<configuration> | ||
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot> | ||
<wsdlOptions> | ||
<wsdlOption> | ||
<wsdl>${project.basedir}/src/main/resources/wsdl/BCeIDService.wsdl</wsdl> | ||
<extraargs> | ||
<extraarg>-client</extraarg> | ||
<extraarg>-autoNameResolution</extraarg> | ||
</extraargs> | ||
</wsdlOption> | ||
</wsdlOptions> | ||
</configuration> | ||
<goals> | ||
<goal>wsdl2java</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
|
||
</build> | ||
|
||
</project> |
54 changes: 54 additions & 0 deletions
54
src/spring-bceid-starter/src/main/java/ca/bc/gov/open/bceid/starter/AutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package ca.bc.gov.open.bceid.starter; | ||
|
||
import ca.bc.gov.open.bceid.starter.account.BCeIDAccountService; | ||
import ca.bc.gov.open.bceid.starter.account.BCeIDAccountServiceImpl; | ||
import ca.bc.gov.open.bceid.starter.account.mappers.AccountDetailRequestMapper; | ||
import ca.bc.gov.open.bceid.starter.account.mappers.AccountDetailRequestMapperImpl; | ||
import ca.bc.gov.open.bceid.starter.account.mappers.IndividualIdentityMapper; | ||
import ca.bc.gov.open.bceid.starter.account.mappers.IndividualIdentityMapperImpl; | ||
import ca.bceid.webservices.client.v9.BCeIDServiceSoap; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(BCeIdProperties.class) | ||
public class AutoConfiguration { | ||
|
||
private final BCeIdProperties bCeIdProperties; | ||
|
||
public AutoConfiguration(BCeIdProperties bCeIdProperties) { | ||
this.bCeIdProperties = bCeIdProperties; | ||
} | ||
|
||
@Bean | ||
public AccountDetailRequestMapper accountDetailRequestMapper() { | ||
return new AccountDetailRequestMapperImpl(); | ||
} | ||
|
||
@Bean | ||
public IndividualIdentityMapper individualIdentityMapper() { | ||
return new IndividualIdentityMapperImpl(); | ||
} | ||
|
||
@Bean | ||
public BCeIDServiceSoap bCeIDServiceSoap() { | ||
|
||
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean(); | ||
jaxWsProxyFactoryBean.setServiceClass(BCeIDServiceSoap.class); | ||
jaxWsProxyFactoryBean.setAddress(bCeIdProperties.getUri()); | ||
if(StringUtils.isNotBlank(bCeIdProperties.getUsername())) | ||
jaxWsProxyFactoryBean.setUsername(bCeIdProperties.getUsername()); | ||
if(StringUtils.isNotBlank(bCeIdProperties.getPassword())) | ||
jaxWsProxyFactoryBean.setPassword(bCeIdProperties.getPassword()); | ||
return (BCeIDServiceSoap) jaxWsProxyFactoryBean.create(); | ||
|
||
} | ||
|
||
@Bean | ||
public BCeIDAccountService bCeIDUserService(BCeIDServiceSoap bCeIDServiceSoap, AccountDetailRequestMapper accountDetailRequestMapper, IndividualIdentityMapper individualIdentityMapper) { | ||
return new BCeIDAccountServiceImpl(bCeIDServiceSoap, bCeIdProperties, accountDetailRequestMapper, individualIdentityMapper); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/spring-bceid-starter/src/main/java/ca/bc/gov/open/bceid/starter/BCeIdProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ca.bc.gov.open.bceid.starter; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "bcgov.bceid.service") | ||
public class BCeIdProperties { | ||
|
||
private String uri; | ||
private String username; | ||
private String password; | ||
private String onlineServiceId; | ||
|
||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getOnlineServiceId() { | ||
return onlineServiceId; | ||
} | ||
|
||
public void setOnlineServiceId(String onlineServiceId) { | ||
this.onlineServiceId = onlineServiceId; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...bceid-starter/src/main/java/ca/bc/gov/open/bceid/starter/account/BCeIDAccountService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ca.bc.gov.open.bceid.starter.account; | ||
|
||
import ca.bc.gov.open.bceid.starter.account.models.IndividualIdentity; | ||
|
||
import java.util.Optional; | ||
|
||
public interface BCeIDAccountService { | ||
|
||
Optional<IndividualIdentity> getIndividualIdentity(GetAccountRequest request); | ||
|
||
} |
Oops, something went wrong.