Before making changes to the PowerBuilder client app, let's follow the steps below to make sure 1) the PowerBuilder application can run successfully, 2) the app has been deployed as an installable cloud app successfully, and 3) the PowerServer C# solution (including the built-in Amazon Cognito server) has been successfully generated.
In this tutorial, we will take Sales Demo as an example.
Step 1: Select Windows Start | Appeon PowerBuilder 2021, and then right-click Example Sales App and select More | Run as administrator.
Step 2: When the SalesDemo workspace is loaded in the PowerBuilder IDE, click the Run button in the PowerBuilder toolbar.
Step 3: When the application main window is opened, click the Address icon in the application ribbon bar and make sure data can be successfully retrieved.
Step 4: Create and configure a PowerServer project for the Sales Demo app (detailed instructions are provided in the Quick Start guide).
IMPORTANT: In the Web APIs tab, select Use built-in AWS Cognito server from the Auth Template list box.
Step 5: Deploy the application as an installable cloud app. The PowerServer C# solution is generated, but the installable cloud app cannot run yet because further settings and changes are required, as explained in the subsequent sections.
The PowerServer C# solution contains a built-in Amazon Cognito server and the authentication class files as shown below.
-
The built-in Amazon Cognito server authenticates the user credential with the Cognito service and returns an identity token. The built-in server is included in the ServerAPIs project; it will run automatically when the PowerServer Web APIs (the ServerAPIs project) runs.
-
The authentication class and configuration files will be used by the PowerServer Web APIs to validate the token passed from the client; and if validation is successful, data will be obtained from the database.
-
Authentication.json contains the settings for enabling the authentication feature ("PowerServer:EnableAuthentication") and specifying the Amazon Cognito user pool ("AWS").
The "PowerServer:EnableAuthentication" setting is set to true by default. Setting it to false will turn off the authentication feature. The "AWS" block is used to the specify the Amazon Cognito user pool including region, user pool ID, user pool client ID, and user pool client secret.
-