/images/resources/code-examples/code-examples-authzen.png

OpenID AuthZEN Token Procedure

On this page

This example Token Procedure plugin implements an integration with OpenID AuthZEN conformant PDPs. As part of the token issuance process, the token procedure only issues access tokens based on the authorization response from an external PDP.

Installing the Plugin

Build the plugin by running the command mvn package. The command builds the JAR files for the plugin and places them in the target/authzen-token-procedure directory.

To install the plugin, copy the compiled JAR (and all of its dependencies) into a new directory in the plugins directory, e.g. ${IDSVR_HOME}/usr/share/plugins/authzen-token-procedure on each node, including the admin node. A restart of both runtime node(s) and the Admin node is required. For more information about installing plugins, refer to the Curity Plugin SDK.

Configuration

AuthZEN Token Procedure Configuration

The token procedure requires a few configuration parameters.

Authorization Configuration

ParameterTypeDescriptionDefault
Authorize ClientBooleanWhen enabled, the client_id of the request is passed a resource attribute in the request to the PDP.False
Authorize ScopeBooleanWhen enabled, the scope(s) requested are passed as resource attributes to the PDP.False

PDP Configuration

NameTypeDescriptionExampleDefault
HttpClientStringThe ID of the HttpClient that the Authorization Manager use to call the OpenID AuthZEN PDP.authzen-http-client
PDP HostStringThe hostname of the OpenID AuthZEN PDP.authzen-pdp.example.comlocalhost
PDP PortStringThe port that the OpenID AuthZEN PDP is exposing its service on.8443443
PDP PathStringThe path of the OpenID AuthZEN PDP that accepts authorization requests./pdp/access/v1/evaluation

Enable the Token Procedure

To enable the plugin using the admin UI go to your Token Service profile, then Endpoints. Locate the endpoint with type oauth-token and click in the Flows column.

Token Endpoint

Click on the dropdown under the Authorization Code or Client Credentials flow and select + New Plugin.

Enable the Plugin

Limited Flows Supported

Currently, the plugin only supports the authorization code flow and client credentials flow.

Give the plugin a name, e.g. authzen-token-procedure, and select the AuthZEN Token Procedure.

New Plugin

Configure the needed parameters for authorization and PDP connection.

Configure Plugin

Commit the changes.

Using the Plugin

The plugin is invoked when a client requests an access token using either the authorization code flow or client credentials flow -- depending on where you assigned the token procedure. The plugin sends a request to the configured AuthZen PDP to check whether to issue a token. The request is JSON encoded and follows the AuthZEN schema. The attributes in the request depend on the plugin configuration.

Example Request

The following is an example of a request sent to the AuthZEN PDP when using the Authorization Code Flow with both the Authorize Client and Authorize Scope options enabled (line 6 and 7):

json
123456789101112131415161718192020
{
"resource": {
"id": "AUTHORIZATION_CODE",
"type": "api",
"properties": {
"clientId": "client-one",
"scope": "openid foo"
}
},
"subject": {
"id": "alice",
"type": "user"
},
"action": {
"name": "can_issue",
"properties": {
"method": "POST"
}
}
}

Example Response

The response from the PDP is very simple since AuthZEN does not yet support obligations or additional context attributes in the response.

json
123
{
"decision": true
}
Newsletter

Join our Newsletter

Get the latest on identity management, API Security and authentication straight to your inbox.

Newsletter

Start Free Trial

Try the Curity Identity Server for Free. Get up and running in 10 minutes.

Start Free Trial