File: webid_demo.vsp

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (128 lines) | stat: -rw-r--r-- 3,904 bytes parent folder | download | duplicates (5)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?vsp
  declare webid, error, action, hostUrl, httpsUrl, url, callback, certificate any;

	webid := get_keyword ('webid', params);
	error := get_keyword ('error', params);
	action := get_keyword ('go', params);
  if (length (webid) or length (error))
    goto html;

  if (not length (action))
    goto html;

  if (is_https_ctx ())
  {
    hostUrl := 'https://' || ODS.ODS_API.getDefaultHttps ();
  }
  else
  {
    hostUrl := cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DefaultHost');
    if (hostUrl is null)
    {
      hostUrl := sys_stat ('st_host_name');
      if (server_http_port () <> '80')
        hostUrl := hostUrl || ':' || server_http_port ();
    }
    hostUrl := 'http://' || hostUrl;
  }
  if (isnull (hostUrl))
  {
    error := 'No certificate';
    goto html;
  }
  httpsUrl := ODS.ODS_API.getDefaultHttps();
  if (isnull (httpsUrl))
    httpsUrl := 'id.myopenlink.net';

  callback := hostUrl || '/ods/webid/webid_demo.vsp';
  url := sprintf ('https://%s/ods/webid_verify.vsp?callback=%U', httpsUrl, callback);
  if (get_keyword ('expiration', params, '') = 'true')
    url := url || '&expiration=true';

  http_status_set (302);
  http_header (sprintf ('Location: %s\r\n', url));
  return;

html:
?>
<html>
  <head>
    <title>WebID Verification Demo</title>
    <style type="text/css">
      body {
      	background-color: white;
      	color: black;
      	font-size: 10pt;
      	font-family: Verdana, Helvetica, sans-serif;
      }
      ul {
        font-family: Verdana, Helvetica, sans-serif;
        list-style-type: none;
      }
      #qrcode {
        float: right;
        clear: right;
        margin-right: 20px;
      }
    </style>
  </head>
  <body>
    <h1>WebID Verification Demo</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 check the WebID watermark in your X.509 Certificate.<br/><br/>
      This service supports WebIDs based on the following URI schemes (more to come):
      <ul>
      	<li>* <b>acct</b>, e.g: <span style="font-size: 80%; color: #1DA237;">acct:ExampleUser@id.example.com</span></li>
      	<li>* <b>http</b>, e.g: <span style="font-size: 80%; color: #1DA237;">http://id.example.com/person/ExampleUser#this</span></li>
      	<li>* <b>ldap</b>, e.g: <span style="font-size: 80%; color: #1DA237;">ldap://ldap.example.com/o=An%20Example%5C2C%20Inc.,c=US</span></li>
      	<li>* <b>mailto</b>, e.g: <span style="font-size: 80%; color: #1DA237;">mailto:ExampleUser@id.example.com</span></li>
      </ul>
    </div>
    <div>
    	<a href="http://ods.openlinksw.com/wiki/ODS/ODSWebIDIdP">Help</a>
    </div>
    <br/>
    <br/>
    <div>
      <form method="get">
	      <input type="checkbox" value="true" name="expiration" id="expiration" />  <label for="expiration">Check Certificate Expiration</label><br />
        <input type="submit" name="go" value="Check"/>
      </form>
    </div>
    <?vsp
      if (length (webid) or length (error))
      {
    ?>
      <div>
      	The return values are:
  	    <ul>
          <?vsp
            if (length (webid))
            {
          ?>
  	      <li>WebID - <?vsp http(sprintf('<a href="%s">%s</a>', DB.DBA.RDF_PROXY_ENTITY_IRI (rtrim (webid, '#this')), DB.DBA.RDF_PROXY_ENTITY_IRI (rtrim (webid, '#this')) )); ?></li>
  	      <li>Timestamp in ISO 8601 format - <?V get_keyword ('ts', params) ?></li>
          <?vsp
            }
            if (length (error))
            {
          ?>
  	      <li>Error - <?V error ?></li>
          <?vsp
            }
          ?>
  	    </ul>
      </div>
    <?vsp
      }
    ?>
  </body>
</html>