You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/08/11 08:50:00 UTC

[jira] [Comment Edited] (CAMEL-18370) Bidning properties to route template local beans do not honor RAW()

    [ https://issues.apache.org/jira/browse/CAMEL-18370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17578325#comment-17578325 ] 

Claus Ibsen edited comment on CAMEL-18370 at 8/11/22 8:49 AM:
--------------------------------------------------------------

I can make this work with RAW but it requires that we start to use RAW more consistently for username/password in the templates.

This route works with a the above salesforce kamelet. The password that salesforce receives is as-is typed with the + sign
{code}
# camel-k: language=yaml
# camel-k: property=myUsername=foo+bar@acme.com

# Write your routes here, for example:
- from:
    uri: "timer:foo"
    parameters:
      period: "1000"
    steps:
      - setBody:
          constant: "Hello Camel from yaml"
      - to:
          uri: "kamelet:mysf"
          parameters: 
            sObjectName: "com.foo.MyObject"
            clientId: "123"
            clientSecret: "bbb"
            userName: "RAW({{myUsername}})"
            password: "tiger"
            loginUrl: "https://login.salesforce.com"
{code}


was (Author: davsclaus):
I can make this work with RAW but it requires that we start to use RAW more consistently for username/password in the templates.

This kamelet works
{code}
# camel-k: language=yaml
# camel-k: property=myUsername=foo+bar@acme.com

# Write your routes here, for example:
- from:
    uri: "timer:foo"
    parameters:
      period: "1000"
    steps:
      - setBody:
          constant: "Hello Camel from yaml"
      - to:
          uri: "kamelet:mysf"
          parameters: 
            sObjectName: "com.foo.MyObject"
            clientId: "123"
            clientSecret: "bbb"
            userName: "RAW({{myUsername}})"
            password: "tiger"
            loginUrl: "https://login.salesforce.com"
{code}

> Bidning properties to route template local beans do not honor RAW()
> -------------------------------------------------------------------
>
>                 Key: CAMEL-18370
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18370
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-kamelet
>    Affects Versions: 3.18.0
>            Reporter: Luca Burgazzoli
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.18.2, 3.19.0
>
>         Attachments: Screenshot 2022-08-11 at 09.21.09.png
>
>
> Assuming we have a kamelet where the route template is defined as:
> {code:yaml}
>   template:
>     beans:
>       - name: local-salesforce
>         type: "#class:org.apache.camel.component.salesforce.SalesforceComponent"
>         properties:
>           clientId: "{{clientId}}"
>           clientSecret: "{{clientSecret}}"
>           userName: "{{userName}}"
>           password: "{{password}}"
>           loginUrl: "{{loginUrl}}"
>     from:
>       uri: kamelet:source
>       steps:
>         - to:
>             uri: "{{local-salesforce}}:createSObject"
>             parameters:
>               sObjectName: "{{sObjectName}}"
>               rawPayload: "true"
>               format: "JSON"
> {code}
> Where we define the _userName_ as something like _foo+bar@acme.com_.
> With such parameter, the login would fail as the parameter would become  _foo bar@acme.com_ in the component (as the parameter is taken from the kamelet uri hence, it gets decoded).
> An attempt to fix that is to use RAW, as example _userName: "RAW{{userName}}"_ but this also would fail the login as the parameter would become _RAW(foo bar@acme.com)_ in the component.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)