Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # Copyright 2007, 2008,2009 by Benoît Chesneau <benoitc@e-engura.org> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #
except ImportError: from yadis import xri
self.openid = openid_ self.issued = issued self.attrs = attrs or {} self.sreg = sreg_ or {} self.ax = ax_ or {} self.is_iname = (xri.identifierScheme(openid_) == 'XRI')
return '<OpenID: %s>' % self.openid
return self.openid
service = discover(openid_url) use_ax = False use_sreg = False for endpoint in service[1]: if not use_sreg: use_sreg = sreg.supportsSReg(endpoint) if not use_ax: use_ax = endpoint.usesExtension("http://openid.net/srv/ax/1.0") if use_ax and use_sreg: break if not use_sreg and not use_ax: use_sreg = True return use_ax, use_sreg
if next is None: return DEFAULT_NEXT next = str_to_unicode(urllib.unquote(next), 'utf-8') next = next.strip() if next.startswith('/'): return next return DEFAULT_NEXT
""" return openid object from response """ issued = int(time.time()) sreg_resp = sreg.SRegResponse.fromSuccessResponse(openid_response) \ or [] ax_resp = ax.FetchResponse.fromSuccessResponse(openid_response) ax_args = {} if ax_resp is not None: ax_args = ax_resp.getExtensionArgs() ax_resp.parseExtensionArgs(ax_args) ax_args = ax_resp.data
return OpenID( openid_response.identity_url, issued, openid_response.signed_fields, dict(sreg_resp), ax_args )
if request.is_secure(): protocol = 'https' else: protocol = 'http' host = escape(get_host(request)) return '%s://%s' % (protocol, host)
return get_url_host(request) + request.get_full_path() |