Pull out JWT auth validation into validator class
Also fixes a small bug in validation (yay tests!)
This commit is contained in:
parent
678f868bc4
commit
c0f7530b29
5 changed files with 118 additions and 60 deletions
|
@ -28,11 +28,12 @@ class ExternalJWTAuthN(FederatedUsers):
|
|||
default_key_path = os.path.join(override_config_dir, ExternalJWTAuthN.PUBLIC_KEY_FILENAME)
|
||||
public_key_path = public_key_path or default_key_path
|
||||
if not os.path.exists(public_key_path):
|
||||
error_message = ('JWT Authentication public key file "%s" not found in directory %s' %
|
||||
(ExternalJWTAuthN.PUBLIC_KEY_FILENAME, override_config_dir))
|
||||
error_message = ('JWT Authentication public key file "%s" not found' % public_key_path)
|
||||
|
||||
raise Exception(error_message)
|
||||
|
||||
self.public_key_path = public_key_path
|
||||
|
||||
with open(public_key_path) as public_key_file:
|
||||
self.public_key = public_key_file.read()
|
||||
|
||||
|
|
Reference in a new issue