Skip to content

Commit 170359d

Browse files
committed
Added FIREWALL_SSO for "/firewall_sso/" api endpoint and retry reauth on
403 error code
1 parent 6878dbd commit 170359d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

go/api-frontend/aaa/authorization.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ var pathAdminRolesMap = []adminRoleMapping{
6161
adminRoleMapping{prefix: apiPrefix + "/services", role: "SERVICES"},
6262

6363
adminRoleMapping{prefix: apiPrefix + "/reports/", role: "REPORTS"},
64+
adminRoleMapping{prefix: apiPrefix + "/firewall_sso/", role: "FIREWALL_SSO"},
6465
adminRoleMapping{prefix: apiPrefix + "/monitoring/", role: "SYSTEM"},
6566
adminRoleMapping{prefix: apiPrefix + "/grafana/", role: "SYSTEM"},
6667

lib/pf/api/unifiedapiclient.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ sub call {
213213
$self->login();
214214
return $self->call($method,$path,$args,1);
215215
}
216+
elsif(!$retrying && $response_code == 403 && $path ne $pf::constants::api::LOGIN_PATH) {
217+
get_logger->info("Request to $path is forbidden, will perform a login and retry");
218+
$self->connection($self->curl);
219+
$self->login();
220+
return $self->call($method,$path,$args,1);
221+
}
216222
else {
217223
$response = decode_json($response_body);
218224
die $response_code . " " . $response->{message};

0 commit comments

Comments
 (0)