Consentors
Consentors are a Curity extensibility mechanism used to perform additional processing during delegation and token issuance, including _validation_, _information retrieval_, and _user interaction_. Consentors are executed as a part of the authorization request for various flows (e.g., code, implicit and assisted token), after user-consent has been gathered and before the delegation or token is issued.
There are two types of consentors: generic consentors (frequently named only by consentors), and signing consentors.
Generic consentors receive the consent attributes, which are made up of the client identifier, authentication attributes, and consented scope and claims, and produce a consentor result, that is added to the created delegation. During their execution, generic consentors can also:
-
Interact with the user via multiple HTML pages and forms, for instance to gather extra information.
-
Interact with external services and data sources.
-
Terminate the flow with a non-success response, which is propagated to the client.
Signing consentors are a specialization of generic consentors, used when the goal is just to sign the consented information. They receive a text-to-display and an object-to-sign and use this information to produce a signature that is added to the resulting delegation:
-
The text-to-display is computed by a configured JavaScript procedure.
-
The object-to-sign is a JWT token, issued by a configured token issuer, which contains the consent attributes as well as the text-to-display.
Signing consentors can also involve user interaction, namely to show the information that will be signed. However this interaction is rather constrained when compared with the one available to generic consentors.
Curity already includes built-in consentors, namely BankID , however new consentors can be added as plugins.
Profile configuration#
Each token profile defines the list of consentors usable on that profile. This list is configured under the configuration-reference/profiles/profile/settings/authorization-server/consentors element, where each consentor is defined by a configuration-reference/profiles/profile/settings/authorization-server/consentors/consentor element.
The following figure illustrates this list, present in the profile’s configuration user interface.

Consentor configuration is comprised by consentor-independent information and consentor-specific information. The consentor-specific information is described in the documentation for each consentor.
The consentor-independent configuration information for generic consentors is comprised by:
-
Mandatory
idwith the consentor instance identifier. -
Optional
descriptionwith a consentor description for human-interface purposes.
For signing consentors, this common configuration information is extended with:
-
Optional
token-issuerwith the identifier for a token issuer withgenericpurpose. -
Mandatory
text-to-display-procedurewith the definition of a JavaScript procedure. -
Optional
webservicewith a definition of a web service client. -
Optional
attribute-data-sourcewith an identifier to an existing data source.
The configured token-issuer is used to sign the JWT containing the consent attributes and the text-to-display.
If no token-issuer is configured, then the profile’s default token issuer is used.
The text-to-display-procedure is used to create the text-to-display from the consented information.
It must include the definition of a result function that returns this text-to-display string.
This function receives a context object with:
-
The
consentAttributesfield with the consent attributes object, comprised by the following inner fields:-
clientId- the client identifier string. -
authenticationAttributes- the authentication attributes object. -
scopes- a string array with the consented scope names. -
claims- a string array with the consented claim names.
-
-
The
attributeDataAccessProviderfield with a data source, if theattribute-data-sourceconfiguration element is defined. -
The
getWebServiceClient()method that returns a Web Service Client, if thewebserviceconfiguration element is defined. -
The
getClient()method that returns the requestingclientobject.
The following code excerpt illustrates the context available to the text-to-display procedure.
Example text-to-display procedure.
function result(context) {
// Just to illustrate subject attributes usage
var subject = context.consentAttributes.authenticationAttributes.subject.subject
if (subject != context.subjectAttributes().subject) {
// Send error back to the requesting client
throw exceptionFactory.forbiddenException('Subject mismatch')
}
// Just to illustrate context attributes usage
var acr = context.consentAttributes.authenticationAttributes.context.acr
if (acr != context.contextAttributes().acr) throw exceptionFactory.forbiddenException('Acr mismatch')
// Just to illustrate the attribute data source
var attributes = context.attributeDataAccessProvider.getAttributes(subject)
if (!attributes) throw exceptionFactory.forbiddenException('missing attributes')
// Just to illustrate the web service client
var response = context.getWebServiceClient().get()
if (response.statusCode != 200)
throw exceptionFactory.forbiddenException('bad response status ' + response.statusCode)
// To illustrate the client object
var client = context.client
var clientName = client.name
var scopesAndClaims = Java.from(context.consentAttributes.claims).concat(
Java.from(context.consentAttributes.scopes)
)
// the text-to-display
return clientName + ' requests access to: ' + scopesAndClaims.join(', ')
}
Any log entries issued by the text-to-display procedure, using the logger global object,
are associated with the se.curity.identityserver.scripting.textToDisplayProcedure.<consentorId> logger name,
where consentorId is the consentor’s instance identifier.
The following figure illustrates the configuration for a signing consentor:

- The configuration elements above “Signing Consentor Type” are common to all signing consentors.
- The “Signing Consentor Type” input selects the concrete signing consentor to use (
bankid-signing-consentorin the example). - The configuration elements below “Signing Consentor Type” are specific to the concrete signing consentor being used.
Client configuration#
Consentors are enabled per client when the client’s configuration-reference/profiles/profile/settings/authorization-server/client-store/config-backed/client/user-consent setting is enabled. By default, all the profile’s consentor instances are applicable to a client. However a client configuration can configuration-reference/profiles/profile/settings/authorization-server/client-store/config-backed/client/user-consent/consentors a subset of the profile’s consentor instances that should be used.
As an example, if a profile has the consentor-1 and consentor-2 consentor instances configured,
then the client behaviour will be as follows:
- If client has
user-consentdisabled, then no consentor is considered. - If client has
user-consentenabled but doesn’t specify any consentor, then bothconsentor-1andconsentor-2are considered. - If client has
user-consentenabled and defines a consentor list withconsentor-1, then onlyconsentor-1is considered.
It is also possible to disable the built-in consent form and have only consentors run.
This is achieved by enabling the only-consentors element.
The following diagram illustrate the configuration user interface for a specific client.

In this case, the client is explicitly listing a single consentor (the-consentor-id),
so only this consentor will be applicable when this client is used, independently of the consentors configured on the
profile.
Notice also that “Only Consentors” is disabled, meaning that both the built-in consent form and the configured consentor
will be used.
A similar configuration-reference/profiles/profile/settings/authorization-server/dynamic-client-registration/non-templatized/user-consent also exists for the profile’s non-templatized dynamic clients.
Consentor selection#
If more than one consentor is applicable to a given request, then a consentor selection form is presented to the user.
This form is defined by the consentor-chooser.vm and consentor-chooser-single-color.vm templates,
located in the templates/core/fragments.
The choice between these two templates, as well as additional presentation characteristics,
are defined by the settings single_color_consentor_chooser and icons_only_consentor_chooser.
The messages used by the form are located in messages/core/{lang}/views/select-consentor.
Consentor templates#
The consentor templates get the String value of the original query of the authorization request set in the template context as
_originalQuery template variable.
Consentor result#
The result of a successful consentor execution is stored in the issued delegation and is available to procedures. The following code excerpt illustrates how this information can be obtained.
Consentor result usage example.
// a procedure with access to issued delegations
function result(context) {
...
var issuedDelegation = ...;
var consent = issuedDelegation.consent;
var consentorId = consent.consentorId;
var consentorResultAttributes = consent.consentorResultAttributes;
var consentorSpecificInfo = consentorResultAttributes.consentorSpecificInfo.
...
}
The issued delegation consent field is an object with consent-related information.
-
If user consent is disabled in the client and was not forced via the
promptrequest parameter, then this field is absent (i.e. no user consent logic was run). -
If a consentor was executed, this field will have the following nested fields.
-
consentorIdfield with the consentor identifier. -
consentorResultAttributesfield with the consentor result object. The shape of this object depends on the concrete consentor used, and is described in the consentor’s documentation. In the case of signing consentors, theconsentorResultAttributeswill contain an attribute ofsigningConsentorObjectToSignwhich is a JWT consisting of the data that were previously signed from the signing consentor.
-