Brian Makarewicz
← Back to all posts

Setting Up Security for Oracle's BOSS REST APIs

12 min readIntegration

My previous post covered what Oracle's BOSS REST APIs under /api/boss do, with three example calls. This one covers the security setup those calls need. BOSS doesn't accept Basic authentication, so every call needs an OAuth token from the pod's identity domain, and the user or application behind that token needs Fusion roles that hold permission groups, which most seeded job roles don't have yet.

The four security layers a BOSS call passes through

Each layer answers one question, and a request meets them in this order:

LayerThe question it answersWhere it is set upWhat you see if it fails
1. OAuth client and scopeIs this program allowed to ask for a BOSS token at all?An application in the pod's OCI IAM identity domain, with the Oracle Boss Cloud (Spectra) scope, urn:opc:resource:fusion:<pod>:boss/The identity domain refuses the token request, and a call without a token gets a 401.
2. Grant typeWhose identity does the token carry, a person's or the application's?The grant types allowed on that application. Authorization code (with PKCE for a public client) gives a token for the person who signs in, and client credentials gives a token for the application itself.The identity domain refuses a grant type the application doesn't allow.
3. Roles with permission groupsIs that identity allowed to read or change this business object?In Fusion. The profile option ORA_ASE_SAS_INTEGRATION_ENABLED must be Yes at Site level, and the role needs Enable Permission Groups switched on and the object's permission group. A person gets roles the usual way. An application's roles are assigned on the Application Extensions page of the Security Console.403 Authorization is denied for action read on business object <object>.
4. Data securityWhich rows can it see?The same data roles and security profiles that limit what a user sees in the UI. For General Ledger that is the data access set, which Fusion assigns only to users, so an application that signs in with client credentials sees no journal rows.Rows the identity isn't allowed to see are left out of the results, and when it can see none of them the extraction endpoint returns 204 No Content.

Layer 3 is the one that catches people off guard, because a job role that works in the UI doesn't necessarily work for BOSS. Permission groups are a newer layer on top of job roles and privileges, and each one grants an action on one business object. Oracle's A-Team uses the common lookups API as its example: a permission group named read: Common Lookup Type Permission Group grants read access to the business object Common Lookup Type. Seeded job roles such as Accounts Payable Manager don't contain permission groups yet, so a BOSS call made with only those roles returns 403.

To see which roles do, open the Security Console, go to Roles and change the search from Roles and Privileges to Roles and Permission Groups. That search only finds roles that contain permission groups. Pick a role, set Show to Permission groups and click Load Indirect Relationships to list everything it inherits. For the queries in the previous post, the role is Ledger Inquiry Assistant (ORA_GL_LEDGER_INQUIRY_ASSISTANT_DISCRETIONARY), a read-only role Oracle added for the Ledger Agent. It inherits a General Ledger inquiry duty that holds permission groups such as read:Journal Source, read:Journal Header and read:Journal Line.

Ledger Inquiry Assistant in the Security Console, searched as Roles and Permission Groups with Show set to Permission groups, listing read:Journal Source, read:Journal Line and read:Journal Header

Choosing how to get a token

Which kind of OAuth client you need depends on whether a person is there to sign in:

A person signs in (a script, Postman, a command-line tool, an agent working for you)No person signs in (a scheduled job, Oracle Integration or another server)
Identity domain applicationMobile Application, which the identity domain uses for any public clientConfidential Application
Grant typeAuthorization code with PKCEClient credentials
What proves the program is genuineA one-time PKCE code it generates for each sign-in, so no secret is storedA client secret
Redirect URLRequired, and registered in advanceNot used
Whose identity the token carriesThe person who signed in, with their roles and their data accessThe application, with only the roles you assign to it and no data access
How long it lastsAbout an hour. If the client allows the Refresh token grant, the program can renew it without another sign-inAbout an hour. Request a new token when it expires

PKCE stands for Proof Key for Code Exchange, and it is how a program with no secret proves it is the same program that started the sign-in. Before it sends the person to sign in, the program makes a random value and sends only a hash of it. When it swaps the returned code for a token, it sends the original value, and the identity domain checks it against the hash. A code stolen on its way back is useless to anyone else, because they don't have the original value.

What redirect URLs protect

When a person signs in through OAuth, your program never sees their password. It sends the browser to the identity domain's sign-in page, the person signs in there, and the identity domain sends the browser back to a return address with a one-time code that your program swaps for a token. That return address is the redirect URL, and the identity domain only sends the code to addresses registered on the client in advance:

How a registered redirect address stops a stolen sign-in code

This is also why you can't reuse the client Fusion already has in the identity domain. Its registered return addresses all point to Fusion's own pages, so a request to send the code anywhere else fails with invalid_redirect_uri.

You don't need to expose anything to the internet for this. The return address only has to be one the browser can reach, so a script can listen locally on http://127.0.0.1:<port>/callback, and Postman provides its own hosted callback, https://oauth.pstmn.io/v1/callback, which it uses when you tick Authorize using browser, and it picks up the code itself, so you register that address on the client and nothing else.

Setting up a client for a person who signs in

These steps set up a client that Postman uses to sign a person in and call BOSS. A script uses the same client with its own redirect URL.

  1. Find the Fusion identity domain. In the OCI console, go to Identity & Security > Domains and open the domain whose Domain type is oracle-apps. Its Domain URL matches the address your Fusion login page redirects to. Then open Integrated applications.

The OCI Domains list, where the Fusion domain is the one of type oracle-apps

  1. Add a Mobile Application. Click Add application and choose Mobile Application. The name is misleading, because nothing runs on a phone. In the identity domain, "Mobile Application" means a public client, a program on someone's own computer that can't keep a secret safe.

The Add application chooser with Mobile Application selected

  1. Configure OAuth. Open the new application's OAuth configuration tab and click Edit OAuth configuration. Tick Authorization code and Refresh token and leave the other grant types unticked. Add the redirect URL, which for Postman is https://oauth.pstmn.io/v1/callback. If a script uses http://127.0.0.1, turn on Allow non-HTTPS URLs as well.

Edit OAuth configuration with Authorization code and Refresh token ticked and the Postman redirect URL

  1. Add the BOSS scope. At the very bottom, under Token issuance policy, turn on Add resources, which is easy to miss. Click Add scope and tick Oracle Boss Cloud (Spectra), which covers /api/boss. If it isn't in the list, you are in the wrong identity domain.

The token issuance policy with Add resources on and the Oracle Boss Cloud (Spectra) scope added

  1. Activate it. Save, copy the Client ID from the OAuth configuration tab (not the Application ID on the Details tab, which looks similar), and choose Actions > Activate.

The OAuth configuration tab with the Client ID

  1. Check the Fusion profile option. In Setup and Maintenance, open the task Manage Administrator Profile Values and confirm that ORA_ASE_SAS_INTEGRATION_ENABLED is Yes at Site level.

Manage Administrator Profile Values showing ORA_ASE_SAS_INTEGRATION_ENABLED set to Yes at Site level

  1. Give the user a role with permission groups. The person who signs in needs a role that holds the permission group for each object they query. For the queries in the previous post that is Ledger Inquiry Assistant, shown earlier, assigned to the user along with their usual data access.

The user's roles in the Security Console, including Ledger Inquiry Assistant

  1. Get a token in Postman. On the request's Authorization tab, choose OAuth 2.0 and set the grant type to Authorization Code (With PKCE). Tick Authorize using browser, enter https://<identity domain>/oauth2/v1/authorize as the Auth URL and https://<identity domain>/oauth2/v1/token as the Access Token URL, paste the client ID, leave the client secret blank, choose SHA-256 and set the scope to urn:opc:resource:fusion:<pod>:boss/. Click Get New Access Token, sign in to Fusion in the browser window that opens, then click Use Token.

Postman's Authorization tab set up for Authorization Code (With PKCE)

  1. Send a test call. Send this request, which reads the General Ledger journal sources that need approval:
POST https://<your-pod>/api/boss/data/objects/ora/erpCore/accountingSetup/v1/journalSources/$query
Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json
{
  "collection": {
    "filter": "journalApprovalFlag = true",
    "limit": 5,
    "sortBy": [ { "userJeSourceName": "asc" } ]
  },
  "fields": [ "userJeSourceName", "description", "journalApprovalFlag" ]
}

A 200 with an items array means everything is in place, and on my pod it returned two sources, AutoCopy and Real Estate. A 401 means the token wasn't accepted, which is usually the scope, and a 403 means the token works but the user's roles lack the permission group for that object. A 406 means the request didn't send Accept: application/json.

Your code needs the same settings you gave Postman, which are the authorize and token URLs, the client ID, the redirect URL and the BOSS scope. Because this is a public client, there is no secret to store.

Setting up a client for an integration

An integration with no person present uses a Confidential Application and the client credentials grant. The token then carries the application's own identity, and Fusion gives it only the roles assigned to the application.

  1. Add a Confidential Application. In Integrated applications, click Add application, choose Confidential Application and give it a name.

The Add application chooser with Confidential Application selected

  1. Allow client credentials. On the OAuth configuration tab, choose Configure this application as a client now, tick Client credentials and leave the other grant types unticked.

Edit OAuth configuration with the application configured as a client and only Client credentials ticked

  1. Add the BOSS scope. Under Token issuance policy, turn on Add resources, click Add scope and tick Oracle Boss Cloud (Spectra), then save and choose Actions > Activate.

The Resources list with the Oracle Boss Cloud (Spectra) scope added

  1. Copy the client ID and secret. Both are on the OAuth configuration tab. Treat the secret like a password, and keep it in a secrets store rather than in a repository, a configuration file or a screenshot.

The OAuth configuration tab with the client ID and secret

  1. Give the application a role. In the Fusion Security Console, open Application Extensions. Under Custom OAuth Client Applications, pick the application, open Roles, click Add and add the role, such as Ledger Inquiry Assistant.

Application Extensions in the Security Console, listing the custom OAuth client applications

The integration application with ORA_GL_LEDGER_INQUIRY_ASSISTANT_DISCRETIONARY assigned

  1. Get a token and call. In Postman, set the grant type to Client Credentials, enter the Access Token URL https://<identity domain>/oauth2/v1/token, the client ID and secret and the BOSS scope, and choose Send as Basic Auth header. Then send a request with Accept: application/json.

Postman's token settings for the Client Credentials grant

With this token, the journal sources call from step 9 of the previous section returns a 200, because journal sources are setup data that isn't secured by ledger. A query on journals, such as the extraction call in the previous post, returns 204 No Content. The role lets the application run the query, but General Ledger only shows the ledgers in the user's data access set, and because data access sets are assigned to users in Manage Data Access for Users, an application signed in as itself sees no journals.

For data that is secured like this, the program has to call as a user. Two common ways to do that are a JWT user assertion signed with a certificate and Oracle Integration's own options, and I'll cover both in a separate post.

Lessons learned

  • When a call returns 403, first confirm in the Security Console that the role holds the object's permission group.
  • Add Accept: application/json to every request, because Postman sends Accept: */* unless you change it and BOSS answers that with 406 Not Acceptable and an empty body.
  • When a program needs data that is secured by ledger, business unit or something similar, have it call as a user, because an application signed in as itself gets permission to query but sees no rows.