Customize the Consent Manager Portal
This page explains how the developers can plug in the required toolkit code and customize the Consent Manager Portal by modifying or adding files.
Info
This is only available as a WSO2 Update from WSO2 Open Banking Identity Server Accelerator Level 3.0.0.77 onwards. For more information on updating, see Getting WSO2 Updates.
After setting up the required toolkit, the default Consent Manager application is overridden by the Consent Manager application specific to each toolkit. Follow the instructions below to customize the application furthermore.
Setting up the Consent Manager source code for advanced customizations¶
Info
The source code of the Consent Manager application is available in the <IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory.
Follow the instructions below to set up the source code for Consent Manager for advanced customizations.
-
Open a terminal.
-
Navigate to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory. -
Run the following command to install the dependencies required for the React project:
npm install
-
Open the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
folder in your IDE.Note
If the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory does not contain thetoolkit/src
pathway, create it. -
You can modify the existing components and/or add new components according to your requirements. Refer to the relevant section below for the instructions.
Modifying existing components in the Consent Manager application¶
-
Any file inside the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder can override the original file at the<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/accelerator/src
folder. -
For example, the
self-care-portal-frontend/toolkit/src/common/Nav.jsx
file takes precedence over theself-care-portal-frontend/accelerator/src/common/Nav.jsx
file when the npm build is running.Note
The name of the file and the location relative to the source folder needs to be identical.
A sample structure of the <IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder is shown below:
Important
The file extension is mandatory for any imports added. For example,
import { logout } from “../login/logout.js”;
Here, the .js
extension is compulsory. Otherwise, the webpack throws an error.
Follow the steps below to modify an existing component:
-
Copy the file you want to modify.
-
Create an identical path in the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder. -
Modify according to your requirements.
-
Navigate to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory in a terminal. -
Run the following command.
npm run build
Tip
If the changes are not visible in the Consent Manager application, restarting the Identity Server will reflect the changes.
Try Out Example 01
-
Copy the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/accelerator/src/common/Nav.jsx
file. -
Open the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
directory. -
Create a folder named
common
there if it does not already exist. -
Paste the
Nav.jsx
file in the<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src/common
directory. -
Edit the
Nav.jsx
in the above location. -
Navigate to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory in a terminal. -
Run the following command:
npm run build
Adding new components in the Consent Manager application¶
You can add your own files to customize the UI in the <IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder.
For example, you can import the NewComponent.jsx
file by adding the AppOverride
prefix to the import and providing the full path relative to the toolkit folder.
import { NewComponent } from 'AppOverride/src/NewComponent.jsx';
If you try to import the NewComponent.jsx
file without adding the AppOverride
prefix as follows, a bundler error will be thrown.
import { NewComponent } from '../NewComponent.jsx';
Important
The file extension is mandatory for the imports added. For example,
import { NewComponent } from ‘AppOverride/src/common/NewComponent.jsx’;
Here, the .jsx
extension is compulsory. Otherwise, the webpack throws an error.
A sample structure of the <IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder is shown below after adding the NewComponent.jsx
file:
Follow the steps below to add a new component:
-
Create a new file in the desired location inside the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
folder. -
Add the import to the desired file. Follow the above-mentioned instructions when adding the
import
statements. Adding imports to an existing component modifies that file. Follow the Modifying existing components in the Consent Manager application section for more details. -
Navigate to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory in a terminal. -
Run the following command.
npm run build
Tip
If the changes are not visible in the Consent Manager application, restarting the Identity Server will reflect the changes.
Try Out Example 02
-
Open the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
directory. -
Create a new file named
NewComponent.jsx
there. -
Add the necessary code for the React component.
-
Open the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/accelerator/src/landing_page
directory. -
Copy the
Body.jsx
file. -
Create a similar path in the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src
directory. -
Paste the
Body.jsx
file there. -
Add the following import to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend/toolkit/src/landing_page/Body.jsx
file and use the component as needed.import { NewComponent } from 'AppOverride/src/NewComponent.jsx';
-
Navigate to the
<IS_HOME>/repository/deployment/server/webapps/consentmgr/self-care-portal-frontend
directory in a terminal. -
Run the following command.
npm run build
Importing an existing Accelerator component to the newly added component¶
Consider the following example. NewPage.jsx
is a newly added component to the toolkit. You want to import the Nav.jsx
file of the Accelerator into it.
You can import an existing Accelerator component as follows:
import { Nav.jsx } from '../../accelerator/src/common/Nav.jsx';
Top