def process_response(self, request, response): from openid.yadis.constants import YADIS_HEADER_NAME if request.build_absolute_uri() == settings.TURBION_OPENID_IDENTITY_URL and \ response.status_code >= 200 and response.status_code < 300: response[YADIS_HEADER_NAME] = uri_reverse('turbion_openid_xrds') return response
def xrds(request): from openid.yadis.constants import YADIS_CONTENT_TYPE from openid.consumer.discover import OPENID_2_0_TYPE, OPENID_1_0_TYPE from openid.server.trustroot import RP_RETURN_TO_URL_TYPE return direct_to_template( request, 'turbion/openid/xrds.xml', { 'services': [ { 'types': [OPENID_1_0_TYPE, OPENID_2_0_TYPE], 'uri': uri_reverse("turbion_openid_endpoint"), 'local_id': settings.TURBION_OPENID_IDENTITY_URL, 'delegate': settings.TURBION_OPENID_IDENTITY_URL, }, { 'types': [RP_RETURN_TO_URL_TYPE], 'uri': uri_reverse('turbion_openid_authenticate'), }, ] }, mimetype=YADIS_CONTENT_TYPE, )
def get_unsubscribe_url(self): from django.utils.http import urlencode url = uri_reverse( 'turbion_watchlist_unsubscribe', args=(self.user.pk,) ) url += '?' + urlencode({ 'post': self.post.pk, 'action': 'unsubs', 'code': self.user.get_code() }) return url
def get_auth_urls(request=None): return settings.TURBION_OPENID_TRUST_URL, uri_reverse('turbion_openid_authenticate')
def get_server(): from openid.server import server return server.Server(_get_store(), uri_reverse("turbion_openid_endpoint"))
def whitelist(): return '<link rel="whitelist" href="%(url)s">' % {'url': uri_reverse("turbion_whitelist")}
def server_tag(): return '<link rel="openid.server" href="%(url)s"><link rel="openid2.provider" href="%(url)s">' % {'url': uri_reverse("turbion_openid_endpoint")}