From fe00dd0be8fd88dc8179eed7a38663f07c1288a7 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 01 Mar 2008 16:14:55 +0000 Subject: added more OpenID service types and handling of append='qxri' attribute * added OpenID 1.1 and 2.0 service types to SERVICE_CLASSES * append qxri to URI in presence of append='qxri' attribute (append='authority' is yet to be handled) * added more OpenID service type URIs to friendlyServiceName() Signed-off-by: Michael Krelin --- diff --git a/src/components/xriProtocolHandler.js b/src/components/xriProtocolHandler.js index 1105874..3d27784 100755 --- a/src/components/xriProtocolHandler.js +++ b/src/components/xriProtocolHandler.js @@ -49,6 +49,9 @@ const XP_FIRST_ORDERED_NODE_TYPE = 9; var SERVICE_CLASSES = { 'xri://+i-service*(+contact)*($v*1.0)': 'i-contact', 'http://openid.net/signon/1.0': 'openid', + 'http://openid.net/signon/1.1': 'openid', + 'http://specs.openid.net/auth/2.0/signon': 'openid', + 'http://specs.openid.net/auth/2.0/server': 'openid', 'xri://$res*auth*($v*2.0)': 'res-auth', 'xri://+i-service*(+authn)*(+saml)*($v*1.0)': 'authn-saml', 'xri://+i-service*(+metadata)*(+saml)*($v*1.0)' : 'metadata-saml', @@ -237,10 +240,11 @@ function renderService(srv, doc, qxri) } - res = runExpr(doc, srv, "xrd:URI/text()"); - var u; - while (u = res.iterateNext()) { - if (!u.nodeValue) + res = runExpr(doc, srv, "xrd:URI"); + var uu; + while (uu = res.iterateNext()) { + var u = uu.firstChild; + if (!(u.nodeValue && u.nodeType==3)) continue; var srvType = guessServiceTypeByURI(u.nodeValue); @@ -285,7 +289,14 @@ function renderService(srv, doc, qxri) } } - html_uris += "" + var linkhref = u.nodeValue; + var xrap = uu.getAttribute('append'); + if(xrap=='qxri') { + linkhref += qxri.replace(/^xri:\/\//,''); + }else if(xrap!=null){ + dump("Unhandled @append: "+xrap+"\n"); + } + html_uris += "" + linkContent + ""; html_uris += ""; } @@ -392,7 +403,12 @@ function friendlyServiceName(srvType, uri) if (srvType && srvType == "xri://+i-service*(+contact)*($v*1.0)") { return "Contact Service"; } - else if (srvType && srvType == "http://openid.net/signon/1.0") { + else if (srvType && ( + srvType == "http://openid.net/signon/1.0" + || srvType == "http://openid.net/signon/1.1" + || srvType == "http://specs.openid.net/auth/2.0/signon" + || srcType == "http://specs.openid.net/auth/2.0/server" + ) ) { return "OpenID Authentication Service"; } else if (srvType && srvType == "xri://$res*auth*($v*2.0)") { -- cgit v0.9.0.2