Skip to content

Commit

Permalink
Fix token expiring in external enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Powers committed Jul 25, 2024
1 parent 1e96933 commit 1378fac
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions blazar/enforcement/filters/external_service_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ def __init__(self, conf=None):
raise ExternalServiceMisconfigured(
message=_("ExternalService has no endpoints set."))

if conf.enforcement.external_service_token:
self.token = (self.external_service_token)
else:
client = BlazarKeystoneClient()
self.token = client.session.get_token()

self.token = conf.enforcement.external_service_token

@staticmethod
def _validate_url(url):
Expand Down Expand Up @@ -132,6 +127,10 @@ def _get_headers(self):

if self.token:
headers['X-Auth-Token'] = self.token
else:
client = BlazarKeystoneClient()
headers['X-Auth-Token'] = client.session.get_token()


return headers

Expand Down

0 comments on commit 1378fac

Please sign in to comment.