Skip to content

Commit 81a668f

Browse files
committed
Renew bearer token 5 minutes before expiry
1 parent f205519 commit 81a668f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

blackduck/Authentication.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, session, token):
3838
self.valid_until = datetime.now()
3939

4040
def __call__(self, request):
41-
if not self.bearer_token or datetime.now() > self.valid_until - timedelta(minutes=15):
41+
if not self.bearer_token or datetime.now() > self.valid_until - timedelta(minutes=5):
4242
# If bearer token not set or nearing expiry
4343
self.authenticate()
4444

@@ -118,7 +118,7 @@ def __init__(self, session, username, password):
118118
self.valid_until = datetime.now()
119119

120120
def __call__(self, request):
121-
if not self.bearer_token or datetime.now() > self.valid_until - timedelta(minutes=15):
121+
if not self.bearer_token or datetime.now() > self.valid_until - timedelta(minutes=5):
122122
# If bearer token not set or nearing expiry
123123
self.authenticate()
124124

0 commit comments

Comments
 (0)