|
a/Allura/allura/controllers/rest.py |
|
b/Allura/allura/controllers/rest.py |
|
... |
|
... |
114 |
)
|
114 |
)
|
115 |
session(req_token).flush()
|
115 |
session(req_token).flush()
|
116 |
log.info('Saving new request token with key: %s', req_token.api_key)
|
116 |
log.info('Saving new request token with key: %s', req_token.api_key)
|
117 |
return req_token.to_string()
|
117 |
return req_token.to_string()
|
118 |
|
118 |
|
119 |
@expose('jinja:oauth_authorize.html')
|
119 |
@expose('jinja:allura:templates/oauth_authorize.html')
|
120 |
def authorize(self, oauth_token=None):
|
120 |
def authorize(self, oauth_token=None):
|
121 |
security.require_authenticated()
|
121 |
security.require_authenticated()
|
122 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
122 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
123 |
rtok.user_id = c.user._id
|
123 |
rtok.user_id = c.user._id
|
124 |
if rtok is None:
|
124 |
if rtok is None:
|
|
... |
|
... |
126 |
raise exc.HTTPForbidden
|
126 |
raise exc.HTTPForbidden
|
127 |
return dict(
|
127 |
return dict(
|
128 |
oauth_token=oauth_token,
|
128 |
oauth_token=oauth_token,
|
129 |
consumer=rtok.consumer_token)
|
129 |
consumer=rtok.consumer_token)
|
130 |
|
130 |
|
131 |
@expose('jinja:oauth_authorize_ok.html')
|
131 |
@expose('jinja:allura:templates/oauth_authorize_ok.html')
|
132 |
def do_authorize(self, yes=None, no=None, oauth_token=None):
|
132 |
def do_authorize(self, yes=None, no=None, oauth_token=None):
|
133 |
security.require_authenticated()
|
133 |
security.require_authenticated()
|
134 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
134 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
135 |
if no:
|
135 |
if no:
|
136 |
rtok.delete()
|
136 |
rtok.delete()
|