Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Problem whith SECURITY_CONTEXT

$
0
0

Hi, All.

I try to send PUT request from my SAPUI5 app but I got error 403 "CSRF token validation failed". I had did it from Rest client, and it's work correctly.

I have find my problem: if I send request from my SAPUI5 app, then in GET request i have SECURITY_CONTEXT_ID(table SECURITY_CONTEXT-LINK)  and in PUT request I have different security_context_id. CSRF token calculated by class CL_HTTP_SERVER_NET->IF_HTTP_SERVER~VALIDATE_XSRF_TOKEN() using value of security context.

 

* Try to retrieve the XSRF token from the Security Context (if exists)

   TRY.

       lv_security_context = cl_http_security_session_admin=>get_current_session_context( ).

     CATCH cx_http_security_session_admin .

   ENDTRY.


IF lv_security_context-xsrf_token IS NOT INITIAL.

* Compare received token with token found in the Security Context

     successful = boolc( lv_security_context-xsrf_token = lv_xsrf_token ). "In my case values are different

     RETURN. "that's all

   ENDIF.

If I send requests drom REST client, they have same value of SECURITY_CONTEXT_ID.

 

What I can do with this?


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>