ODS.ODSWebIDIdPEx1

  • Topic
  • Discussion
  • ODS.ODSWebIDIdPEx1(Last) -- DAVWikiAdmin? , 2017-06-13 06:03:32 Edit WebDAV System Administrator 2017-06-13 06:03:32

    Using Virtuoso's WebID? Verify Proxy Service with an X.509 certificate WebID?: VSP Example


    <?vsp
      declare webid, error, action, hostUrl, 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 (not is_http_ctx ())
      {
        error := 'No certificate';
        goto html;
      }
    
      hostUrl := http_request_header (http_request_header () , 'Host' , null , sys_connected_server_address ());
      if (isstring (hostUrl) and strchr (hostUrl , ':') is null)
      {
        declare hp varchar;
        declare hpa any;
    
        hp := sys_connected_server_address ();
        hpa := split_and_decode (hp , 0 , '\0\0:');
        if (hpa [1] <> '80')
          hostUrl := hostUrl || ':' || hpa [1];
      }
      if (hostUrl not like 'https://%')
        hostUrl := 'https://' || hostUrl;
    
      certificate := client_attr ('client_certificate');
      callback := hostUrl || '/ods/webid_demo.vsp';
      url := sprintf ('http://id.myopenlink.net/ods/webid_verify.vsp?callback=%U&certificate=%U', callback, certificate);
      http_status_set (302);
      http_header (sprintf ('Location: %s\r\n', url));
      return;
    
    html:
    ?>
    <html>
      <head>
        <title>WebID Verification Demo - VSP</title>
      </head>
      <body>
        <h1>WebID Verification Demo - VSP</h1>
        <div>
          This will check your X.509 Certificate's WebID  watermark. <br/>Also note this service supports ldap, http, mailto, acct scheme based WebIDs.
        </div>
        <br/>
        <br/>
        <div>
          <form method="get">
            <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 -  <?V webid ?></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>