Configure Applications in Oracle Identity Cloud Service
For authentication to work properly, you must use the same Oracle Identity Cloud Service instance that is securing your Oracle Fusion Applications Cloud Service and Oracle PaaS (Oracle Visual Builder) or custom HTML5 app. Within Oracle Identity Cloud Service you need to create an application to use for the client authentication.
In this scenario, we separate the matters of Oracle Functions plus Oracle API Gateway from the interaction between Oracle Functions and Oracle Fusion Applications Cloud Service entities, by protecting both using Oracle Identity Cloud Service as separate entities instead of using the same Oracle Identity Cloud Service Application for both.
Typically, Oracle SaaS extension applications written by Oracle customers perform some complex logic. For example, a common scenario is to get data from Oracle Fusion Applications Cloud Service, process it in some way, and push data back to Oracle Fusion Applications Cloud Service to to another target such as a database.
Consequently we present here an architecture with two Oracle Identity Cloud Service applications:
- One application that protects your Oracle Functions as resource and as a trusted client of Oracle Fusion Applications Cloud Service.
- One application that protects your Oracle Fusion Applications Cloud Service instance as a resource.
The instructions in this article will step you through the process of creating and configuring the first of these applications, to protect Oracle Functions. The second of these two applications should already exist: you were required to create and configurean application in order to enable federation between Oracle Fusion Applications Cloud Service and Oracle PaaS.
This setup allows you to configure different rules or policies to access Functions than those rules or policies for a Trusted Client to reach Oracle Fusion Applications Cloud Service. In this configuration, the incoming access token to the API Gateway only requires authorized access to Oracle Functions in order to invoke Function capability, but it does not necessarily have to also have the same grants as are necessary to access the Oracle Fusion Applications Cloud Service instance. The Oracle Visual Builder application requires an associated Oracle Identity Cloud Service Application which will generate the access token to reach API Gateway. This Oracle Identity Cloud Service Application will be the client of the Functions/API Gateway Resource.
The exchanges of tokens shown in the architecture diagram provide an additional protection layer to propagate the identity for the case of a Function being a client of an Oracle Fusion Applications Cloud Service Resource, which is similar to the Oracle WebLogic OAuth assertion process with Oracle Identity Cloud Service used in older supported SaaS extensions, such as those using Oracle Java Cloud Service.
This could mean that in certain use cases, the Oracle Identity Cloud Service application used to generate the token for Oracle Functions could have only resource scopes for Functions but not for Oracle Fusion Applications Cloud Service. In this case, Oracle Functions will not have the capability to re-use the token to invoke Oracle Fusion Applications Cloud Service, but it is valid for reaching Oracle Functions. You can therefore implement logical flows in which some users or Function evocations do not have access, while others do, based on business logic, user roles and privileges, or other criteria.
In other use cases, Oracle Functions can include code to request an access token for Oracle Fusion Applications Cloud Service by using the certificates and user passed in the request from API Gateway.
Create an Application for Oracle Functions in Oracle Identity Cloud Service
Within Oracle Identity Cloud Service you need to create a confidential application to use for the Oracle Functions client authentication.
Within the same Oracle Identity Cloud Service instance that you have federated with your Oracle Fusion Applications Cloud Service instance, create a confidential application and ensure the client configuration is set up so that it enables the Client Credentials, JWT Assertion, and Resource Owner grants.
Prepare and Test Your Oracle Identity Cloud Service Application
Configure the Oracle Identity Cloud Service Confidential application to connect to the application corresponding to your Oracle Fusion Applications Cloud Service instance, and then test the application.
curl --location --request GET 'https://<your fusion instance>.<domain>.com/fscmRestApi/resources/11.13.18.05/expenses' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <JWT_TOKEN>'
This curl query should return Expenses data.Configure the Oracle Functions Oracle Identity Cloud Service Application as a Trusted Client
You need a certificate to be used by the Oracle Identity Cloud Service application as a Trusted Client to make OAuth requests to your Oracle Functions. You can generate a self-signed certificate for use during development, if you don't already have a certificate available.
The provided script genSelfSignedKeypair.sh
can be used to generate
a key if you don't already have one. Execute the script by specifying the tenant and
key alias values. In this example, we provided the mytenant as the tenant
name and fnassertionkey as the key alias.
Import Keystore Information into Oracle Cloud Infrastructure Vault
The assertion process with Oracle Functions will require the usage of the imported keystore and passwords. For the best security and to avoid using hardcoded passwords and secrets, you can take advantage of Oracle Cloud Infrastructure Vault.
The Oracle Cloud Infrastructure Vault service allows you to encrypt and store sensitive data securely. You can store your key store and public key passwords in a Vault and then reference it using the Oracle Cloud Infrastructure SDK in your Oracle Functions Backend to perform the asssertion. You can also safely encrypt and store the JKS file.
In the Before You Begin section of this solution playbook, you were required to set
up your Oracle Functions environment, such as by using the Quick Start Guides. The
Quick Start Guide setup asks you to create a Policy for Functions at the root
Compartment level. In the following example, that policy is named
FnTenancyPolicy
. You need to add additional statements to the
policy to allow Oracle Functions to access Vaults associated with that policy. The
name of the Group for Oracle Functions to be used should be the one you created when
configuring the tenancy in the Quick Start Guide. In this example,
fnGroup1
is the Group of users able to use Oracle
Functions.
Configure the Oracle Visual Builder Application in Oracle Identity Cloud Service
Oracle Visual Builder applications have an associated Oracle Identity Cloud Service Application which is automatically configured as a Trusted Client. You need to configure that application so that it can be used as a client of the Oracle Functions Resource.
As part of the interaction shown in the proposed architecture, an Oracle Visual Builder application associated with an Oracle Identity Cloud Service instance, federated with Oracle Fusion Applications Cloud Service and connected to Oracle Functions, needs to be able to generate an access token that can reach API Gateway and Oracle Functions Resources (as set by Scope). You must configure your Oracle Visual Builder application in Oracle Identity Cloud Service, to set it as a client of the Resource that extends the SaaS functionality by adding the scope of the new Oracle Functions application you created.
When you create a new application in Oracle Visual Builder, an Oracle Identity Cloud
Service application is automatically created. For example, if you create an application
called TestSaaSExtensionFN
, you can navigate to the Oracle Identity Cloud
Service console and list applications and you should find an application called
TestSaaSExtensionFN
.