Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Add data-set name for invalid bearer token messages
Browse files Browse the repository at this point in the history
- This is actually the error requirement that sparked https://www.pivotaltracker.com/story/show/72627064 off
  • Loading branch information
Ralph Cowling committed Jun 12, 2014
1 parent b1a2126 commit ab19ce8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backdrop/write/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def _validate_auth(data_set_config):

if not auth_header_is_valid(data_set_config, auth_header):
token = extract_bearer_token(auth_header)
abort(401, 'Unauthorized: Invalid bearer token "{}"'.format(token))
abort(401, 'Unauthorized: Invalid bearer token "{0}" for "{1}"'.format(
token, data_set_config.name))


def _append_to_data_set(data_set_config, data, ok_message=None):
Expand Down
2 changes: 1 addition & 1 deletion features/write_api/access_control.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: access_control
when I POST to the specific path "/data/group/type"
then I should get back a status of "401"
and I should get a "WWW-Authenticate" header of "bearer"
and I should get back the message "Unauthorized: Invalid bearer token "invalid-bearer-token""
and I should get back the message "Unauthorized: Invalid bearer token "invalid-bearer-token" for "some_data_set""

@posting_things
Scenario: unauthorized when posting with a badly formed authorization header
Expand Down

0 comments on commit ab19ce8

Please sign in to comment.