Introduction

This page describes very briefly how to combine the Géant Attribute Checker and Lindat’s Attribute Aggregator together. It assumes that the reader is already familiar with both technologies and serves only as  quick how-to.

How-to

This quick how-to uses korp.csc.fi as an example.

You need

  • The Apache Shibboleth Implementation (mod_shib + shibd).
  • The Géant Attribute Checker customized to your needs (see instructions there).
  • HTML gluecode (shown below)
  • Javascript code to contact Lindat’s Attribute Aggregator, e.g. for korp.csc.fi: aaggr.js

Stiching it together

Since both tools use the ”sessionHook” of Shibboleth, the idea is to daisy chain both tools.

/etc/shibboleth/attrChecker.html

Configure the file according to the instructions in Github.

/etc/shibboleth/shibboleth2.xml

Set the sessionHook to the glue code HTML that calls aaggr.js, again korp as an example. Note that this deviates from the instructions for the Attribute Checker alone.

<ApplicationDefaults entityID="https://sp.korp.csc.fi/"
                         REMOTE_USER="eppn persistent-id targeted-id"
                         metadataAttributePrefix="Meta-"
                         sessionHook="/attr.html"
                         signing="front" encryption="false">


Set a Session Handler within the Sessions Element. Note other Handlers in ”Sessions” have been removed for clarity, so copy/paste only the Handler and add it to the Sessions element.

Note the example below assumes only eppn to check for.

<Sessions lifetime="28800" 
          timeout="3600" 
          relayState="ss:mem" 
          checkAddress="false" 
          handlerSSL="true" 
          cookieProps="https">
  <!-- Geant Attribute Checker -->
  <Handler type="AttributeChecker" 
           Location="/AttrChecker"
           template="attrChecker.html"
           attributes="eppn"
           flushSession="true"/>
</Sessions>

<webroot>/attr.html

Add the glue code (this one contains the original documentation):

<html>
<!– This page glues together Lindat’s aaggreg Attribute statistic
tool and the Geant’s attribute Checker. It works client side and
therefore is not the fastest solution. You need to
* direct Shibboleth sessionHook to this page, eg. /attr.html
* redirect to AttrChecker in aaggr.js after attributes are sent.

References
* https://github.com/ufal/clarin-sp-aaggregator
* https://wiki.edugain.org/How_to_configure_Shibboleth_SP_attribute_checker –>

<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″/>
<script type=’text/javascript’ src=’//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js’></script>
<script type=’text/javascript’ src=’/aaggr.js’></script>
</head>
<body>
</body>
</html>

<webroot>/attr.js

The code below is copied verbatim from https://korp.csc.fi/aaggr.js

It connects to Lindat, delivers the statistics and then redirects to the Géant Checker.

//FILL THESE
var shibbolethSessionUrl = "/Shibboleth.sso/Session",
    spEntityID = "https://sp.korp.csc.fi/",
    aggregator_url='https://clarin-aa.ms.mff.cuni.cz/aaggreg/v1/got';

jQuery.get(shibbolethSessionUrl).
    done(function(data){
       var session = jQuery(data);
       var idp = session.find("strong:contains('Identity Provider:')")[0].nextSibling.nodeValue.trim();
       var attrs = session.find("u:contains('Attributes')").nextAll().map(function(index, el){ return encodeURIComponent(el.innerHTML)}).get();
       if(idp){
            var ts = new Date().toISOString();
            attributes_encoded = "attributes[]=" + attrs.join("&attributes[]=");
            var logUrl = aggregator_url + '?idp=' + idp + '&sp=' + spEntityID + '&timestamp=' + ts + '&' + attributes_encoded + '&source=js_aaggr'; 
            jQuery.get(logUrl)
		.done(function(){
			console.log("Succcessfully sent " + logUrl);
		    })
		.always(function(){
			document.location.href = '/Shibboleth.sso/AttrChecker' + document.location.search;
		    });
       }

});

 

Search the Language Bank Portal:
Tommi Kurki
Researcher of the Month: Tommi Kurki

 

Contact

The Language Bank's technical support:
kielipankki (at) csc.fi
tel. +358 9 4572001

Requests related to language resources:
fin-clarin (at) helsinki.fi
tel. +358 29 4140599 / +358 29 4129317