New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logon with RFC destination #1841

Closed
christianguenter2 opened this Issue Aug 18, 2018 · 4 comments

Comments

3 participants
@christianguenter2
Collaborator

christianguenter2 commented Aug 18, 2018

On my ABAP developer edition I'd like to use RFC destinations for the HTTP client (cl_http_client=>create_by_destination). This has the advantage that I don't need to provide my credentials anymore. I'd like to create a RFC destination for every git server I use.

Two possible ways to implement this.

  1. provide a new option in repo settings to maintain a RFC destination
  2. provide RFC destination somehow over the APIs
  3. provide a new user exit override abapGit standard http client instantiation, somewhere here

cl_http_client=>create_by_url(
EXPORTING
url = zcl_abapgit_url=>host( iv_url )
ssl_id = 'ANONYM'
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
IMPORTING
client = li_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).

possible implementation could look like this:

    DATA(lv_host) = zcl_abapgit_url=>host( iv_url ).

    DATA(lv_destination) = COND rfcdest( WHEN lv_host CS 'gitlab' THEN |GITLAB|
                                         WHEN lv_host CS 'github' THEN |GITHUB| ).

    IF lv_destination IS INITIAL.
      RETURN.
    ENDIF.

    cl_http_client=>create_by_destination(
      EXPORTING
        destination              = lv_destination
      IMPORTING
        client                   = ri_client
      EXCEPTIONS
        argument_not_found       = 1
        destination_not_found    = 2
        destination_no_authority = 3
        plugin_not_active        = 4
        internal_error           = 5
        OTHERS                   = 6 ).

    IF sy-subrc <> 0.
      zcx_abapgit_exception=>raise_t100(  ).
    ENDIF.

Any opinions? Was this already discussed?

@christianguenter2

This comment has been minimized.

Show comment
Hide comment
@christianguenter2

christianguenter2 Aug 18, 2018

Collaborator

Maybe this is then also an option for background mode.

Collaborator

christianguenter2 commented Aug 18, 2018

Maybe this is then also an option for background mode.

@christianguenter2 christianguenter2 changed the title from Login with RFC destination to Logon with RFC destination Aug 18, 2018

@christianguenter2

This comment has been minimized.

Show comment
Hide comment
@christianguenter2

christianguenter2 Aug 20, 2018

Collaborator

I'd prefer option 3. I tested it already and it works like a charm.

With this RFC destination for GitHub I don't need to provide credentials for GitHub repos anymore.
image

image

Collaborator

christianguenter2 commented Aug 20, 2018

I'd prefer option 3. I tested it already and it works like a charm.

With this RFC destination for GitHub I don't need to provide credentials for GitHub repos anymore.
image

image

@sandraros

This comment has been minimized.

Show comment
Hide comment
@sandraros
Contributor

sandraros commented Aug 23, 2018

@christianguenter2 nice idea!
Here is a ready-to-use repository : https://github.com/sandraros/abapGit-user-exit-logon-by-rfc

@larshp

This comment has been minimized.

Show comment
Hide comment
@larshp

larshp Aug 23, 2018

Owner

@sandraros cool, we should include your example in the user exit documentation, when it is written, see #1853

Owner

larshp commented Aug 23, 2018

@sandraros cool, we should include your example in the user exit documentation, when it is written, see #1853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment