Der SICF-Service kann diesen Namen auswerten, (wenn man es programmiert).http://Sapserver.com/service?uname=SCHMIDT
oder sicherer mit BASE64
http://Sapserver.com/service?uname=U0NITUlEVA==
Code: Alles auswählen.
FUNCTION z_rfc_auth_check.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_USER) TYPE XUBNAME
*" EXPORTING
*" VALUE(O_RC) TYPE SYST-SUBRC
*"----------------------------------------------------------------------
* AB ECC6 !!
*AUTHORITY-CHECK OBJECT 'S_TCODE' FOR USER i_user
* ID 'TCD' FIELD 'MM03'.
** Check authorization for user
*AUTHORITY-CHECK OBJECT 'Z_TR_SALES'
*FOR USER i_user
*ID 'VKORG' FIELD lv_vkorg
*ID 'VTWEG' FIELD lv_vtweg
*ID 'SPART' FIELD lv_spart
*ID 'ACTVT' FIELD '09'.
* AB 4.7
DATA: BEGIN OF values OCCURS 10.
INCLUDE STRUCTURE usvalues.
DATA: END OF values.
CALL FUNCTION 'SUSR_USER_AUTH_FOR_OBJ_GET'
EXPORTING
user_name = i_user
sel_object = 'S_TCODE'
TABLES
values = values
EXCEPTIONS
user_not_exist = 1
not_authorized = 2
internal_error = 3
OTHERS = 4.
IF values[] IS INITIAL.
o_rc = 1.
ELSE.
o_rc = 0.
ENDIF.
ENDFUNCTION.
Code: Alles auswählen.
FUNCTION z_rfc_auth_check.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_USER) TYPE XUBNAME
*" VALUE(I_TCODE) TYPE SYST-TCODE DEFAULT 'MM03'
*" EXPORTING
*" VALUE(O_RC) TYPE SYST-SUBRC
*"----------------------------------------------------------------------
AUTHORITY-CHECK OBJECT 'S_TCODE' FOR USER i_user
ID 'TCD' FIELD I_TCODE.
o_rc = sy-subrc.
ENDFUNCTION.
Das hieße, dass SAP den Service umbauen müsste, damit ich im Link den Nutzernamen des aufrufenden Backend-Systems übergeben kann? Zurzeit sieht der Link in Klarschrift nämlich so aus:Der SICF-Service kann diesen Namen auswerten, (wenn man es programmiert).
https://www.base64decode.org/Ich habe noch nichts von Base64 oder gar U0NITUlEVA gehört
Code: Alles auswählen.
METHOD if_http_extension~handle_request.
****************************************
* copy of CL_HTTP_EXT_BASE
****************************************
* Example with output
*data output_str type string.
*
*
** allow other extensions to do something
* if_http_extension~flow_rc = if_http_extension=>co_flow_ok_others_opt.
*
*
** create some response data
* server->response->set_header_field(
* name = 'Content-Type' "#EC NOTEXT
* value = 'text/html' ).
* server->response->set_header_field(
* name = 'Expires' "#EC NOTEXT
* value = '0' ).
*
*
*output_str = 'Hello caller1'.
*
*
* server->response->set_cdata( data = output_str ).
DATA l_b64value TYPE string.
DATA l_b64url TYPE string.
DATA l_value TYPE string.
DATA l_newurl TYPE string.
DATA l_rc TYPE syst-subrc.
DATA msg_text(80).
* allow other extensions to do something
if_http_extension~flow_rc = if_http_extension=>co_flow_ok_others_opt.
l_b64value = server->request->get_form_field( name = 'UNAME' ).
IF l_b64value IS INITIAL.
server->response->set_status( code = 403 reason = 'illegal call' ).
EXIT.
ENDIF.
l_b64url = server->request->get_form_field( name = 'UX' ).
IF l_b64url IS INITIAL.
server->response->set_status( code = 404 reason = 'illegal call' ).
EXIT.
ENDIF.
* Decode Base64 String e.g.https://www.base64decode.org/
l_value = cl_http_utility=>decode_base64( l_b64value ).
l_newurl = cl_http_utility=>decode_base64( l_b64url ).
* Check authority
CALL FUNCTION 'Y_RFC_AUTH_CHECK' DESTINATION 'NONE'
EXPORTING
i_user = l_value
i_tcode = 'MM03'
IMPORTING
o_rc = l_rc
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
IF NOT l_rc IS INITIAL.
server->response->set_status( code = 404 reason = 'illegal call' ).
EXIT.
ENDIF.
server->response->redirect( url = l_newurl ).
ENDMETHOD.