webmcp
diff framework/env/auth/openid/xrds_document.lua @ 20:47ddf0f86009
OpenID 2.0 Relying Party support
author | jbe/bsw |
---|---|
date | Fri Apr 02 02:11:32 2010 +0200 (2010-04-02) |
parents | |
children | 3a6fe8663b26 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/auth/openid/xrds_document.lua Fri Apr 02 02:11:32 2010 +0200 1.3 @@ -0,0 +1,32 @@ 1.4 +--[[-- 1.5 +auth.openid.xrds_document{ 1.6 + return_to_module = return_to_module, 1.7 + return_to_view = return_to_view 1.8 +} 1.9 + 1.10 +This function returns an XRDS document with Content-Type 1.11 +application/xrds+xml. For more information see documentation on 1.12 +auth.openid.xrds_document{...}. 1.13 + 1.14 +--]]-- 1.15 + 1.16 +function auth.openid.xrds_document(args) 1.17 + slot.set_layout(nil, "application/xrds+xml") 1.18 + slot.put_into("data", 1.19 + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", 1.20 + "<xrds:XRDS xmlns:xrds=\"xri://$xrds\" xmlns=\"xri://$xrd*($v*2.0)\">\n", 1.21 + " <XRD>\n", 1.22 + " <Service>\n", 1.23 + " <Type>http://specs.openid.net/auth/2.0/return_to</Type>\n", 1.24 + " <URI>", 1.25 + encode.url{ 1.26 + base = request.get_absolute_baseurl(), 1.27 + module = args.return_to_module, 1.28 + view = args.return_to_view 1.29 + }, 1.30 + "</URI>\n", 1.31 + " </Service>\n", 1.32 + " </XRD>\n", 1.33 + "</xrds:XRDS>\n" 1.34 + ) 1.35 +end