Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
make sure bearer and basic auth policies explicitly look at diff auth
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed Nov 23, 2016
1 parent 87cdb0e commit 5914ecb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plone.server/plone/server/auth/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ async def extract_token(self):
header_auth = self.request.headers.get('AUTHORIZATION')
if header_auth is not None:
schema, _, encoded_token = header_auth.partition(' ')
if schema.lower() == 'basic' or schema.lower() == 'bearer':
if schema.lower() == 'bearer':
return {
'password': encoded_token
'password': encoded_token.strip()
}


Expand All @@ -45,11 +45,11 @@ async def extract_token(self):
header_auth = self.request.headers.get('AUTHORIZATION')
if header_auth is not None:
schema, _, encoded_token = header_auth.partition(' ')
if schema.lower() == 'basic' or schema.lower() == 'bearer':
if schema.lower() == 'basic':
userid, _, password = encoded_token.partition(':')
return {
'id': userid,
'password': password
'id': userid.strip(),
'password': password.strip()
}


Expand Down

0 comments on commit 5914ecb

Please sign in to comment.