Skip to content
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 · 5 comments
Closed

Logon with RFC destination #1841

christianguenter2 opened this issue Aug 18, 2018 · 5 comments
Assignees
Labels
new feature New feature or request

Comments

@christianguenter2
Copy link
Member

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

https://github.com/larshp/abapGit/blob/d7e90aae6062388f8efacdad6d707356ba3c7b56/src/http/zcl_abapgit_http.clas.abap#L127-L139

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 christianguenter2 added the new feature New feature or request label Aug 18, 2018
@christianguenter2
Copy link
Member Author

christianguenter2 commented Aug 18, 2018

Maybe this is then also an option for background mode.

@christianguenter2 christianguenter2 changed the title Login with RFC destination Logon with RFC destination Aug 18, 2018
@christianguenter2
Copy link
Member Author

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
Copy link
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
Copy link
Member

larshp commented Aug 23, 2018

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

@larshp
Copy link
Member

larshp commented Feb 5, 2021

exit method name = CREATE_HTTP_CLIENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Development

No branches or pull requests

3 participants