Securing RESTful Web Services
Define roles, privileges and OAuth Clients to ensure authentication and authorization are required for accessing RESTful web services.
To protect a RESTful web service, you need to:
-
Create a role
-
Create a privilege selecting the role and modules or resources to protect
To enable access to a protected RESTful service using the OAUTH2 Workflow, create an OAuth client using the role and privilege created for protecting the RESTful service.
The following sections provide information on how to create roles, privileges and OAuth clients:
- Managing Roles
You can create, edit and delete roles for RESTful services in the Roles page. - Managing Privileges
You can create, edit and delete privileges for RESTful services in the Privileges page. - Managing OAuth Clients
Using OAuth 2.0-based authentication, you can ensure that your RESTful web services are accessed only by specific users or clients. - Examples
This section provides a few examples on creating an OAuth client with different grant types.
Parent topic: The REST Pages
Managing Roles
You can create, edit and delete roles for RESTful services in the Roles page.
To navigate to the Roles page, from the REST Overview page, click Roles in Objects, or from the menu in the header, select Security and then select Roles.
The actions available in the context menu are:
- Creating a Role
Create a role with a specific name. After the role is created, you can associate it with a privilege. - Editing a Role
This section describes how to edit a role. - Deleting a Role
This section describes how to delete a role. - Viewing Assigned Privileges
This section describes how to view the privileges associated with a role.
Parent topic: Securing RESTful Web Services
Creating a Role
Create a role with a specific name. After the role is created, you can associate it with a privilege.
Parent topic: Managing Roles
Viewing Assigned Privileges
This section describes how to view the privileges associated with a role.
Parent topic: Managing Roles
Managing Privileges
You can create, edit and delete privileges for RESTful services in the Privileges page.
A privilege defines the set of roles, at least one of which an authenticated user must possess to access a RESTful service protected by a privilege.
To navigate to the Privileges page, from the REST Overview page, click Privileges in Objects, or from the menu in the header, select Security and then select Privileges.
The privilege attributes displayed by default in card view are shown in the following figure.
The actions available in the context menu are:
- Creating a Privilege
This section describes how to create a privilege. - Editing a Privilege
This section describes how to edit a privilege. - Deleting a Privilege
This section describes how to delete a privilege.
Parent topic: Securing RESTful Web Services
Creating a Privilege
This section describes how to create a privilege.
Parent topic: Managing Privileges
Editing a Privilege
This section describes how to edit a privilege.
Parent topic: Managing Privileges
Deleting a Privilege
This section describes how to delete a privilege.
- In the Privileges page, for the specific privilege, click
Actions
and select Delete. - You are prompted to confirm. Click Yes.
Parent topic: Managing Privileges
Managing OAuth Clients
Using OAuth 2.0-based authentication, you can ensure that your RESTful web services are accessed only by specific users or clients.
OAuth 2.0 is a standard Internet protocol that defines flows to provide conditional and limited access to a RESTful API. For more information, see OAuth-Based Authentication .
You can create, edit and delete OAuth Clients in the OAuth Clients page.
To navigate to the OAuth Clients page, from the REST Overview page, click Clients in Objects, or from the menu in the header, select Security and then select OAuth Client.
The OAuth Client attributes displayed by default in card view are shown in the following figure.
To create an OAuth client, see Creating an OAuth Client.
The actions available in the context menu are:
-
Edit: See Editing an OAuth Client
-
Export: See Exporting an OAuth Client
-
Delete: See Deleting an OAuth Client
-
Get Bearer Token: This option is displayed only if the client is created with a non-encrypted client secret. It provides the access token to call the RESTful service for Client Credentials and Implicit OAuth grant types. See Creating an OAuth Client Using the Client Credentials Grant Type
-
Manage Secrets: Applicable for Client Credentials and Auth Code grant types. See Managing Secrets
- Rotate: Removes the existing client secret and generates a new one for the OAuth client.
- Revoke: Removes the client secret associated with the OAuth client.
-
Auth Details: Displays the Unique Value and Authorization URI for the Auth Code OAuth grant type. See Creating an OAuth Client Using the Auth Code Grant Type
- Creating an OAuth Client
Creates the OAuth Client and grants the required roles and privileges. - Editing an OAuth Client
This section describes how to edit an OAuth Client. - Deleting an OAuth Client
This section describes how to delete an OAuth Client. - Exporting an OAuth Client
This section describes how to export an OAuth Client. - Managing Secrets
After a client secret is generated for an OAuth client, you can rotate or revoke the secret when required. The Rotate and Revoke options are available in the specific OAuth client's context menu.
Parent topic: Securing RESTful Web Services
Editing an OAuth Client
This section describes how to edit an OAuth Client.
Parent topic: Managing OAuth Clients
Deleting an OAuth Client
This section describes how to delete an OAuth Client.
- In the OAuth Clients page, for the specific client, click
Actions
and select Delete. - You are prompted to confirm. Click Yes.
Parent topic: Managing OAuth Clients
Exporting an OAuth Client
This section describes how to export an OAuth Client.
- In the OAuth Clients page, for the specific client, click
Actions
and select Export. - In the OAuth Client panel, click the Copy icon or Download to copy or download the OAuth Client information.
Parent topic: Managing OAuth Clients
Managing Secrets
After a client secret is generated for an OAuth client, you can rotate or revoke the secret when required. The Rotate and Revoke options are available in the specific OAuth client's context menu.
Note:
With the deprecation of OAUTH and OAUTH_ADMIN PL/SQL packages (see ORDS_SECURITY PL/SQL Package Reference ), the OAuth client secret creation process changes for Client Credentials and Auth Code grant types.
For OAuth clients that have been created with a non-encrypted
secret, the label Legacy is displayed on the card.
Rotate a Client Secret
Removes the existing secret and creates a new one. This is useful when you cannot remember the existing client secret value.
-
If a client secret exists for the OAuth client, click Rotate to remove the existing one and generate a new client secret.
-
If a client secret is revoked and there is no secret value assigned, click Register to generate a client secret for the OAuth client.
Revoke a Client Secret
Removes the existing client secret.
Select Revoke sessions to remove all existing client sessions.
Parent topic: Managing OAuth Clients
Examples
This section provides a few examples on creating an OAuth client with different grant types.
- Creating an OAuth Client Using the Client Credentials Grant Type
This section describes how to create an OAuth Client using the Client Credential grant type. - Creating an OAuth Client Using the Auth Code Grant Type
This section describes how to create an OAuth Client using the Auth Code grant type.
Parent topic: Securing RESTful Web Services
Creating an OAuth Client Using the Client Credentials Grant Type
This section describes how to create an OAuth Client using the Client Credential grant type.
Create an OAuth Client for the created module "example" in Example: Inserting a Record using a POST Handler. The endpoint for the RESTful service is http://xyz.us.comp.com:1234/ords/pdbdba/example/emp/.
Prerequisites
Create a role named HR Admin. See Creating a Role
Create a privilege named Example.HR. See Creating a Privilege
Parent topic: Examples
Creating an OAuth Client Using the Auth Code Grant Type
This section describes how to create an OAuth Client using the Auth Code grant type.
Parent topic: Examples




