Skip to content

Utility function to perform the server-side of Hawk authentication

License

Notifications You must be signed in to change notification settings

uktrade/hawk-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hawk-server CircleCI Test Coverage

Utility function to perform the server-side of Hawk authentication, with no dependencies other than the Python standard library.

Installation

pip install hawk-server

Usage

from hawkserver import authenticate_hawk_header

def lookup_credentials(id):
    # Return {'id': 'some-id', 'key': 'some-secret'} matching credentials,
    # or None if credentials can't be found

def seen_nonce(nonce, id):
    # Store nonce, return True if nonce previously seen

error_message, credentials = authenticate_hawk_header(
    lookup_credentials, seen_nonce, max_skew,
    header, method, host, port, path, content_type, content,
)
if error_message is not None:
    # Return error or raise exception as needed

About

Utility function to perform the server-side of Hawk authentication

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages