larshp / abapGitServer

Git server implemented in ABAP
MIT License
64 stars 25 forks source link

logon tickets in abapGit background mode? #31

Closed larshp closed 7 years ago

larshp commented 8 years ago

so it will work without entering a password for background mode, if abapGitServer is installed on the same box

https://help.sap.com/saphelp_nw74/helpdata/en/d0/dc33c460a243929b7ec120f55af101/frameset.htm

https://help.sap.com/saphelp_nw74/helpdata/en/4e/0a0e6dbce42287e10000000a15822b/content.htm

https://wiki.scn.sap.com/wiki/display/ASJAVA/The+MYSAPSSO2+cookie

fm CREATE_RFC_REENTRANCE_TICKET ?

https://blogs.sap.com/2010/05/07/how-to-include-logon-ticket-into-sap-shortcut-sso-from-abap-web-to-sap-wingui/

fm HTTP_SET_SSO2_COOKIE ?

larshp commented 8 years ago

following seems to work

REPORT zticket.

START-OF-SELECTION.
  PERFORM run.

FORM run.

  DATA: li_client TYPE REF TO if_http_client,
        lv_code   TYPE i,
        lv_url    TYPE string VALUE 'http://asdf:50000/sap/zabapgitserver'.

  cl_http_client=>create_by_url(
  EXPORTING
    url    = lv_url
    ssl_id = 'ANONYM'
  IMPORTING
    client = li_client ).

  li_client->send_sap_logon_ticket( ).

  li_client->send( ).
  li_client->receive(
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3
      OTHERS                     = 4 ).

  li_client->response->get_status(
    IMPORTING
      code   = lv_code ).

  DATA(lv_str) = li_client->response->get_cdata( ).

  WRITE: / lv_str.

  WRITE: / 'Done'.

ENDFORM.

FORM info.

  DATA: lt_list TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.

  CALL FUNCTION 'ICM_GET_INFO2'
    TABLES
      servlist           = lt_list
    EXCEPTIONS
      icm_error          = 1
      icm_timeout        = 2
      icm_not_authorized = 3
      OTHERS             = 4.
  WRITE: / sy-subrc.

ENDFORM.
larshp commented 7 years ago

fixed in https://github.com/larshp/abapGit/commit/7c4f834bc96bf05f9b915a6a0af28c7932dfa704