4.7 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:
4.7.1 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:
4.7.2 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:
4.7.3 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.
The actions available in the context menu are:
- Creating an OAuth Client
- Editing an OAuth Client
- Deleting an OAuth Client
-
Get Bearer Token: Provides the access token to call the RESTful service.
4.7.4 Example: Creating an OAuth Client
This section describes how to create an OAuth Client using an example.
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