Authentication Nodes and environment variables

This topic has 3 replies, 2 voices, and was last updated 3 months ago by Jatinder Singh.

  • Author
    Posts
  • #28091
     barry.parkinson
    Participant

    We’re developing a custom node in Java for use in an authentication tree

    The node calls Google Analytics on a url – at the moment the url is hard-coded

    Is there any way to configure AM so our Java code can get the URL (and other values) from configuration?

    The URL will differ for various deployments

    #28092
     Jatinder Singh
    Participant

    You could configure the URL as part of your Node configuration within the Config interface. For example:

    
    @Attribute(order = 1)
    String googleAnalyticsURL();
    

    Once configured it can be retrieved and used in the process method. Reading from a system environment variable is also an option but for this scenario and in IMHO node configuration is a better choice.

    Hope this helps!

    #28094
     barry.parkinson
    Participant

    Do you mean adding it as an attribute on each node in a tree?

    We don’t really want to do this – it would mean updating every tree when we deploy from dev > test > prod

    Is there a recommended way to configure this kind of thing inside AM ?

    #28098
     Jatinder Singh
    Participant

    If the variable is environment dependent, one suggestion is make it a System Environment Variable. It is exported/or created as part of your AM deployment script. The variable can be maintained within your AM source-code and is Git version controlled. You can retrieve the variable in your Node using:

    
    System.getenv("GOOGLE_ANALYTICS_URL");
    

    Hope this helps!

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

You must be logged in to reply to this topic.

©2020 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?