示例#1
0
    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
示例#2
0
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,
    )
示例#3
0
    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
示例#4
0
def get_auth_urls(request=None):
    return settings.TURBION_OPENID_TRUST_URL, uri_reverse('turbion_openid_authenticate')
示例#5
0
def get_server():
    from openid.server import server

    return server.Server(_get_store(), uri_reverse("turbion_openid_endpoint"))
示例#6
0
def whitelist():
    return '<link rel="whitelist" href="%(url)s">' % {'url': uri_reverse("turbion_whitelist")}
示例#7
0
def server_tag():
    return '<link rel="openid.server" href="%(url)s"><link rel="openid2.provider" href="%(url)s">' % {'url': uri_reverse("turbion_openid_endpoint")}