How to define SAF profiles for authorization roles

zosConnect-3.0 Applies to zosConnect-3.0.

Define SAF EJBROLE profiles for each of the roles that are defined in your OpenAPI definitions and authorize the appropriate SAF users and groups to those profiles.

This task is applicable when IBM® z/OS® Connect is used as an API provider.

Before you begin

About this task

Define SAF EJBROLE profiles for each of the roles that are defined in the OpenAPI definitions and permit the appropriate RACF users and groups READ access to those profiles.

The users and groups permitted READ access to the EJBROLE profiles are authorized to invoke the corresponding API operations protected with the OpenAPI definitions specification extension x-ibm-roles-allowed values.

This task uses RACF as the security manager for z/OS Connect. If you are using an alternative External Security Manager, refer to the appropriate product documentation for the equivalent commands.

Procedure

  1. Configure z/OS Connect to use SAF for authorization.
    For example, add the following to the configuration file.
    <safAuthorization/>

    To display SAF authorization messages such as RACF ICH408I, when unauthorized users attempt to access z/OS Connect, specify the attribute racRouteLog="ASIS".

    For more information, see A launch icon to indicate a link opens a new tab or window. safAuthorization, in the WebSphere Application Server for z/OS Liberty documentation.

  2. Optional: Customize the prefix used for SAF profiles.
    This is specified by the profilePrefix attribute of the safCredentials element in the configuration file.

    The default value is profilePrefix="BBGZDFLT".

    For more information, see A launch icon to indicate a link opens a new tab or window. safCredentials, in the WebSphere Application Server for z/OS Liberty documentation.

  3. Optional: Customize the SAF EJBROLE profile name for API roles.
    This is specified by the profilePattern attribute of the safRoleMapper element in the configuration file. The default value is profilePattern="%profilePrefix%.%resource%.%role%".
    Where:
    • %profilePrefix% value is the value of the profilePrefix attribute on the safCredentials element, by default "BBGZDFLT".
    • %resource% is either the value of the name attribute of the webApplication element for the API .war file. If not specified, then the file name of the API .war file.
    For example,
    • If the configuration file contains <webApplication name="Employees" location="${server.config.dir}/apps/api.war"> then the %resource% value is Employees.
    • If the configuration file contains <webApplication location="${server.config.dir}/apps/api.war"> then the %resource% value will be api.
    • %role% is a value from the x-ibm-zcon-roles-allowed OpenAPI definition specification extension for the API operation or globally for the API.
    For more information, see A launch icon to indicate a link opens a new tab or window. safRoleMapper in the WebSphere Application Server Liberty documentation.
  4. Define the SAF EJBROLE profiles.
    For example, to define a SAF EJBROLE profile for the Employees API role Manager by using the default profilePrefix value, issue the RACF command.
    RDEF EJBROLE BBGZDFLT.Employees.Manager UACC(NONE)
    Repeat for each API role that requires authorization.
    Note: RACF supports the use of generic profile names. See A launch icon to indicate a link opens a new tab or window. Creating resource group profiles and A launch icon to indicate a link opens a new tab or window. Other rules for generic profile names in the z/OS documentation.
  5. Activate the EJBROLE class.
    Issue the following RACF command.
    SETROPTS CLASSACT(EJBROLE)
  6. Permit access to the SAF EJBROLE profiles.
    For example, to permit RACF user SALLY to the Employees API role Manager, issue RACF command.
    PERMIT CLASS(EJBROLE) BBGZDFLT.Employees.Manager ACCESS(READ) ID(SALLY)
    Repeat for each API role that requires authorization and each user or group that requires access.
    Note: The ID value can be either a RACF user or RACF group.
  7. Refresh the EJBROLE class.
    Issue the following RACF command.
    SETROPTS RACLIST(EJBROLE) REFRESH
  8. Ensure the user IDs and groups have also been granted READ access to the profilePrefix APPL profile.
    For example, to permit user SALLY access to the default profilePrefix BBGZDFLT, issue the following RACF command.
    PERMIT BBGZDFLT CLASS(APPL) ACCESS(READ) ID(SALLY)

Results

SAF EJBROLE profiles have been defined for the API roles and appropriate RACF users and groups have been permitted access to those profiles. These users are authorized to invoke the API operations.