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

Jason Whaley commented on CAMEL-5453:
-------------------------------------

This can be worked around by adding an AmazonSQSClient to the registry with the 
following (which is hinted at in the documentation for other edge cases, but 
not this one):
{code}
            
AmazonSQSClient sqsClient = new AmazonSQSClient(new 
BasicAWSCredentials(accessKeyId,secretKey));
JndiContext jndiContext = new JndiContext();
jndiContext.bind("amazonSQSClient", sqsClient;

CamelContext camelContext = new DefaultCamelContext(jndiContext);
camelContext.addRoutes(new RouteBuilder() {
    @Override
    public void configure() throws Exception {
        
from("direct:whatever").to("aws-sqs://queue-name?amazonSQSClient=#amazonSQSClient");
        //... other routes here
    }
});            
camelContext.start();   
{code}
                
> An AWS key with "+" gets stripped out by 
> DefaultCamelContext.normalizeEndointUri  and URISupport.parseQuery for at 
> least the SQS Component
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5453
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5453
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws, camel-core
>    Affects Versions: 2.10.0
>            Reporter: Jason Whaley
>
> When defining a camel route that includes an endpoint for the SQS component 
> that includes the accessKey and secretKey as parameters, such as the 
> following:
> {code}
> aws-sqs://queue-name?accessKey=ABCDEFGHIJKLMNOP&secretKey=ABCDEFGHI+JK
> {code}
> if the secretKey contains a + then that + is stripped out in 
> URISupport.parseQuery and the parameters received by 
> SqsComponent.createEndpoint has a space where the + used to be in the 
> secretKey, thus making calls to SQS by the SqsComponent fail.  
> Even if the endpoint URI string is URL encoded such that 
> secretKey=ABCDEFGHI%2BJK, then DefaultCamelContext.normalizeEndointUri will 
> decode the %2B to a "+" earlier in the call stack before 
> URISupport.parseQuery is called (which then removes it).
> A "+" is a valid and common character in generated AWS secret keys and thus 
> needs to be left alone when it is placed in the parameter Map<String,Object> 
> received in SqsComponent.createEndpoint, or replaced with custom parsing in 
> SqsComponent.createEndpoint.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to