Skip to content

Commit

Permalink
Baas southbound proxies added
Browse files Browse the repository at this point in the history
  • Loading branch information
rupam-rai committed Mar 19, 2018
1 parent 7370663 commit 4ae9c5f
Show file tree
Hide file tree
Showing 56 changed files with 6,135 additions and 36 deletions.
110 changes: 97 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document is organized into the following sections
- [Security](#security)
- [APIs](#functional-apis)

3.[Setup](#setup)
3.[Setup](#openbank-setup)
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Test](#Test)
Expand Down Expand Up @@ -173,24 +173,29 @@ Banking APIs provide developers with the information needed to create innovative
- Recommendation of products and deals based on monthly statements.


## Apigee Edge Setup
## OpenBank Setup

<img src="/images/openbankDeploymentarchitecture.png" width="700px" height="300px"/>

The OpenBank deployment architecture is as mentioned above.
The OpenBank deployment architecture is as shown above.

### Getting Started

+ Create an [Apigee API Management Developer Account](https://enterprise.apigee.com)
+ Request For [Apigee Developer Portal](https://pages.apigee.com/contact-sales-reg.html), if you want to use portal


The OpenBank Solution is using Google Cloud Datastore as backend. To setup the openbank solution , there are two options available:
The OpenBank Solution is using Google Cloud Datastore as backend. To setup the OpenBank solution , there are two options available:
+ Using one's own Google Cloud Datastore instance
+ Using [Apigee Openbank's](https://openbank.apigee.com) Google Cloud Datastore instance
+ Using [Apigee OpenBank's](https://openbank.apigee.com) Datastore instance

To shift from Apigee's OpenBank Datastore instance to own Datastore instance, follow the steps [here](#moving-to-own-cloud-datastore-instance)

If one wants to setup the openbank solution on own Google Cloud Datastore instance,[create a Google Cloud project and enable Datatsore](https://console.cloud.google.com/)

Note: you can also setup OpenBank solution on Apigee BaaS following the steps [here](#openbank-setup-on-baas)


If one wants to setup the OpenBank solution on own Google Cloud Datastore instance, [create a Google Cloud project](https://console.cloud.google.com/), enable Datatsore and create a [service account](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and download the service account as .json .

To Learn more on the basic concepts of Apigee Edge, please refer to :
http://docs.apigee.com/api-services/content/what-apigee-edge
Expand Down Expand Up @@ -239,10 +244,10 @@ Run the deploy command
gulp deployopenbank --env <env>
```

This will ask you if you have your own datastore instance, or want to use the Apigee Openbank's datastore.
If you choose to use your own datastore instance, the script will prompt you for
This will ask you if you have your own Datastore instance, or want to use the Apigee OpenBank's Datastore instance.
If you choose to use your own Datastore instance, the script will prompt you for
+ Google Cloud Project Id
+ Service account private key for datastore
+ Service account private key for Datastore
+ Token uri associated of the service account
+ Client email of the service account

Expand All @@ -268,9 +273,88 @@ run tests
gulp test
```
### Moving to own Cloud Datastore instance
There are 2 options available
+ Re-deploy the solution using the above script again with datastore credentials.
+ Manually make changes to all the northbound proxies, update the service account key in the KVM and make changes to the datastore-connector proxy so that the northbound proxies invoke the proper southbounds, and the datastore-connector works well.
There are 2 options available for migrating from Apigee's OpenBank Datastore to own Datastore Instance:
+ Re-deploy the solution using the above script with Datastore credentials(This option will redeploy the proxies and all new changes made to the northbound proxies will go away).
+ Manually make changes required:
+ Manually make changes to all the northbound proxies
+ src/gateway/login-app/target/apiproxy/resources/node/config.json
+ src/gateway/locations/target/apiproxy/targets/default.xml
+ src/gateway/products/target/apiproxy/targets/default.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Create-ID-token.xml
+ src/gateway/consent-app/target/apiproxy/resources/node/config.json
+ src/gateway/accounts/target/apiproxy/policies/Fetch-Account-Consent.xml
+ src/gateway/accounts/target/apiproxy/policies/Get-Acc-Req-Data.xml
+ src/gateway/accounts/target/apiproxy/policies/Update-Access-Count.xml
+ src/gateway/accounts/target/apiproxy/targets/default.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Account-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Payment-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Account-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Payment-Request.xml
+ src/gateway/oauth/target/apiproxy/targets/default.xml
+ src/gateway/payments/target/apiproxy/policies/Service-Callout-Validate-Payment-Request-Status.xml
+ src/gateway/payments/target/apiproxy/policies/Service-Callout-Fetch-and-Validate-Consent.xml
+ src/gateway/payments/target/apiproxy/targets/default.xml
+ Update the service account key value for 'privateKey' key in the KVM GoogleServiceAccountKVM
+ Replace the variable {{ datastoreProject }} with your Google Cloud project-Id in:
+ src/gateway/datastore-connector/target/apiproxy/targets/default.xml
+ src/gateway/datastore-connector/target/apiproxy/policies/Service-Callout-Get-Entity.xml
+ Replace the variable {{ client_email }} with your project service account client email in:
+ src/gateway/datastore-connector/target/apiproxy/policies/Generate-JWT-Datastore.xml
+ Replace the variable {{ token_uri }} with your Google Cloud project service account token uri in:
+ src/gateway/datastore-connector/target/apiproxy/policies/Generate-JWT-Datastore.xml
+ src/gateway/datastore-connector/target/apiproxy/policies/Service-Callout-Get-Access-Token.xml

### OpenBank setup on BaaS
If you want to setup the OpenBank solution on BaaS, southbound proxies are available in path /src/gateway with 'baas' suffix. You can setup OpenBank on BaaS by following the steps bellow:
+ Create an [Apigee BaaS](https://apibaas.apigee.com) account
+ Create BaaS collections corresponding to the .json file name in /setup/data and upload the data to the collections from respective .json files
+ Additionally create empty collections :
+ payments
+ payment-submissions
+ id-tokens
+ Replace the variable {{ baasBasePath }} with value of {baasBasePath}/{baasOrg}/{bassApp} in the BaaS southbound proxies in path /src/gateway:
+ /src/gateway/accounts-connector-baas/apiproxy/policies/Assign-Target-URL.xml
+ /src/gateway/consent-management-baas/apiproxy/resources/node/package.json
+ /src/gateway/customer-management-baas/apiproxy/targets/default.xml
+ /src/gateway/locations-connector-baas/apiproxy/policies/Assign-Target-URL.xml
+ /src/gateway/products-connector-baas/apiproxy/policies/Assign-Target-URL.xml
+ /src/gateway/user-management-baas/apiproxy/targets/default.xml
+ /src/gateway/payments-connector-baas/apiproxy/resources/node/package.json

+ Replace the variable {{ baasClientId }} with clientId for the BaaS Org in the BaaS southbound proxies:
+ /src/gateway/accounts-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/consent-management-baas/apiproxy/resources/node/package.json
+ /src/gateway/customer-management-baas/apiproxy/policies/Assign-clientIdSecret.xml
+ /src/gateway/locations-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/payments-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/products-connector-baas/apiproxy/resources/node/package.json

+ Replace the variable {{ baasClientSecret }} with clientId for the BaaS Org in the BaaS southbound proxies:
+ /src/gateway/accounts-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/consent-management-baas/apiproxy/resources/node/package.json
+ /src/gateway/customer-management-baas/apiproxy/policies/Assign-clientIdSecret.xml
+ /src/gateway/locations-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/payments-connector-baas/apiproxy/resources/node/package.json
+ /src/gateway/products-connector-baas/apiproxy/resources/node/package.json
+ Upload the proxy bundles to your Edge Org
+ Make changes to northbound proxies to change the Target Endpoints and ServiceCallout Endpoints to the BaaS southbound proxies:
+ src/gateway/login-app/target/apiproxy/resources/node/config.json
+ src/gateway/locations/target/apiproxy/targets/default.xml
+ src/gateway/products/target/apiproxy/targets/default.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Create-ID-token.xml
+ src/gateway/consent-app/target/apiproxy/resources/node/config.json
+ src/gateway/accounts/target/apiproxy/policies/Fetch-Account-Consent.xml
+ src/gateway/accounts/target/apiproxy/policies/Get-Acc-Req-Data.xml
+ src/gateway/accounts/target/apiproxy/policies/Update-Access-Count.xml
+ src/gateway/accounts/target/apiproxy/targets/default.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Account-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Payment-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Account-Request.xml
+ src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Payment-Request.xml
+ src/gateway/oauth/target/apiproxy/targets/default.xml
+ src/gateway/payments/target/apiproxy/policies/Service-Callout-Validate-Payment-Request-Status.xml
+ src/gateway/payments/target/apiproxy/policies/Service-Callout-Fetch-and-Validate-Consent.xml
+ src/gateway/payments/target/apiproxy/targets/default.xml

## Developer Portal
Every API provider must be able to educate developers and successfully expose their APIs. A developer portal is the face of your API program, providing everything that internal, partner, and third party developers need.
Expand Down Expand Up @@ -308,7 +392,7 @@ Additional notes for implementors.

#### 2018/03/16
* APIs / API Spec
* Openbank shifted from Baas 2.0 . Hosted on Google Cloud datastore
* OpenBank shifted from BaaS 2.0 . Hosted on Google Cloud Datastore

#### 2017/09/13
* APIs / API Spec
Expand Down
6 changes: 3 additions & 3 deletions config.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ resources:
items:
- name: edgeBasePath
filePaths: ['src/gateway/payments-connector/target/apiproxy/resources/node/package.json','src/gateway/consent-management/target/apiproxy/targets/default.xml','src/gateway/user-management/target/apiproxy/targets/default.xml','src/gateway/customer-management/target/apiproxy/targets/default.xml','src/gateway/accounts-connector/target/apiproxy/policies/Assign-Target-URL.xml','src/gateway/locations-connector/target/apiproxy/targets/default.xml','src/gateway/products-connector/target/apiproxy/targets/default.xml']
value: 'https://{{=<% %>=}}{{org}}<%={{ }}=%>-{{=<% %>=}}{{env}}<%={{ }}=%>.apigee.net{{ sbconnector}}'
value: 'https://{{=<% %>=}}{{org}}<%={{ }}=%>-{{=<% %>=}}{{env}}<%={{ }}=%>.apigee.net'
- name: DsApikey
filePaths: ['src/gateway/accounts-connector/target/apiproxy/policies/Assign-Target-URL.xml','src/gateway/user-management/target/apiproxy/policies/Assign-Message.xml','src/gateway/products-connector/target/apiproxy/policies/Assign-Message.xml','src/gateway/locations-connector/target/apiproxy/policies/Assign-Variables.xml','src/gateway/customer-management/target/apiproxy/policies/Assign-Apikey.xml','src/gateway/consent-management/target/apiproxy/policies/Assign-Apikey.xml','src/gateway/payments-connector/target/apiproxy/resources/node/package.json']
value: '{{=<% %>=}}{{apiKey_DS}}<%={{ }}=%>'
Expand Down Expand Up @@ -142,7 +142,7 @@ resources:
filePaths: ['src/gateway/login-app/target/apiproxy/resources/node/config.json','src/gateway/consent-app/target/apiproxy/resources/node/config.json','src/gateway/accounts/target/apiproxy/policies/Assign-APIKey-Header.xml','src/gateway/accounts/target/apiproxy/policies/Fetch-Account-Consent.xml','src/gateway/accounts/target/apiproxy/policies/Get-Acc-Req-Data.xml','src/gateway/accounts/target/apiproxy/policies/Update-Access-Count.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Payment-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Payment-Request.xml','src/gateway/payments/target/apiproxy/policies/Assign-APIKey-Header.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Validate-Payment-Request-Status.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Fetch-and-Validate-Consent.xml']
value: '{{=<% %>=}}{{apiKey_IA}}<%={{ }}=%>'
- name: edgeBasePath
filePaths: ['src/gateway/locations/target/apiproxy/targets/default.xml','src/gateway/products/target/apiproxy/targets/default.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Create-ID-token.xml','src/gateway/consent-app/target/apiproxy/resources/node/config.json','src/gateway/accounts/target/apiproxy/policies/Fetch-Account-Consent.xml','src/gateway/accounts/target/apiproxy/policies/Get-Acc-Req-Data.xml','src/gateway/accounts/target/apiproxy/policies/Update-Access-Count.xml','src/gateway/accounts/target/apiproxy/targets/default.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Payment-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Payment-Request.xml','src/gateway/oauth/target/apiproxy/targets/default.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Validate-Payment-Request-Status.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Fetch-and-Validate-Consent.xml','src/gateway/payments/target/apiproxy/targets/default.xml']
filePaths: ['src/gateway/login-app/target/apiproxy/resources/node/config.json','src/gateway/locations/target/apiproxy/targets/default.xml','src/gateway/products/target/apiproxy/targets/default.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Create-ID-token.xml','src/gateway/consent-app/target/apiproxy/resources/node/config.json','src/gateway/accounts/target/apiproxy/policies/Fetch-Account-Consent.xml','src/gateway/accounts/target/apiproxy/policies/Get-Acc-Req-Data.xml','src/gateway/accounts/target/apiproxy/policies/Update-Access-Count.xml','src/gateway/accounts/target/apiproxy/targets/default.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Update-Payment-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Account-Request.xml','src/gateway/oauth/target/apiproxy/policies/Service-Callout-Validate-Payment-Request.xml','src/gateway/oauth/target/apiproxy/targets/default.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Validate-Payment-Request-Status.xml','src/gateway/payments/target/apiproxy/policies/Service-Callout-Fetch-and-Validate-Consent.xml','src/gateway/payments/target/apiproxy/targets/default.xml']
value: 'https://{{=<% %>=}}{{ org }}<%={{ }}=%>-{{=<% %>=}}{{ env }}<%={{ }}=%>.apigee.net{{ sbconnector}}'
- name: consentSessionKey
filePaths: ['src/gateway/consent-app/target/apiproxy/resources/node/config.json']
Expand All @@ -155,7 +155,7 @@ resources:
value: '{{=<% %>=}}{{ jwtSignKey }}<%={{ }}=%>'
- name: edgeBasePathFixed
filePaths: ['src/gateway/consent-app/target/apiproxy/resources/node/config.json','src/gateway/oauth/target/apiproxy/targets/default.xml']
value: 'https://{{ org }}-{{ env }}.apigee.net'
value: 'https://{{=<% %>=}}{{ org }}<%={{ }}=%>-{{=<% %>=}}{{ env }}<%={{ }}=%>.apigee.net'
- name: deploy_remaining_apis
type: proxy
items:
Expand Down
22 changes: 10 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ var path = require('path');
var fs = require('fs-extra');
var request = require('request');
const Datastore = require('@google-cloud/datastore');
var co = require('co');
var prompt = require('prompt-promise');



Expand All @@ -53,12 +51,12 @@ gulp.task('startdeploy', function( cb) {
var required_values = [];
required_values.push({name: 'datastoreProject', description: 'Enter the cloud datastore project name', type: 'string', required: true});
required_values.push({name: 'serviceaccount_Private_Key', description: 'Enter the service account private key', type: 'string', required: true});
required_values.push({name: 'token_uri', description: 'Enter the token uri for the service account', type: 'string', required: true});
required_values.push({name: 'client_email', description: 'Enter the client email uri for the service account', type: 'string', required: true});
required_values.push({name: 'bankPrivateKey', description: 'Enter the path for banks private key', type: 'string', required: true});
required_values.push({name: 'bankPublicKey', description: 'Enter the path for banks public key', type: 'string', required: true});
required_values.push({name: 'tppPrivateKey', description: 'Enter the path for tpp private key', type: 'string', required: true});
required_values.push({name: 'tppPublicKey', description: 'Enter the path for tpp public key', type: 'string', required: true});
required_values.push({name: 'token_uri', description: 'Enter the token uri of the service account', type: 'string', required: true});
required_values.push({name: 'client_email', description: 'Enter the client email of the service account', type: 'string', required: true});
required_values.push({name: 'bankPrivateKey', description: 'Enter the complete path of banks private key', type: 'string', required: true});
required_values.push({name: 'bankPublicKey', description: 'Enter the complete path of banks public key', type: 'string', required: true});
required_values.push({name: 'tppPrivateKey', description: 'Enter the complete path of tpp private key', type: 'string', required: true});
required_values.push({name: 'tppPublicKey', description: 'Enter the complete path of tpp public key', type: 'string', required: true});

prompt_lib.start();

Expand All @@ -81,10 +79,10 @@ gulp.task('startdeploy', function( cb) {
var required_values = [];


required_values.push({name: 'bankPrivateKey', description: 'Enter the path for banks private key', type: 'string', required: true});
required_values.push({name: 'bankPublicKey', description: 'Enter the path for banks public key', type: 'string', required: true});
required_values.push({name: 'tppPrivateKey', description: 'Enter the path for tpp private key', type: 'string', required: true});
required_values.push({name: 'tppPublicKey', description: 'Enter the path for tpp public key', type: 'string', required: true});
required_values.push({name: 'bankPrivateKey', description: 'Enter the complete path of banks private key', type: 'string', required: true});
required_values.push({name: 'bankPublicKey', description: 'Enter the complete path of banks public key', type: 'string', required: true});
required_values.push({name: 'tppPrivateKey', description: 'Enter the complete path of tpp private key', type: 'string', required: true});
required_values.push({name: 'tppPublicKey', description: 'Enter the complete path of tpp public key', type: 'string', required: true});

prompt_lib.start();

Expand Down
Loading

0 comments on commit 4ae9c5f

Please sign in to comment.