MicroHub | Microsoft Github MicroHub
kandi X-RAY | MicroHub Summary
kandi X-RAY | MicroHub Summary
A GitHub theme with Microsoft Style. Idea from Alexey Nazaroff's tweets (@nazarff). One-click install from Google Chrome Web Store ️ ️ ️.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of MicroHub
MicroHub Key Features
MicroHub Examples and Code Snippets
Community Discussions
Trending Discussions on MicroHub
QUESTION
We're using SAP Cloud SDK 3.32.0 with SpringBoot. We've generated a typed OData service based on the EDMX metadata file generated by the service and use the generated client in our code. All logs entries showing our issue are below (cleaned them up a bit to show the important parts only)
The situation is the following:
- We send a
myservice.createEntity(MyEntity).exectureRequest(myDestination)
with the generated client. Since this is a modifying/creating call, the client first requests a CSRF token. This works fine as shown in the logs below (first HEAD and POST calls) - Next we call a function with
myservice.myFunction(p1, p2, p3).executeRequest(myDestination)
. This is a function exposed by the same OData service, so the service path is the same. Since this function is aPOST
, the client will again try to fetch a CSRF token. However, this results in aHTTP 403 Forbidden
status code. We do not get the CSRF token (see secondHEAD
request in the logs below). - The function call is still executed, but with an empty
X-CSRF-Token
http header (second POST request in logs). - Although we seem to receive a response from the OData service, the client finallly times out (Read time out) and we are unable to process the result of the function call.
Debugging/clicking through the code of the CloudSDK, I discovered that the generated "FluentHelperFunction" class has it's own logic for retrieving the CSRF token (e.g. it uses "Fetch" in the HEAD requests), where as the FluentHelperCreate class uses the DefaultCsrfRetriever class (which uses lower case "fetch" for the HEAD call).
So my questions are:
- Why does the HEAD call for CSRF fail when done by a function call (i.e.
myservice.myFunction()
) - Why does the FluentHelperFunction class have it's own logic for getting a CSRF token?
- What can I do to make this work properly. Or is this a bug in the SDK?
Logs:
...ANSWER
Answered 2020-Nov-19 at 13:59This is indeed a shortcoming in the SDK. In previous versions all create/update/delete/function requests would fail if CSRF token retrieval failed. This was improved for most of the code. But as of today (SDK version 3.33.0
) functions still have this behaviour.
If you really need a workaround today the following should work for queries that use POST
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MicroHub
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page