Add ping method to auth engines to determine if they are reachable
This commit is contained in:
parent
a6ea16abc5
commit
0dfb6806e3
6 changed files with 67 additions and 0 deletions
|
@ -37,6 +37,12 @@ class ExternalJWTAuthN(FederatedUsers):
|
|||
with open(public_key_path) as public_key_file:
|
||||
self.public_key = public_key_file.read()
|
||||
|
||||
def ping(self):
|
||||
result = self.client.get(self.getuser_url, timeout=2)
|
||||
if result.status_code // 100 != 4:
|
||||
return (False, result.text or 'Could not reach JWT authn endpoint')
|
||||
|
||||
return (True, None)
|
||||
|
||||
def get_user(self, username_or_email):
|
||||
if self.getuser_url is None:
|
||||
|
|
Reference in a new issue