Skip to content

Commit 21d1f37

Browse files
authored
ABAP Better logging (#5500)
1 parent f0bbadd commit 21d1f37

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/abap/build/connector.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"net/http/cookiejar"
1212
"net/url"
1313
"strconv"
14+
"strings"
1415
"time"
1516

1617
"github.com/SAP/jenkins-library/pkg/abaputils"
@@ -72,6 +73,16 @@ func (conn *Connector) GetToken(appendum string) error {
7273
defer response.Body.Close()
7374
token := response.Header.Get("X-CSRF-Token")
7475
conn.Header["X-CSRF-Token"] = []string{token}
76+
log.RegisterSecret(token)
77+
78+
for _, cookie := range response.Header.Values("Set-Cookie") {
79+
if strings.HasPrefix(cookie, "SAP_SESSIONID_") {
80+
// SAP_SESSIONID_SID_123=YiWizhmMljBNOkKxJkG-flmT9wWfetHwifb6Fj5zqUI%3d; path=/; secure; HttpOnly
81+
id := cookie[strings.Index(cookie, "=")+1 : strings.Index(cookie, "; ")]
82+
log.RegisterSecret(id)
83+
}
84+
}
85+
7586
return nil
7687
}
7788

0 commit comments

Comments
 (0)