You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marcus Messer <Ma...@kewill.com> on 2016/07/19 10:49:00 UTC

Camel-olingo2 and CSRF Token

Hello everyone,

I implemented a spring boot based odata service, this service adds an CSRF Token as header value in the response message. This works as expected.
But i could not find a solution to retrieve that token, when accessing the service with the camel-olingo2 api.
For example:
from("direct:createDeclaration")
    .process(p-> {
        p.getIn().setBody(createPropertyMapFromBody(p.getIn().getBody()));
    })
    .to("olingo2://create/DeclarationSet")
    .log("CREATE: ${body}");
This will generate 2 requests to the service. At first a 'GET' request for the '$metadata', where the CSRF Token is returned from the service. And then this will generate a 'POST' request to submit the Entity to the odata service. And here i could not find a solution to grab the the token from the 'GET' request to put it into the 'olingoconfiguration.httpHeaders'.
Currently i am thinking of:
change the camel source code accordingly to provide the response headers. (only if there is no other solution)
Use an Aspect to retrieve the Token. (Not a nice approach)
But maybe i missed something here and you guys can point me in the right direction?


i already asked that question here:
http://stackoverflow.com/questions/38454141/camel-olingo2-and-csrf-token

But I think, to ask my question here might be better.. ;)

Best Regards and thanks in advance
Marcus

IMPORTANT NOTICE: This e-mail, and each of any attachments transmitted with it, is confidential, is the property of Kewill GmbH, and is intended solely for the information of the individual/entity to whom this e-mail is addressed. It may also be privileged or protected by other legal rules. If you have received it by mistake, please notify the author immediately by replying to this e-mail and then destroy/delete this e-mail and all attachments (if any). If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail. In accordance with Kewill's internal policy e-mails sent and/or received may be monitored. Whilst Kewill takes reasonable precautions (including use of anti-virus software) it accepts no responsibility for any loss or damage should this e-mail contain any virus, or similar destructive or mischievous code. (c)Kewill 2013. Kewill GmbH (HRB 3317) - registered in Germany at Marienbader Platz. 1, 61348 Bad Homburg. Kewill GmbH * vertreten durch die Gesch?ftsf?hrer: Andreas Heil,*Andrew Hicks, Gesellschaftssitz: 61348 Bad Homburg v. d. H., Marienbader Platz 1 * Eintragung: Amtsgericht Bad Homburg v. d. H. (HRB 3317)