Custom adapter module by Martin Buselmeier for Adapter Engine of SAP PI/PO systems to set dynamic configuration attributes of the processed message. Extended by Philippe Addor by a provider class for OAuth Token Lookup to use for example with Salesforce.
Add it to the module processor (in the channel) with the following name: Custom_AF_Modules/AddTokenToDynamicConfigurationBean (local enterprise bean).
Added oAuth provider class (removed the others not needed for this purpose): https://github.com/fippu82/sap-xpi-adapter-module-add-dynamic-configuration/blob/master/com.doc.xpi.af.modules.dcappender.ejb/ejbModule/com/doc/xpi/af/modules/dcappender/provider/DynamicConfigurationProviderOAuthTokenLookup.java
Modified provider factory to use the above class: https://github.com/fippu82/sap-xpi-adapter-module-add-dynamic-configuration/blob/master/com.doc.xpi.af.modules.dcappender.ejb/ejbModule/com/doc/xpi/af/modules/dcappender/util/DynamicConfigurationProviderFactory.java
Forked from Martin Buselmeier's repository (https://github.com/MartinBuselmeier/sap-xpi-adapter-module-add-dynamic-configuration), based on his great blog post here: https://blogs.sap.com/2017/07/05/api-token-via-http-lookup-in-adapter-module/
Configuration for the oAuth provider class (all settings are optional; default settings are used if omitted):
Property | Value | Description |
---|---|---|
class | Class name | omit to use default class (oauth) |
dc.keyValueStore.key | sfdc | Key used for saving the token. Reuse the same key in different channels in order to share the token. |
dc.keyValueStore.expirationTime | 60 | Lifetime of a cached token |
dc.keyValueStore.clear | false | Set to true temporarily in order to delete a token from the cache. |
dc.oauth.request.url | https://test.salesforce.com/services/oauth2/token | Token URL for this environment |
dc.http.request.proxyHost | [Proxy if needed] | Proxy host |
dc.http.request.proxyPort | [Proxy port] | Proxy Port (if proxy specified) |
dc.oauth.username | [user] | Username at SFDC |
[pwd.]dc.oauth.password | passwort | |
dc.oauth.clientid | [id] | Client ID |
[pwd.]dc.oauth.clientsecret | Client secret |
(By prefixing a property with pwd. PO will mask it with wildcards.)