Tutorial: Authenticating users in the Developer Portal by using an external server

Use a custom module to enable an external server to authenticate users in the Developer Portal.

Before you begin

You must have administrator access to complete this task.

Portal Delegated User Registry must be selected in the API Manager UI. For more information, see Portal Delegated User Registry. When Portal Delegated User Registry is selected, the HybridAuth module is automatically enabled in the Developer Portal.

Download the custom module sampleauth.zip and extract the files.

About this task

In this tutorial, you can enable the Developer Portal to authenticate users by using an external server. This is done by configuring a custom module and installing it in the Developer Portal.

The file that you download is a custom module that contains multiple functions that can be configured, and any further specifications that you want to define, to set up authentication with an external server.

For more information, see Creating custom modules to extend functionality.

Procedure

To configure the custom module to enable an external server to manage authentication for the Developer Portal, edit the sampleauth.module file as shown in the following steps:

  1. In the sampleauth_register_user function, set the target URL to call when creating new users by replacing the following example target with the correct endpoint:
    $url = 'https://example.com/users/register';
  2. In the sampleauth_authenticate function, set the target URL to call to check the authentication credentials of the user by replacing the following example target with the correct endpoint:
    $url = 'https://example.com/users/auth';
  3. Optional: Edit the curl SSL settings in the _sampleauth_json_http_request function as you require.
  4. Optional: To provide further information for others that might use your module, configure the fields in the sampleauth_help function to your specification.
  5. After you have finished configuring the module, click Save, and then compress the module files into a .zip file.

To install the configured custom module in the Developer Portal:

  1. On the administrator dashboard, click Modules
  2. Click Install new modules.
  3. You can enter a path to the module in the Install from a URL field. Alternatively, you can upload a module under the Upload a module or theme archive to install heading.
  4. Click Install.

To enable the module:

  1. On the administrator dashboard, click Modules.
  2. Search for and enable the custom module.
  3. Click Save configuration.

Results

You configured and installed a custom module that enables users of the Developer Portal to authenticate by using an external server.