Skip to content

Commit

Permalink
Merge pull request #62 from wultra/develop
Browse files Browse the repository at this point in the history
Prepare release 0.21.0
  • Loading branch information
romanstrobl authored Feb 11, 2019
2 parents d5f8f1c + 7bf720d commit 006cfa6
Show file tree
Hide file tree
Showing 31 changed files with 279 additions and 135 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and other changes required for customizing Web Flow for clients.

## Documentation

Visit our wiki for [technical details about PowerAuth 2.0 Web Flow](https://github.com/lime-company/powerauth-webflow/wiki).
For the most recent documentation and tutorials, please visit [PowerAuth Web Flow Customization Documentation](./docs/Home.md).

## License

Expand Down
60 changes: 60 additions & 0 deletions docs/Customizing-Web-Flow-Appearance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Customizing PowerAuth Web Flow Appearance

Web Flow resources which can be customized are available in the ext-resources folder:

- [ext-resources](../ext-resources)

## Overriding Default Web Flow Resource Location

The general process of updating Web Flow resources:

- Clone project [powerauth-webflow-customization](https://github.com/wultra/powerauth-webflow-customization) from GitHub.
- Update Web Flow resources by overriding existing texts, CSS, fonts and images or by adding additional resources.
- When deploying Web Flow, configure the following Spring Boot property:

```properties
powerauth.webflow.page.ext-resources.location=classpath:/static/resources/
```

For example, if you placed the Web Flow customization files to `/opt/webflow/ext-resources`, set the property to:

```properties
powerauth.webflow.page.ext-resources.location=file:/opt/webflow/ext-resources
```

See the documentation of your container for configuration of properties.

## Customizing Web Flow Texts

Web Flow texts are stored in `ext-resources/message_[lang].properties` files, see:

- [ext-resources/messages_en.properties](../ext-resources/messages_en.properties)

- [ext-resources/messages_cs.properties](../ext-resources/messages_cs.properties)

After you make a copy of the `powerauth-webflow-customization` project, you can update the texts and deploy changes to the folder `/path/to/your/ext-resources`.

## Customizing Web Flow CSS Styles

Web Flow CSS files are stored in `ext-resources/css` folder, see:

- [ext-resources/css](../ext-resources/css)

After you make a copy of the `powerauth-webflow-customization` project, you can update the CSS and deploy changes to the folder `/path/to/your/ext-resources/css`. Make sure to only edit the `customization.css` file. We may change CSS in `base.css` file at any time and you would have to migrate the changes we made to your customization.

## Customizing Web Flow Images

Web Flow images are stored in `ext-resources/images` folder, see:

- [ext-resources/images](../ext-resources/images)

After you make a copy of the `powerauth-webflow-customization` project, you can update the images and deploy changes to the folder `/path/to/your/ext-resources/css`.

You can also add new images and configure these images in overridden CSS files.

## Customizing Web Flow Fonts

Additional fonts for Web Flow can be stored in `ext-resources/fonts` folder, see:
- [ext-resources/fonts](../ext-resources/fonts)

After you make a copy of the `powerauth-webflow-customization` project, you can add new fonts to the folder `/path/to/your/ext-resources/fonts` and update the `customization.css` file (see above) to use the added fonts in Web Flow.
10 changes: 10 additions & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PowerAuth Web Flow Customization

The purpose of this project is to provide client specific customization, such as adapting to client backend APIs, CSS customization, updated texts, images, fonts and other changes required for customizing Web Flow for clients.

Web Flow can be customized in following areas:

- Appearance (texts, CSS, fonts and images) - chapter [Customizing Web Flow Appearance](./Customizing-Web-Flow-Appearance.md)
- Integration with clients backends - chapter [Implementing the Data Adapter Interface](./Implementing-the-Data-Adapter-Interface.md)

Data Adapter is integrated with Web Flow using REST API. For documentation see: [Data Adapter REST API Reference](https://github.com/wultra/powerauth-webflow/blob/develop/docs/Data-Adapter-REST-API-Reference.md)
42 changes: 42 additions & 0 deletions docs/Implementing-the-Data-Adapter-Interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Implementing the Data Adapter Interface

Data Adapter is used for connecting Web Flow to client backend systems. It allows to interact with backends for user authentication, SMS authorization, read additional data required for the operation as well as notify client backend about operation changes.

## DataAdapter Interface

The interface methods are defined in the [DataAdapter interface](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java):

- [authenticateUser](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L43) - perform user authentication with remote backend based on provided credentials
- [fetchUserDetail](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L52) - retrieve user details for given user ID
- [decorateFormData](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L62) - retrieve operation form data and decorate it
- [formDataChangedNotification](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L71) - method is called when operation form data changes to allow notification of client backends
- [operationChangedNotification](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L80) - method is called when operation status changes to allow notification of client backends
- [generateAuthorizationCode](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L89) - generate authorization code for authorization SMS message
- [generateSMSText](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L100) - generate SMS text for authorization SMS message
- [sendAuthorizationSMS](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L110) - send authorization SMS message

## Customizing Data Adapter

Following steps are required for customization of Data Adapter.

### 1. Implement Interface Methods

Consider which of the following methods need to be implemented in your project:

- [authenticateUser](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L43) (optional) - implementation is required in case any Web Flow operation needs to authenticate the user using a username/password login form
- [fetchUserDetail](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L52) (required) - provides information about the user (user ID and name) for the OAuth 2.0 protocol
- [decorateFormData](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L62) (optional) - implementation is required in case any Web Flow operation form data needs to be updated after authentication (e.g. add information about user bank accounts)
- [formDataChangedNotification](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L71) (optional) - implementation is required in case the client backends need to be notified about user input during an operation
- [operationChangedNotification](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L80) (optional) - implementation is required in case the client backends need to be notified about operation status changes
- [generateAuthorizationCode](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L89) (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
- [generateSMSText](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L100) (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
- [sendAuthorizationSMS](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/api/DataAdapter.java#L110) (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization

### 2. Implement the `DataAdapter` Interface

Implement the actual changes in Data Adapter so that it connects to an actual data source.

- Clone project [powerauth-webflow-customization](https://github.com/wultra/powerauth-webflow-customization) from GitHub.
- Update the `pom.xml` to add any required additional dependencies.
- Create a proprietary client (+ client config) for your web services.
- Implement the Data Adapter interface by providing your own implementation in the [DataAdapterService class](../powerauth-data-adapter/src/main/java/io/getlime/security/powerauth/app/dataadapter/impl/service/DataAdapterService.java). You can override the sample implementation.
6 changes: 6 additions & 0 deletions docs/_Sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**Customizing Web Flow**

- [Home](./Home.md)
- [Customizing Web Flow Appearance](./Customizing-Web-Flow-Appearance.md)
- [Implementing Data Adapter Interface](./Implementing-the-Data-Adapter-Interface.md)
- [Data Adapter REST API Reference](https://github.com/wultra/powerauth-webflow/blob/develop/docs/Data-Adapter-REST-API-Reference.md)
30 changes: 15 additions & 15 deletions powerauth-data-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<artifactId>powerauth-data-adapter</artifactId>
<groupId>io.getlime.security</groupId>
<version>0.20.0</version>
<version>0.21.0</version>
<packaging>war</packaging>

<name>powerauth-data-adapter</name>
Expand All @@ -14,16 +14,16 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<version>2.0.8.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<inceptionYear>2018</inceptionYear>
<url>http://powerauth.com/</url>

<organization>
<name>Lime - HighTech Solutions Inc.</name>
<url>http://getlime.io/</url>
<name>Wultra s.r.o.</name>
<url>http://wultra.com</url>
</organization>

<licenses>
Expand All @@ -36,29 +36,29 @@
<developers>
<developer>
<name>Petr Dvorak</name>
<email>petr@lime-company.eu</email>
<email>petr@wultra.com</email>
<roles>
<role>developer</role>
</roles>
</developer>
<developer>
<name>Roman Strobl</name>
<email>roman.strobl@lime-company.eu</email>
<email>roman.strobl@wultra.com</email>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/lime-company/powerauth-webflow-customization.git</connection>
<developerConnection>scm:git:https://github.com/lime-company/powerauth-webflow-customization.git</developerConnection>
<url>https://github.com/lime-company/powerauth-webflow-customization</url>
<connection>scm:git:https://github.com/wultra/powerauth-webflow-customization.git</connection>
<developerConnection>scm:git:https://github.com/wultra/powerauth-webflow-customization.git</developerConnection>
<url>https://github.com/wultra/powerauth-webflow-customization</url>
</scm>

<issueManagement>
<system>Github</system>
<url>https://github.com/lime-company/powerauth-webflow-customization/issues</url>
<url>https://github.com/wultra/powerauth-webflow-customization/issues</url>
</issueManagement>

<properties>
Expand Down Expand Up @@ -89,19 +89,19 @@
<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-data-adapter-model</artifactId>
<version>0.20.0</version>
<version>0.21.0</version>
</dependency>
<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-java-crypto</artifactId>
<version>0.19.0</version>
<version>0.21.0</version>
</dependency>

<!-- Other Dependencies -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.9.4</version>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -113,12 +113,12 @@
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
<version>2.9.2</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,7 @@

/**
* Spring Boot application main class.
* @author Roman Strobl, roman.strobl@lime-company.eu
* @author Roman Strobl, roman.strobl@wultra.com
*/
@SpringBootApplication
public class DataAdapterApplication {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@

/**
* Spring Boot servlet initializer.
* @author Roman Strobl, roman.strobl@lime-company.eu
* @author Roman Strobl, roman.strobl@wultra.com
*/
public class ServletInitializer extends SpringBootServletInitializer {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@
/**
* Interface defines methods which should be implemented for integration of Web Flow with 3rd parties.
*
* @author Roman Strobl, roman.strobl@lime-company.eu
* @author Roman Strobl, roman.strobl@wultra.com
*/
public interface DataAdapter {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
/**
* Configuration of Data Adapter.
*
* @author Roman Strobl, roman.strobl@lime-company.eu
* @author Roman Strobl, roman.strobl@wultra.com
*/
@Configuration
@ComponentScan(basePackages = {"io.getlime.security.powerauth"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@
/**
* Configuration class used for setting up Swagger documentation.
*
* @author Petr Dvorak, petr@lime-company.eu
* @author Petr Dvorak, petr@wultra.com
*/
@Configuration
@EnableSwagger2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Lime - HighTech Solutions s.r.o.
* Copyright 2017 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,23 +16,23 @@
package io.getlime.security.powerauth.app.dataadapter.configuration;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
* Default Web Application Configuration.
*
* @author Roman Strobl, roman.strobl@lime-company.eu
* @author Roman Strobl, roman.strobl@wultra.com
*/
@Configuration
public class WebApplicationConfig extends WebMvcConfigurerAdapter {
public class WebApplicationConfig implements WebMvcConfigurer {

/**
* Custom object mapper to make sure that dates and other values serialize
Expand All @@ -43,10 +43,11 @@ public class WebApplicationConfig extends WebMvcConfigurerAdapter {
private ObjectMapper objectMapper() {
Jackson2ObjectMapperFactoryBean bean = new Jackson2ObjectMapperFactoryBean();
bean.setIndentOutput(true);
bean.setDateFormat(new ISO8601DateFormat());
bean.afterPropertiesSet();
ObjectMapper objectMapper = bean.getObject();
objectMapper.registerModule(new JodaModule());
// replacement for ISO8601DateFormat which is deprecated
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return objectMapper;
}

Expand All @@ -67,7 +68,6 @@ private MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(mappingJackson2HttpMessageConverter());
super.configureMessageConverters(converters);
}

}
Loading

0 comments on commit 006cfa6

Please sign in to comment.