Move SSL_ID determination to user exit (#2114)

* docs: change id to parameter

* move ssl_id determination to exit #2102

* docs: add new exit

* update abaplint to latest
This commit is contained in:
Lars Hvam 2018-11-19 07:15:25 +01:00 committed by GitHub
parent 8e8c478a7f
commit db74b1ea52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 133 additions and 96 deletions

View File

@ -8,7 +8,8 @@
"enabled": true
},
"functional_writing": {
"enabled": true
"enabled": true,
"ignoreExceptions": true
},
"line_length": {
"enabled": true,
@ -30,7 +31,8 @@
"enabled": true
},
"line_only_punc": {
"enabled": true
"enabled": true,
"ignoreExceptions": true
},
"obsolete_statement": {
"enabled": true
@ -65,6 +67,7 @@
},
"method_parameter_names": {
"enabled": true,
"ignoreExceptions": true,
"importing": "^I._.*$",
"returning": "^R._.*$",
"changing": "^C._.*$",
@ -76,7 +79,14 @@
"local_variable_names": {
"enabled": true,
"expectedData": "^L._.*$",
"expectedConstant": "^LC_.*$",
"expectedFS": "^<L._.*>$"
},
"class_attribute_names": {
"enabled": true,
"ignoreExceptions": true,
"statics": "^G._.*$",
"instance": "^M._.*$"
}
}
}
}

View File

@ -12,7 +12,8 @@ REPORT zabapgit_test_ssl.
* See https://github.com/larshp/abapGit/
PARAMETERS: p_url1 TYPE swc_value DEFAULT 'https://github.com',
p_url2 TYPE swc_value DEFAULT 'https://api.github.com'.
p_url2 TYPE swc_value DEFAULT 'https://api.github.com',
p_id TYPE ssfapplssl DEFAULT 'ANONYM'.
* api.github.com is used when pushing code back to github
SELECTION-SCREEN BEGIN OF BLOCK proxy WITH FRAME.
@ -44,7 +45,7 @@ FORM run USING iv_url TYPE swc_value.
cl_http_client=>create_by_url(
EXPORTING
url = lv_url
ssl_id = 'ANONYM'
ssl_id = p_id
proxy_host = p_proxy
proxy_service = p_pxport
IMPORTING

View File

@ -39,4 +39,7 @@ Can be used for setting logon tickets eg. in connection with abapGitServer conne
[https://gist.github.com/larshp/71609852a79aa1e877f8c4020d18feac](https://gist.github.com/larshp/71609852a79aa1e877f8c4020d18feac)
### CHANGE_TADIR
Can be used to skip certian objects, or force a different object setup than currently in TADIR.
Can be used to skip certian objects, or force a different object setup than currently in TADIR.
### GET_SSL_ID
Possibility to change the default `ANONYM` ssl id to something system specific

View File

@ -42,32 +42,7 @@ ENDCLASS.
CLASS zcl_abapgit_2fa_auth_base IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT mo_url_regex
EXPORTING
pattern = iv_supported_url_regex
ignore_case = abap_true.
ENDMETHOD.
METHOD is_session_running.
rv_running = mv_session_running.
ENDMETHOD.
METHOD raise_comm_error_from_sy.
DATA: lv_error_msg TYPE string.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO lv_error_msg.
RAISE EXCEPTION TYPE zcx_abapgit_2fa_comm_error
EXPORTING
mv_text = |Communication error: { lv_error_msg }| ##NO_TEXT.
ENDMETHOD.
CLASS ZCL_ABAPGIT_2FA_AUTH_BASE IMPLEMENTATION.
METHOD authenticate.
@ -84,6 +59,14 @@ CLASS zcl_abapgit_2fa_auth_base IMPLEMENTATION.
ENDMETHOD.
METHOD constructor.
CREATE OBJECT mo_url_regex
EXPORTING
pattern = iv_supported_url_regex
ignore_case = abap_true.
ENDMETHOD.
METHOD delete_access_tokens.
RAISE EXCEPTION TYPE zcx_abapgit_2fa_del_failed. " Needs to be overwritten in subclasses
ENDMETHOD.
@ -98,15 +81,6 @@ CLASS zcl_abapgit_2fa_auth_base IMPLEMENTATION.
ENDMETHOD.
METHOD is_2fa_required.
rv_required = abap_false.
ENDMETHOD.
METHOD supports_url.
rv_supported = mo_url_regex->create_matcher( text = iv_url )->match( ).
ENDMETHOD.
METHOD get_http_client_for_url.
DATA: lo_proxy TYPE REF TO zcl_abapgit_proxy_config,
lo_abapgit_exc TYPE REF TO zcx_abapgit_exception,
@ -116,7 +90,7 @@ CLASS zcl_abapgit_2fa_auth_base IMPLEMENTATION.
cl_http_client=>create_by_url(
EXPORTING
url = iv_url
ssl_id = 'ANONYM'
ssl_id = zcl_abapgit_exit=>get_instance( )->get_ssl_id( )
proxy_host = lo_proxy->get_proxy_url( iv_url )
proxy_service = lo_proxy->get_proxy_port( iv_url )
IMPORTING
@ -143,4 +117,30 @@ CLASS zcl_abapgit_2fa_auth_base IMPLEMENTATION.
ENDIF.
ENDMETHOD.
METHOD is_2fa_required.
rv_required = abap_false.
ENDMETHOD.
METHOD is_session_running.
rv_running = mv_session_running.
ENDMETHOD.
METHOD raise_comm_error_from_sy.
DATA: lv_error_msg TYPE string.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO lv_error_msg.
RAISE EXCEPTION TYPE zcx_abapgit_2fa_comm_error
EXPORTING
mv_text = |Communication error: { lv_error_msg }| ##NO_TEXT.
ENDMETHOD.
METHOD supports_url.
rv_supported = mo_url_regex->create_matcher( text = iv_url )->match( ).
ENDMETHOD.
ENDCLASS.

View File

@ -143,7 +143,7 @@ CLASS ZCL_ABAPGIT_HTTP IMPLEMENTATION.
cl_http_client=>create_by_url(
EXPORTING
url = zcl_abapgit_url=>host( iv_url )
ssl_id = 'ANONYM'
ssl_id = zcl_abapgit_exit=>get_instance( )->get_ssl_id( )
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
IMPORTING

View File

@ -7,6 +7,7 @@ CLASS zcl_abapgit_exit DEFINITION
INTERFACES: zif_abapgit_exit.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-DATA gi_exit TYPE REF TO zif_abapgit_exit .
@ -14,7 +15,7 @@ ENDCLASS.
CLASS zcl_abapgit_exit IMPLEMENTATION.
CLASS ZCL_ABAPGIT_EXIT IMPLEMENTATION.
METHOD get_instance.
@ -93,25 +94,6 @@ CLASS zcl_abapgit_exit IMPLEMENTATION.
ENDMETHOD.
METHOD zif_abapgit_exit~create_http_client.
TRY.
ri_client = gi_exit->create_http_client( iv_url ).
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_exit~http_client.
TRY.
gi_exit->http_client( ii_client ).
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_exit~change_tadir.
TRY.
@ -126,4 +108,34 @@ CLASS zcl_abapgit_exit IMPLEMENTATION.
ENDMETHOD.
METHOD zif_abapgit_exit~create_http_client.
TRY.
ri_client = gi_exit->create_http_client( iv_url ).
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_exit~get_ssl_id.
TRY.
rv_ssl_id = gi_exit->get_ssl_id( ).
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
rv_ssl_id = 'ANONYM'.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_exit~http_client.
TRY.
gi_exit->http_client( ii_client ).
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
ENDTRY.
ENDMETHOD.
ENDCLASS.

View File

@ -1,37 +1,48 @@
INTERFACE zif_abapgit_exit PUBLIC.
INTERFACE zif_abapgit_exit
PUBLIC .
TYPES:
ty_icm_sinfo2_tt TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.
METHODS:
change_local_host
CHANGING ct_hosts TYPE ty_icm_sinfo2_tt,
allow_sap_objects
RETURNING VALUE(rv_allowed) TYPE abap_bool,
change_proxy_url
IMPORTING iv_repo_url TYPE csequence
CHANGING cv_proxy_url TYPE string,
change_proxy_port
IMPORTING iv_repo_url TYPE csequence
CHANGING cv_proxy_port TYPE string,
change_proxy_authentication
IMPORTING iv_repo_url TYPE csequence
CHANGING cv_proxy_authentication TYPE abap_bool,
create_http_client
IMPORTING
iv_url TYPE string
RETURNING
VALUE(ri_client) TYPE REF TO if_http_client
RAISING
zcx_abapgit_exception,
http_client
IMPORTING
ii_client TYPE REF TO if_http_client,
change_tadir
IMPORTING
iv_package TYPE devclass
io_log TYPE REF TO zcl_abapgit_log
CHANGING
ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt.
ty_icm_sinfo2_tt TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY .
METHODS change_local_host
CHANGING
!ct_hosts TYPE ty_icm_sinfo2_tt .
METHODS allow_sap_objects
RETURNING
VALUE(rv_allowed) TYPE abap_bool .
METHODS change_proxy_url
IMPORTING
!iv_repo_url TYPE csequence
CHANGING
!cv_proxy_url TYPE string .
METHODS change_proxy_port
IMPORTING
!iv_repo_url TYPE csequence
CHANGING
!cv_proxy_port TYPE string .
METHODS change_proxy_authentication
IMPORTING
!iv_repo_url TYPE csequence
CHANGING
!cv_proxy_authentication TYPE abap_bool .
METHODS create_http_client
IMPORTING
!iv_url TYPE string
RETURNING
VALUE(ri_client) TYPE REF TO if_http_client
RAISING
zcx_abapgit_exception .
METHODS http_client
IMPORTING
!ii_client TYPE REF TO if_http_client .
METHODS change_tadir
IMPORTING
!iv_package TYPE devclass
!io_log TYPE REF TO zcl_abapgit_log
CHANGING
!ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt .
METHODS get_ssl_id
RETURNING
VALUE(rv_ssl_id) TYPE ssfapplssl .
ENDINTERFACE.