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. Furthermore, the Data Adapter can be used to customize text and options for the OAuth 2.0 consent screen.

DataAdapter Interface

The interface methods are defined in the DataAdapter interface:

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:

  • lookupUser - (required) - provides mapping of username to user ID which is used by other methods
  • authenticateUser (optional) - implementation is required in case any Web Flow operation needs to authenticate the user using a username/password
  • fetchUserDetail (required) - provides information about the user (user ID and name) for the OAuth 2.0 protocol
  • decorateFormData (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 (optional) - implementation is required in case the client backends need to be notified about user input during an operation
  • operationChangedNotification (optional) - implementation is required in case the client backends need to be notified about operation status changes
  • createAuthorizationSms (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
  • generateAuthorizationCode (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
  • generateSmsText (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
  • sendAuthorizationSms (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
  • verifyAuthorizationSms (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization
  • verifyAuthorizationSmsAndPassword (optional) - implementation is required in case any Web Flow operation needs to authorize the user using SMS authorization and password
  • initConsentForm (optional) - implementation is required in case the OAuth 2.0 consent step is enabled
  • createConsentForm (optional) - implementation is required in case the OAuth 2.0 consent step is enabled
  • validateConsentForm (optional) - implementation is required in case the OAuth 2.0 consent step is enabled
  • saveConsentForm (optional) - implementation is required in case the OAuth 2.0 consent step is enabled

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 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. You can override the sample implementation.