I’m trying to reduce as many differences between our Sandbox and Production Code and one of them major hard coding is done regarding Source ID. I found idn.getSourceAttributeBySourceName which seems to be a great way in doing so but there isn’t a lot of details out there on the parameters needed. The documentation says getSourceAttributeBySourceName(java.lang.String sourceName, java.lang.String attributeName)
but gives very little insight regarding for format it’s looking for regarding sourceName and not able to find what the attributeName would be for the source id. Any insight on what these would be? sourceName seems like it would be something like “Application Name [source]” but have also seen it with a number as well. Thanks in advance.
According to the Javadoc, it is the “attribute name/key to return.” I’m not sure whether it’s an attribute in the “Attributes” Map or the top level attribute of the application object, but try this
IdnRuleUtil.getSourceAttributeBySourceName("Okta","id")
I haven’t tried just plain name, but I have tried id which didn’t seem to work. Has anyone ever successfully gotten it working? I have seen many usages for sourceName as “Okta [source]” as the name, assuming the Display name is “Okta”
Where are you trying to use this? In most of the rules, you get an application
object that can be used to refer to the Source.
My understanding is that getSourceAttributeBySourceName
is used to get the value of the attribute that is listed under connectorAttributes
of a source
We have delimited source that we are using to store lists of OU to Location mapping. We do a look up from there to get them. All that is working fine but I don’t like that we have to hard code the source id as they are different between our Sandbox and Production. If connectorAttributes
are the only attributes available to use (doesn’t have any details regarding that in the javadoc), then maybe there isn’t a way to accomplish what I want.
Why not try this:
Add an attribute “sourceId” to the source that will have the value of “id” from the same source, and use this attribute to get the source ID
Are custom attributes supported and if how is this done?
You can add custom attributes using VS Code + IDN Extension (like sourceId
below)
and use application.getAttributeValue("sourceId")
to get the value
Perfect Thanks. For the second part, sourceName, what format should it be in “AppName” or “AppName [source]” or some other format?
try application.getName()
if application
is available to the rule you are writing. If not AppName [source]
should work
I was able to implement this, and everything is working. Thanks.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.