Commits

Roman Barczyński  committed 6a89fdd

claimed identifier url is now XRDS document (OpenID 2.0)

  • Participants
  • Parent commits 40da40e

Comments (0)

Files changed (3)

File openid_provider/templates/openid_provider/identity.html

-{% extends "base.html" %}
-
-{% block extrahead %}{{ block.super }}
-<link rel="openid.server" href="{{ host }}{% url openid-provider-root %}">
-<link rel="openid2.provider" href="{{ host }}{% url openid-provider-root %}">
-{% endblock %}
-
-{% block content %}
-This is the identity page for the OpenID that this server serves.
-{% endblock %}

File openid_provider/urls.py

 
 urlpatterns = patterns('openid_provider.views',
 	url(r'^$', 'openid_server', name='openid-provider-root'),
-	url(r'^id/(.*)/$', 'openid_identity', name='openid-provider-identity'),
 	url(r'^decide/$', 'openid_decide', name='openid-provider-decide'),
 	url(r'^xrds/$', 'openid_xrds', name='openid-provider-xrds'),
+	url(r'^(?P<id>.*)/$', 'openid_xrds', {'identity': True}, name='openid-provider-identity'),
 )

File openid_provider/views.py

 	webresponse = server.encodeResponse(oresponse)
 	return django_response(webresponse)
 
-def openid_xrds(req):
+def openid_xrds(req, identity=False, id=None):
 	from openid.yadis.constants import YADIS_CONTENT_TYPE
-	from openid.consumer.discover import OPENID_IDP_2_0_TYPE
+	from openid.consumer.discover import OPENID_IDP_2_0_TYPE, OPENID_2_0_TYPE
+
+	if identity:
+		types = [OPENID_2_0_TYPE]
+	else:
+		types = [OPENID_IDP_2_0_TYPE]
 
 	response = render_to_response('openid_provider/xrds.xml',
 			{
 				'host': get_base_uri(req),
-				'types': [OPENID_IDP_2_0_TYPE],
+				'types': types,
 				'endpoints': [reverse('openid-provider-root')]
 			},
 			context_instance=RequestContext(req))
 	response['Content-Type'] = YADIS_CONTENT_TYPE
 	return response
 
-def openid_identity(req, *args):
-	return render_to_response('openid_provider/identity.html',
-		{'host': get_base_uri(req),},
-		context_instance=RequestContext(req))
-
 def openid_decide(req):
 	"""
 	The page that asks the user if they really want to sign in to the site, and