Confirmed users
358
edits
No edit summary |
|||
| Line 81: | Line 81: | ||
# Get the MAC Auth id from the header. | # Get the MAC Auth id from the header. | ||
id = macauthlib.get_id(request) | id = macauthlib.get_id(request) | ||
# Determine the corresponding MAC Auth key | # Determine the corresponding MAC Auth key | ||
key = tokenlib.get_token_secret(id, node_master_secret) | key = tokenlib.get_token_secret(id, node_master_secret) | ||
# Check the MAC Auth signature. | # Check the MAC Auth signature. | ||
if not macauthlib.check_signature(request, key): | if not macauthlib.check_signature(request, key): | ||
raise HTTPUnauthorized("Invalid Signature") | raise HTTPUnauthorized("Invalid Signature") | ||
# Parse the token to obtain user data. | # Parse the token to obtain user data. | ||
data = tokenlib.parse_token(id, node_master_secret) | data = tokenlib.parse_token(id, node_master_secret) | ||
The node master secret must be obtained from the deployment configuration. | The node master secret must be obtained from the deployment configuration, e.g. from a setting in the config file or read from a shared [https://wiki.mozilla.org/Services/Sagrada/TokenServer#Shared_Secrets_File node secrets file]. | ||