Skip to content

Commit 520ea3d

Browse files
committed
Revert "Removed references to the oAuth realm since"
This reverts commit 2e36ea2. Conflicts: ox3apiclient/__init__.py
1 parent e99cb4c commit 520ea3d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

ox3apiclient/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
class Client(object):
4545

46-
def __init__(self, domain, consumer_key, consumer_secret,
46+
def __init__(self, domain, realm, consumer_key, consumer_secret,
4747
callback_url='oob',
4848
scheme='http',
4949
request_token_url=REQUEST_TOKEN_URL,
@@ -57,6 +57,8 @@ def __init__(self, domain, consumer_key, consumer_secret,
5757
"""
5858
5959
domain -- Your UI domain. The API is accessed off this domain.
60+
realm -- Your sso realm. While not necessary for all OAuth
61+
implementations, it is a requirement for OpenX Enterprise
6062
consumer_key -- Your consumer key.
6163
consumer_secret -- Your consumer secret.
6264
callback_url -- Callback URL to redirect to on successful authorization.
@@ -69,6 +71,7 @@ def __init__(self, domain, consumer_key, consumer_secret,
6971
"""
7072

7173
self.domain = domain
74+
self.realm = realm
7275
self.consumer_key = consumer_key
7376
self.consumer_secret = consumer_secret
7477
self.callback_url = callback_url
@@ -130,6 +133,7 @@ def _sign_request(self, req):
130133

131134
# Update our original requests headers to include the OAuth Authorization
132135
# header and return it.
136+
req.headers.update(oauth_req.to_header(realm=self.realm))
133137
return \
134138
urllib2.Request(req.get_full_url(), headers=req.headers, data=data)
135139

@@ -366,6 +370,7 @@ def client_from_file(file_path='.ox3rc', env=None):
366370
# Required parameters for a ox3apiclient.Client instance.
367371
required_params = [
368372
'domain',
373+
'realm',
369374
'consumer_key',
370375
'consumer_secret']
371376

@@ -381,6 +386,7 @@ def client_from_file(file_path='.ox3rc', env=None):
381386

382387
client = Client(
383388
domain=client_params['domain'],
389+
realm=client_params['realm'],
384390
consumer_key=client_params['consumer_key'],
385391
consumer_secret=client_params['consumer_secret'])
386392

0 commit comments

Comments
 (0)