1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
<?vsp
declare info, res, cb, mod, exp, webid, ret_url any;
cb := {?'callback'};
if (not length (cb))
{
goto html;
}
if (strchr (cb, '?') is null)
cb := cb || '?';
else
cb := cb || '&';
mod := exp := '';
if (not is_http_ctx ())
res := 'noCert';
else
{
info := get_certificate_info (9);
if (info is null)
res := 'noCert';
else if (FOAF_SSL_AUTH_GEN (null, 1, 0))
{
webid := FOAF_SSL_WEBID_GET ();
res := 'success';
}
else
res := 'noVerified';
if (info is not null)
{
mod := info[1];
exp := bin2hex (info[2]);
}
}
if (res = 'success')
{
ret_url := sprintf ('%swebid=%U', cb, webid);
}
else
{
ret_url := sprintf ('%serror=%U', cb, res);
}
ret_url := ret_url || sprintf ('&ts=%U', date_iso8601 (now ()));
ret_url := ret_url || sprintf ('&signature=%U', sha1_digest (ret_url));
http_status_set (302);
http_header (sprintf ('Location: %s\r\n', ret_url));
return;
html:
?>
<html>
<head>
<title>WebId Identity Provider</title>
<style type="text/css">
#qrcode {
float: right;
clear: right;
margin-right: 20px;
}
</style>
</head>
<body>
<h1>WebId Identity Provider</h1>
<?vsp declare qrimg, ua any;
ua := http_request_header (lines, 'User-Agent');
qrimg := ODS.ODS_API.qrcode (sprintf ('http://%{WSHost}s%s', http_path ()));
if (qrimg is not null and strcasestr (ua, 'Mobile') is null) {
?>
<div id="qrcode"><img alt="QRcode image" src="data:image/jpg;base64,<?V qrimg ?>"/></div>
<?vsp
} ?>
<div>
This will send a redirection to the URL you have specified in the input, including a signed assertion by this service about your WebID.
</div>
<div>
<form method="get">
Requesting service endpoint: <input type="text" value="" size="120" name="callback" /> <input type="submit" name="Log in" value="go"/>
</form>
</div>
<div>
The return values are:
<ul>
<li>webid: the webid have been verified</li>
<li>error: error code if verification fails </li>
<li>ts: timestamp in ISO 8601 format</li>
<li>signature: SHA1 digest over returning URL</li>
</ul>
</div>
<div>
<a href="http://ods.openlinksw.com/wiki/ODS/ODSWebIDIdpProxy">Help</a>
</div>
</body>
</html>
|