Bug 721021

Summary: Unable to parse OAuth parameters from Authorization header
Product: [Retired] Pulp Reporter: Jason E. Rist <jrist>
Component: z_otherAssignee: James Slagle <jslagle>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jslagle, lzap, mmccune, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 26   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 14:01:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 641987    

Description Jason E. Rist 2011-07-13 14:47:36 UTC
Description of problem:
oauth apperas to not be working

Version-Release number of selected component (if applicable):
pulp-0.0.206-1.fc14.noarch

How reproducible:
Very. 


Steps to Reproduce:
1. run pulp .206-1
2. do a rest call of
response = get('/pulp/api/users/', self.default_headers).body
    JSON.parse(response)
3. using oauth (katello is a good example!)

Actual results:
500 error

Expected results:
receive list of users.
[{"_id": "f6327619-7123-4a80-9871-d3b4c6a4ee11", "name": null, "roles": ["super-users"], "_ns": "users", "login": "admin", "password": "TJuZ6LY3lbo=,7y5vRB/GLJH/zECIC23idrvadKclrXwM/F/nqeVjWYo=", "id": "f6327619-7123-4a80-9871-d3b4c6a4ee11"}]

Additional info:
Stack Trace
2011-07-12 20:16:13,948 1729:140137800050432: gofer.messaging.broker:INFO: broker:100 connecting:
{localhost:5672}:
transport=TCP
host=localhost
port=5672
cacert=/etc/pki/qpid/ca/ca.crt
clientcert=/etc/pki/qpid/client/client.pem
2011-07-12 20:16:13,965 1729:140137800050432: gofer.messaging.broker:INFO: broker:103 {localhost:5672} connected to AMQP
2011-07-12 20:16:21,426 1729:140137766479616: pulp.server.db.connection:INFO: connection:46 Attempting Database connection with seeds = localhost
2011-07-12 20:16:21,428 1729:140137766479616: pulp.server.db.connection:INFO: connection:51 Database connection established with: seeds = localhost, name = pulp_database
2011-07-12 20:16:21,556 1729:140137635755776: pulp.server.webservices.controllers.decorators:ERROR: decorators:52 Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 48, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 112, in _auth_decorator
    user = check_oauth(username, meth, url, auth, query)
  File "/usr/lib/python2.7/site-packages/pulp/server/auth/authentication.py", line 195, in check_oauth
    req = oauth2.Request.from_request(method, url, headers, query_string=query)
  File "/usr/lib/python2.7/site-packages/oauth2/__init__.py", line 434, in from_request
    raise Error('Unable to parse OAuth parameters from '
Error: Unable to parse OAuth parameters from Authorization header.

2011-07-12 20:16:59,839 1729:140137635755776: pulp.server.webservices.controllers.decorators:ERROR: decorators:52 Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 48, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 112, in _auth_decorator
    user = check_oauth(username, meth, url, auth, query)
  File "/usr/lib/python2.7/site-packages/pulp/server/auth/authentication.py", line 195, in check_oauth
    req = oauth2.Request.from_request(method, url, headers, query_string=query)
  File "/usr/lib/python2.7/site-packages/oauth2/__init__.py", line 434, in from_request
    raise Error('Unable to parse OAuth parameters from '
Error: Unable to parse OAuth parameters from Authorization header.

2011-07-13 01:00:02,854 1729:140137325389568: pulp.server.tasking.task:INFO: task:365 Task succeeded: Task 19ba6e42-acf6-11e0-96dd-0024d721d4c0: cull_history(, )
2011-07-13 07:00:04,580 1729:140137325389568: pulp.server.tasking.task:INFO: task:365 Task succeeded: Task 19ba353a-acf6-11e0-96dc-0024d721d4c0: cull_audited_events(, )

Comment 1 James Slagle 2011-07-13 16:29:33 UTC
committed fix in pulp master: 1f9936f045e28dda484781d032cbf6a1ef772637

Issue was the blank Basic auth header for repo auth that was getting merged with the auth header for OAuth.  Added a check to remove that.

Comment 2 Jeff Ortel 2011-07-14 20:32:59 UTC
Build 0.207.

Comment 3 Lukas Zapletal 2011-07-18 14:48:15 UTC
Blocker for Katello, is there any chance of cherry-picking this into CR14 for us? 

Thanks!

Comment 4 Preethi Thomas 2011-07-18 20:05:39 UTC
[root@preethi ~]# rpm -q pulp
pulp-0.0.206-2.fc14.noarch

[root@preethi ~]# python oauth.py 
[{"use_symlinks": false, "package_count": 2935, "distributionid": ["ks-f15-noarch"], "consumer_cert": null, "consumer_ca": null, "filters": [], "id": "f15", "publish": true, "source": {"url": "http://download.devel.redhat.com/released/F-15/GOLD/Fedora/x86_64/os/", "type": "remote"}, "groupid": [], "files": "/pulp/api/repositories/f15/files/", "relative_path": "released/F-15/GOLD/Fedora/x86_64/os", "sync_schedule": null, "arch": "noarch", "feed_cert": null, "name": "f15", "feed_ca": null, "notes": {}, "last_sync": "2011-07-18T16:03:42-04:00", "clone_ids": [], "checksum_type": "sha256", "_id": "f15", "uri_ref": "/pulp/api/repositories/f15/", "files_count": 0, "packages": "/pulp/api/repositories/f15/packages/", "packagegroups": "/pulp/api/repositories/f15/packagegroups/", "packagegroupcategories": "/pulp/api/repositories/f15/packagegroupcategories/", "errata": "/pulp/api/repositories/f15/errata/", "distribution": "/pulp/api/repositories/f15/distribution/", "keys": "/pulp/api/repositories/f15/keys/", "comps": "/pulp/api/repositories/f15/comps/"}]

Comment 5 Preethi Thomas 2011-07-19 11:25:21 UTC
verified
Also Lukas confirmed that this is working in katello
I can confirm this fixes oauth problem:

           candlepin        ok       27ms
           pulp_auth        ok       90ms
           pulp             ok       108ms
           candlepin_auth   ok       27ms

Comment 6 Preethi Thomas 2011-08-16 14:01:05 UTC
Closing with Community Release 15

pulp-0.0.223-4.