webmcp
view framework/env/auth/openid/xrds_document.lua @ 31:1cd9e69b85cb
add execute.load_chunk(args)
load_chunk loads the content of a lua file and returns the code.
It can construct the path name easily so you can put helper code in
seperate files for DRYness.
load_chunk loads the content of a lua file and returns the code.
It can construct the path name easily so you can put helper code in
seperate files for DRYness.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Tue Oct 05 02:34:04 2010 +0200 (2010-10-05) |
parents | 3a6fe8663b26 |
children |
line source
1 --[[--
2 auth.openid.xrds_document{
3 return_to_module = return_to_module,
4 return_to_view = return_to_view
5 }
7 This function returns an XRDS document with Content-Type
8 application/xrds+xml. For more information see documentation on
9 auth.openid.xrds_document{...}.
11 --]]--
13 function auth.openid.xrds_document(args)
14 slot.set_layout(nil, "application/xrds+xml")
15 slot.put_into("data",
16 '<?xml version="1.0" encoding="UTF-8"?>\n',
17 '<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">\n',
18 ' <XRD>\n',
19 ' <Service>\n',
20 ' <Type>http://specs.openid.net/auth/2.0/return_to</Type>\n',
21 ' <URI>',
22 encode.url{
23 base = request.get_absolute_baseurl(),
24 module = args.return_to_module,
25 view = args.return_to_view
26 },
27 '</URI>\n',
28 ' </Service>\n',
29 ' </XRD>\n',
30 '</xrds:XRDS>\n'
31 )
32 end