Example flow for services with user context

The following diagram identifies the flow of authentication and authorization information for services with user context. Colors are used in the following ways:

  • Orange - credentials information
  • Blue - endpoint access information
  • Green - resource access information
  • Red - proxy user and session user information

Some values are used to determine multiple types of access. These values initially appear as black (when they do not apply to a single type of access), and then later appear in one or more specific colors (to reflect the value is being used at that point in the process for a specific type of access).

Services with user context: internal users

In the following example, an API call is triggered by the Acme policy billing application, BillingApp, on behalf of Alice Applegate, who is an internal user.


Authentication flow for services with internal user context
  1. When BillingApp triggers an API call, it must first request a JWT from Guidewire Hub. The request for the JWT includes the client ID (0oaqt9pl1vZK1kybt0h7), the secret (aSecret), the application's API role (scp.pc.acme_billingapp), the application's resource access strategy (pc.service), the fact that the call will be made for a user (pc.allowusercontext) and additional deployment information (tenant.acme, project.default, planet_class.prod).
  2. Guidewire Hub authenticates the services based on the client ID and secret. It also verifies that the API role and resource access strategy provided in the request match what was specified when the service was registered with Guidewire Hub.
  3. Guidewire Hub generates a JWT and sends it to the service. This JWT includes the client ID (cid) and a scp token claim which names the API role (scp.pc.acme_billingapp), the resource access strategy (pc.service), the pc.allowusercontext value (which indicates that user information is specified in an additional user context header), and additional deployment information.
  4. The service sends the API request to PolicyCenter along with the JWT and a user context header that identifies the user (aapplegate@acme.com), the user's resource access strategy (pc_username), and resource access ID (aapplegate@acme.com).
  5. PolicyCenter must determine the endpoint access at both the service level and the user level. It starts at the service level. Based on the API role value in the JWT (scp.pc.acme_billingapp), the acme_billingapp.role.yaml API role file is used to define the service-level access.
  6. Next, PolicyCenter determines the user-level endpoint access.
    1. Using the user name in the user context header (aapplegate@acme.com), PolicyCenter queries for the user roles that this user has. One role is returned: Underwriter.
    2. Based on the returned role, the Underwriter.role.yaml API role file is used to define the user-level access.
  7. PolicyCenter must also determine the resource access at the service level and the user level. It starts with the service-level resource access strategy. Based on the resource access strategy value in the JWT (pc.service), it grants service-level resource access as defined in the service access.yaml files. (* PolicyCenter starts with service_ext-1.0.access.yaml, but this file references additional access.yaml files whose name starts with "service".)
  8. PolicyCenter determines the user-level resource access strategy. Based on the resource access strategy value in the user context header (pc_username), it grants user-level resource access as defined in the internal access.yaml files. (* PolicyCenter starts with internal_ext-1.0.access.yaml, but this file references additional access.yaml files whose name starts with "internal".)
  9. Proxy user access is not relevant for services with user context when the user is an internal user.
  10. PolicyCenter processes the request.
    1. The session user is the internal user: aapplegate@acme.com.
    2. The endpoint access is the intersection of the endpoints and operations defined granted at the service level (acme_billingapp.role.yaml) and at the user level (Underwriter.role.yaml). Endpoints, operations, and fields must be listed at both levels to be available to the call.
    3. The resource access is the intersection of the resources accessible to the service (as defined in the service access.yaml) and the resources available to the user (as defined in the internal access.yaml using the resource access ID of aapplegate@acme.com). In the base configuration, the service access.yaml files make all resources available. Therefore, logically speaking, the service-level resource access does not specify any restrictions. The call can access any resource provided it is available through the user-level resource access.
  11. PolicyCenter provides the response to the initial call.

Services with user context: external users

In the following example, an API call is triggered by the Acme policy billing application, BillingApp, on behalf of Ray Newton, who is an external user.


Authentication flow for services with external user context
  1. When BillingApp triggers an API call, it must first request a JWT from Guidewire Hub. The request for the JWT includes the client ID (0oaqt9pl1vZK1kybt0h7), the secret (aSecret), the application's API role (scp.pc.acme_billingapp), the application's resource access strategy (pc.service), the fact that the call will be made for a user (pc.allowusercontext) and additional deployment information (tenant.acme, project.default, planet_class.prod).
  2. Guidewire Hub authenticate the services based on the client ID and secret. It also verifies that the API role and resource access strategy provided in the request match what was specified when the service was registered with Guidewire Hub.
  3. Guidewire Hub generates a JWT and sends it to the service. This JWT includes the client ID (cid) and a scp token claim which names the API role (scp.pc.acme_billingapp), the resource access strategy (pc.service), the pc.allowusercontext value (which indicates that user information is specified in an additional user context header), and additional deployment information.
  4. The service sends the API request to PolicyCenter along with the JWT and a user context header that identifies the user (rnewton@email.com), the user's resource access strategy (pc_accountNumbers), and resource access ID (464778619).
  5. PolicyCenter must determine the endpoint access at both the service level and the user level. It starts at the service level. Based on the API role value in the JWT (scp.pc.acme_billingapp), the acme_billingapp.role.yaml API role file is used to define the service-level access.
  6. Next, PolicyCenter determines the user-level endpoint access. Based on the contents of the groups token claim in the user context header (gwa.prod.pc.Account_Holder), the Account_Holder.role.yaml API role file is used to define the user-level access.
  7. PolicyCenter must also determine the resource access at the service level and the user level. It starts with the service-level resource access strategy. Based on the resource access strategy value in the JWT (pc.service), PolicyCenter grants service-level resource access as defined in the service access.yaml files. (* PolicyCenter starts with service_ext-1.0.access.yaml, but this file references additional access.yaml files whose name starts with "service".)
  8. Next, PolicyCenter determines the user-level resource access strategy. Based on the resource access strategy value in the user context header (pc_accountNumbers), it grants user-level resource access as defined in the accountNumbers access.yaml files. (* PolicyCenter starts with accountNumbers_ext-1.0.access.yaml, but this file references additional access.yaml files whose name starts with "accountNumbers".)
  9. To determine which proxy user to assign to the session, PolicyCenter calls the RestAuthenticationSourceCreator plugin. The user context header specified a resource access strategy of pc_accountNumbers. So, the plugin returns the proxy user for external users: extuser.
  10. PolicyCenter processes the request.
    1. The session user is the proxy external user: extuser.
    2. The endpoint access is the intersection of the endpoints and operations defined granted at the service level (acme_billingapp.role.yaml) and at the user level (Account_Holder.role.yaml). Endpoints, operations, and fields must be listed at both levels to be available to the call.
    3. The resource access is the intersection of the resources accessible to the service (as defined in the service access.yaml) and the resources available to the user (as defined in the accountNumbers access.yaml using the resource access ID of 464778619). In the base configuration, the service access.yaml files make all resources available. Therefore, logically speaking, the service-level resource access does not specify any restrictions. The call can access any resource provided it is available through the user-level resource access.
  11. PolicyCenter provides the response to the initial call.