Post-processing procedures are used to customize (add/read/modify/remove) the response parameters after processing. The value returned by this procedure will be used to render the final response.
This is currently supported only on Dynamic Client Registration endpoint. It can be used with both registration and management endpoints for dynamic clients.
A post-processing procedure has the following format.
1 2 3 4 5 6 7 8 9 10 11 12 13
function result(context) { logger.trace("Running post-processing script") var request = context.getRequest() var httpMethod = request.getMethod() var attributes = context.getResponseFields() attributes.extra_post_processing_attribute = 'set-from-post-processing-script-for-' + httpMethod.toLowerCase() attributes.client_secret = null // remove attributes.scope = context.getResponseFields().scope.replace("openid", "") return attributes }
The context object has type DcrPostProcessingProcedureContext.
context
The returned value should be a JavaScript map with the post-processed attributes.
function result(context) { logger.trace("Getting from bucket") var bucket = context.getBucket("DefaultHSQLDB") var responseFields = context.getResponseFields() var persistedValue = bucket.getAttributes(responseFields.client_id, "testPurpose") logger.trace("Retrieved value from bucket : {}", persistedValue) bucket.clearBucket(context.getResponseFields().client_id, "testPurpose") responseFields.set_by_post_processing = persistedValue.value + "-retrieved-by-post-processor" return responseFields }