File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
charts/internal-gateway/files Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ server {
32
32
proxy_read_timeout 60s;
33
33
proxy_send_timeout 60s;
34
34
35
+ js_set $auth_header auth.setAuthHeader;
36
+
37
+ proxy_set_header Authorization $auth_header;
38
+
35
39
proxy_pass http://{{ index $vals "codefresh" "serviceEndpoints" "cfapi-auth" "svc" }}:{{ index $vals "codefresh" "serviceEndpoints" "cfapi-auth" "port" }};
36
40
}
37
41
}
Original file line number Diff line number Diff line change @@ -2,9 +2,21 @@ function account_name(r) {
2
2
const auth_entity = r . variables [ "auth_entity" ] ;
3
3
const b64decoded = Buffer . from ( auth_entity , 'base64' ) ;
4
4
const json = JSON . parse ( b64decoded ) ;
5
- const account_name = json . authenticatedEntity . activeAccount . name ;
5
+ const account_name = json . activeAccount . name ;
6
6
7
7
return account_name ;
8
8
}
9
9
10
- export default { account_name} ;
10
+ function setAuthHeader ( r ) {
11
+ let auth = r . headersIn [ 'authorization' ] ;
12
+ if ( auth ) {
13
+ // Look for the pattern: Credential=<value>/...
14
+ let matches = auth . match ( / C r e d e n t i a l = ( [ ^ \/ ] + ) \/ / ) ;
15
+ if ( matches && matches . length > 1 ) {
16
+ return matches [ 1 ] ;
17
+ }
18
+ }
19
+ return "" ;
20
+ }
21
+
22
+ export default { account_name, setAuthHeader } ;
You can’t perform that action at this time.
0 commit comments