Authenticate the User In a Visual Builder Application

To enable an Intelligent Advisor interview embedded in an Oracle Visual Builder application to load and submit data from/to the appropriate objects in Oracle Fusion, the Visual Builder application needs to authenticate and pass identity. To do this, a service connection is called to retrieve a JWT token from Oracle Fusion on application load, and sets the variable, opaEngagementCloudJWT, used in the Intelligent Advisor Interview component.

The steps required to set this up are:

  1. In Oracle Fusion, generate a JWT token for the logged-in user from Oracle Fusion which can be used in REST web services to authenticate the user. One way in which this can be done is explained in Generate a JWT Token for the Logged-In User.
  2. In Visual Builder, retrieve the JWT token. The method you use to do this will depend on the authentication scheme you are using. If you used the authentication scheme described in Generate a JWT Token for the Logged-In User, you could retrieve the JWT token as follows:
    1. In Visual Builder, open your application.
    2. Open the Services tab and click +, then Service Connection. to create a service connection. The way in which you create the service connection will depend on the source of your service connection. One way in which you can do this is to point to a URL of an endpoint and define its parameters declaratively. To do this:
      1. In the Create Service Connection wizard, on the Select Source page, select Define By Endpoint.
      2. On the next page, specify:
        • Method: GET
        • URL: the URL for the REST service request (to obtain the JWT token)
        • Action Hint: Get Many

        The Create Service Connection screen in VBCS

        Click Next.

      3. On the next page on the Overview tab, specify getJWT as the Service Name.
      4. On the Server tab, in the Authentication drop-down, select:
        •  Propagate Current User Identity if using Oracle Identity Cloud Service.
        •  Basic otherwise. Enter the Username and Password for the user.

        For more information, see Configure Connection and Authentication Types for Service Connections and Backends.

      5. On the Test tab:
        • In the Request section, click Send Request.
        • In the Response section, check that a JWTToken is returned.

          A JWT Token returned in the response to a GET request
        • Click Save as Example Response.
      6. Click Create. The Services pane now lists getJWT as a service connection.

        A getJWT service connection in a Visual Builder application
        For more information, see Create a Service Connection from an Endpoint.
  3. Create an action chain that retrieves the JWT token from Oracle Fusion when the application is loaded and then sets the opaEngagementCloudJWT variable used in the Intelligent Advisor Interview component. To do this:
    1. Select the application node in the Web Apps pane to open the application in the designer.
    2. Open the Event Listeners tab.
    3. Click the + Event Listener button.
    4. In the Create Event Listener dialog, select vbEnter. This event is used to trigger data fetches and is dispatched after all the page scoped variables have been added and initialized to their default values, values from URL or persisted values. Click Next.
    5. Click the plus button next to Application Action Chains. In the New Application Action Chain id field, specify getJWT. Click Finish. The Event Listeners view for the application now lists the getJWT event as a Lifecycle Event Listener.

      The Events view for a web application in VBCS

      For more information, see Create Event Listeners for Events.
    6. Select the getJWT event listener and then click Go to Action Chain. The Actions editor for the getJWT action chain is displayed.
    7. Drag the Call REST action from the Actions palette into the action chain.

      The action editor in VBCS showing a Call REST Endpoint control being added to an action chain
    8. In the Call REST right-hand pane, click Select next to Endpoint.
    9. In the Select Endpoint dialog, select the endpoint of the service connection for the JWT token (for example, the getJWT connection).

      The Select Endpoint for a Call Rest Action in a Visual Builder application

      Click Select. For more information, see Add a Call REST Endpoint Action.
    10. Drag the Assign Variables action from the Actions palette into the action chain in the success branch.

      The action editor in VBCS showing a variable being added to an action chain for success
    11. In the Assign Variables right-hand pane, type a name for the variable in the Id field (for example, assignJWT), then click Assign. This opens the Assign Variables dialog where you can map the source of the results to an application variable.
    12. Drag the source of the results in the Sources pane onto the target application variable in the Targets pane. (For example, drag the JWTToken_c item from the Action Chain to the opaEngagementCloudJWT application variable.)

      The Assign Variables mapping view in VBCS

      Click Save. The Assign Variables right-hand pane now shows the opaEngagementCloudJWT variable as mapped.

      A getJWT action chain in VBCS

      The authentication steps are now complete.