Pass additional parameters to custom endpoint

This topic contains 3 replies, has 2 voices, and was last updated by  ivano.vingiani 1 year ago.

  • Author
    Posts
  • #21388
     ivano.vingiani 
    Participant

    I’ve created a custom endpoint to divert emails (activation, password reset) to a service.
    Since we use the same endpoint for all email I would like to pass some parameters to enrich the messages depending on the case.

    Is there a way to do this?

    The endpoint is defined as

    {
    “type” : “groovy”,
    “file” : “notify.groovy”,
    “context” : “endpoint/notify/*”
    }

    and then in selfservice-reset

    {
    “name” : “emailValidation”,
    “identityEmailField” : “mail”,
    “emailServiceUrl” : “endpoint/notify/abcd-efgh”,

    }

    I tried adding query parameters to the url (e.g. “endpoint/notify/abcd-efgh?param1=one”) but I then have permission issues and the parameters are not recognized.

    Is there a way to define extra parameters to forward to the endpoint?

    #21392
     ivano.vingiani 
    Participant

    I solved using emailServiceParameters:

    {
    “name” : “emailValidation”,
    “identityEmailField” : “mail”,
    “emailServiceUrl” : “endpoint/notify/abcd-efgh”,
    “emailServiceParameters” : {“param1″:”one”, “param2″:”two”},

    }

    The parameters are then made available in request.additionalParameters

    #21395
     domingos.creado 
    Participant

    Hi Ivano,

    you can use the custom endpoint definition json file to define global bindings on the script evaluation.
    From custom endpoint sample:
    {
    “file” : “echo.groovy”,
    “type” : “groovy”,
    “globals” : {
    “input”: {
    “myparam”: “paramValue”
    }
    }
    }

    there will be an “input” object bound available.

    #21409
     ivano.vingiani 
    Participant

    Hi Domingo,

    that would not work since the parameters would be the same for every request. I need the invokers of the endpoint to specify their own parameters.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

©2019 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?