Satz Respected Contributor.
Respected Contributor.
158 views

Custom URL and REST Method

Hey everyone..

Anyone tried using the custom URL and REST method (Its not about the Custom Configuration in the Driver)..

Like how we can passs the custom JSON in the below code 

<rule>
<description>add</description>
<conditions>
<and>
<if-operation mode="nocase" op="equal">add</if-operation>
<if-class-name mode="nocase" op="equal">User</if-class-name>
</and>
</conditions>
<actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
<do-set-xml-attr expression="../driver-operation-data[last()]"
name="class-name">
<arg-string>
<token-class-name/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]"
name="command">
<arg-string>
<token-operation/>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../driver-operation-data[last()]"
name="event-id">
<arg-string>
<token-xpath expression="$current-op/@event-id"/>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../driver-operation-data[last()]"
name="request"/>
<do-append-xml-element
expression="../driver-operation-data[last()]/request[last()]"
name="header"/>
<do-set-xml-attr
expression="../driver-operation-data[last()]/request[last()]/header"
name="content-type">
<arg-string>
application/json
</arg-string>
</do-set-xml-attr>
<do-append-xml-element
expression="../driver-operation-data[last()]/request[last()]" name="value"/>
<do-set-local-variable name="lvUsername" scope="policy">
<arg-string>
<token-dest-dn/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="lvMail" scope="policy">
<arg-string>
<token-op-attr name="Internet EMail Address"/>
</arg-string>
</do-set-local-variable>
<do-append-xml-text
expression="../driver-operation-data[last()]/request[last()]/value[last()]">
<arg-string>

</arg-string>
</do-append-xml-text>
<do-strip-xpath expression="$current-op"/>
</actions>
</rule>

Can anyone suggest me how to pass the user defined method and URL in the policy  (Not about the Driver Configuration)  as how we construct the driver operation data ?

 

Labels (1)
0 Likes
5 Replies
Knowledge Partner
Knowledge Partner

Re: Custom URL and REST Method

Depend on your business case, you can construct it or use built-in token "Set Operation Property".

<do-set-op-property name="opData">
<arg-string>
<token-local-variable name="lvMyData"/>
</arg-string>
</do-set-op-property>

0 Likes
Satz Respected Contributor.
Respected Contributor.

Re: Custom URL and REST Method

My query is that it should not take the URL which is specified in the driver instead I want to pass it via driver policy to the shim..

Reason behind this is..

I cannot do a filter setup for all the attributes in the destination..

What am planning is if I flip an attribute it will pass the URL n the method to the shim..
0 Likes
Knowledge Partner
Knowledge Partner

Re: Custom URL and REST Method

Dirver Operation Data is explained at this link:

 

https://www.netiq.com/documentation/identity-manager-47-drivers/generic_rest/data/driver-concepts.html#bvp9xer

 

So you need to set the url="yourvalue" inside the <request> node under the <driver-operation-data>.

I am not sure where/when in your policies that is first added to the event document XML, but you can check for it:  Then add what is needed like this:

 

<do-if>
<arg-conditions>
<and>
<if-xpath op="not-true">../driver-operation-data</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-append-xml-element expression=".." name="driver-operation-data"/>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-xpath op="not-true">../driver-operation-data/request</if-xpath>
</and>
</arg-conditions>
<arg-actions>
<do-append-xml-element expression="../driver-operation-data" name="request"/>
</arg-actions>
<arg-actions/>
</do-if>
<do-set-xml-attr expression="../driver-operation-data/request" name="url">
<arg-string>
MyURLValueGoesHere
</arg-string>
</do-set-xml-attr>

 

0 Likes
Satz Respected Contributor.
Respected Contributor.

Re: Custom URL and REST Method

Through my policy I have formed the driver operation data as below (same as like in the document)

<input>
<driver-operation-data class-name="User" command="modify" event-id="kmci4idm2068#20190819163658#1#1:0b570e66-8805-42a1-af39-660e570b0588">
​​​<request method="put"  url="https://kmci4idm2069.corning.com:8444/IDMProv/rest/access/user/Satzzzzz"><header content-type="application/json"/>
{"dn": " cn=SRMUniversity,o=CORNING","attributes": [{"key": "Title","values": ["Vikram"],"action": "update"}]}
</request>
</driver-operation-data>
</input>

 

Shim takes the default rest method and URL which I configured initially for the driver. 

 

Though I gave the custom URL and method mentioned in the driver partition data, its not taking the custom one. But the input JSON Value is getting passed correctly.

 

I tried for both default and custom configurations in the driver.

 

Can anyone help in this ?

0 Likes
Satz Respected Contributor.
Respected Contributor.

Re: Custom URL and REST Method

@geoffc  - Can you please suggest on this ?

Thank you 🙂

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.