<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.ext-9.eprints-hosting.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ejo1f20</id>
	<title>EPrints Documentation - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ext-9.eprints-hosting.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ejo1f20"/>
	<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/Special:Contributions/Ejo1f20"/>
	<updated>2026-05-10T08:11:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16714</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16714"/>
		<updated>2025-01-21T15:17:36Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: /* Configuring Shibboleth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual}}&lt;br /&gt;
&#039;&#039;&#039;This page details how to install and integrate Shibboleth with EPrints 3.3.x or 3.4.x on a CentOS 7 operating system.&#039;&#039;&#039;  The process should be fairly similar for other comparable Red Hat based Linux distributions such as RHEL 7 and Fedora 21/22.  These instructions should also be generally applicable to later versions of RHEL-based Linux (e.g. Rocky Linux 8, Red Hat Enterprise Linux 9, etc.). However, they may be somewhat different for Debian-based Linux, such as Ubuntu and Debian itself and other Linux distributions.  Typically, this will just be different package names and different commands to manage applications.&lt;br /&gt;
&lt;br /&gt;
Generally, it is a good idea to run EPrints with &#039;&#039;&#039;HTTPS&#039;&#039;&#039; when using Shibboleth authentication for increased security on the attributes being sent back by the Shibboleth Identity Provider (IdP).  Therefore, it is assumed that EPrints has already been set up to use HTTPS and there already exists an &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039; under the archive directory structure.&lt;br /&gt;
&lt;br /&gt;
== Installing Shibboleth ==&lt;br /&gt;
* First, add the Shibboleth repository to your list of YUM repositories (if you need this for a different RHEL-based Linux distribution fill in the form at https://shibboleth.net/downloads/service-provider/latest/RPMS/):&lt;br /&gt;
  root&amp;gt; wget -O /etc/yum.repos.d/shibboleth.repo https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7&lt;br /&gt;
&lt;br /&gt;
* Now you can use Yum to install all package dependencies:&lt;br /&gt;
  root&amp;gt; yum install log4shib opensaml shibboleth unixODBC xerces-c xml-security-c xmltooling &lt;br /&gt;
&lt;br /&gt;
* You may be prompted to accept the importing of the key for the Shibboleth repository, for which you should type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter.&lt;br /&gt;
&lt;br /&gt;
* Once you have done that, test that &#039;&#039;&#039;shibd&#039;&#039;&#039; has no issues:&lt;br /&gt;
  root&amp;gt; LD_LIBRARY_PATH=/opt/shibboleth/lib64 shibd -t&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;shibd -t&#039;&#039; should return a couple of warning, like those listed below.  These are due to it not yet being configured.&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : insecure cookieProps setting, set to &amp;quot;https&amp;quot; for SSL/TLS-only usage&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : handlerSSL should be enabled for SSL/TLS-enabled web sites&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : no MetadataProvider available, configure at least one for standard SSO usage&lt;br /&gt;
  overall configuration is loadable, check console for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
* If there are no other warning or error messages from &#039;&#039;shibd -t&#039;&#039;, you can start it properly and check to make sure it is running. You may also want ensure Shibboleth starts at boot using &#039;&#039;&#039;systemctl  enable&#039;&#039;&#039;&lt;br /&gt;
  root&amp;gt; systemctl start shibd.service&lt;br /&gt;
  root&amp;gt; ps aux | grep shib&lt;br /&gt;
  shibd    29338  0.4  0.7 419784 15024 ?        Ssl  11:16   0:00 /usr/sbin/shibd -p /var/run/shibboleth/shibd.pid -f -w 30&lt;br /&gt;
  root     29345  0.0  0.0 112640   940 pts/2    S+   11:17   0:00 grep --color=auto -i shib&lt;br /&gt;
  root&amp;gt; systemctl enable shibd.service&lt;br /&gt;
&lt;br /&gt;
== Configuring Shibboleth ==&lt;br /&gt;
* Replace &#039;&#039;&#039;/etc/shibboleth/shibboleth2.xml&#039;&#039;&#039; with the following.  Substitute &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; for the hostname of your EPrints repository, &#039;&#039;&#039;https://shib.foo.example.org/idp/shibboleth&#039;&#039;&#039; with the entity ID for you Shibboleth IdP and &#039;&#039;&#039;foo&#039;&#039;&#039; in the pathname of files with the name or your repository (e.g. &#039;&#039;foo/attribute-map.xml&#039;&#039; becomes &#039;&#039;myrepo/attribute-map.xml&#039;&#039;).  &#039;&#039;&#039;(This configuration is intended for Shibboleth SP version 2.x and is liable to cause deprecation warnings if  you have installed a recent version of Shibboleth from a package repository.  [[Shibboleth/3.x|Here is a default shibboleth2.xml configuration for Shibboleth 3.x]]).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;SPConfig xmlns=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    xmlns:conf=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    clockSkew=&amp;quot;180&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&lt;br /&gt;
                         REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
                         cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Sessions lifetime=&amp;quot;28800&amp;quot; timeout=&amp;quot;3600&amp;quot; relayState=&amp;quot;ss:mem&amp;quot; &lt;br /&gt;
                checkAddress=&amp;quot;false&amp;quot; handlerSSL=&amp;quot;true&amp;quot; cookieProps=&amp;quot;https&amp;quot;&lt;br /&gt;
                redirectLimit=&amp;quot;exact&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;SSO entityID=&amp;quot;https://shib.foo.example.org/idp/shibboleth&amp;quot;&amp;gt;SAML2&amp;lt;/SSO&amp;gt;&lt;br /&gt;
        &amp;lt;Logout&amp;gt;SAML2 Local&amp;lt;/Logout&amp;gt;&lt;br /&gt;
        &amp;lt;LogoutInitiator type=&amp;quot;Admin&amp;quot; Location=&amp;quot;/Logout/Admin&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Status&amp;quot; Location=&amp;quot;/Status&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Session&amp;quot; Location=&amp;quot;/Session&amp;quot; showAttributeValues=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;DiscoveryFeed&amp;quot; Location=&amp;quot;/DiscoFeed&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Sessions&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Errors supportContact=&amp;quot;root@localhost&amp;quot; helpLocation=&amp;quot;/about.html&amp;quot; styleSheet=&amp;quot;/shibboleth/main.css&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; path=&amp;quot;foo/idp-metadata.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeExtractor type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;foo/attribute-map.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeFilter type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;attribute-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;/ApplicationDefaults&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;SecurityPolicyProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;security-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ProtocolProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;protocols.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/SPConfig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create the directory &#039;&#039;&#039;/etc/shibboleth/foo&#039;&#039;&#039;, substituting &#039;&#039;foo&#039;&#039; for your repository name.&lt;br /&gt;
  root&amp;gt; mkdir /etc/shibboleth/foo&lt;br /&gt;
&lt;br /&gt;
* Copy &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; into this new directory.&lt;br /&gt;
  cp /etc/shibboleth/attribute-map.xml /etc/shibboleth/foo/&lt;br /&gt;
&lt;br /&gt;
* Temporarily rename &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; to &#039;&#039;&#039;sp-cert.pem.old&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem.old&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-cert.pem.old&lt;br /&gt;
  root&amp;gt; mv sp-key.pem sp-key.pem.old&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;keygen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./keygen.sh -f -h foo.eprints.org -e https://foo.eprints.org/shibboleth&lt;br /&gt;
&lt;br /&gt;
* Move the new &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; to &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and move the &#039;&#039;.old&#039;&#039; files back in place:&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-key.pem foo/&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem.old sp-cert.pem&lt;br /&gt;
  root&amp;gt; mv sp-key.pem.old sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Check that &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; still have the owner and group &#039;&#039;&#039;shibd&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; ls -l /etc/shibboleth/foo/sp-*&lt;br /&gt;
  -rw-r--r-- 1 shibd shibd 1192 May  6 19:04 /etc/shibboleth/foo/sp-cert.pem&lt;br /&gt;
  -rw------- 1 shibd shibd 1708 May  6 19:04 /etc/shibboleth/foo/sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;metagen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.  You will ultimately need to send the output of this to the person managing the Shibboleth IdP server with which you want to register your EPrints repository as a service.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./metagen.sh -ALO -c foo/sp-cert.pem -h foo.eprints.org -e https://foo.eprints.org/shibboleth &amp;gt; foo/sp_metadata.xml&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039; foo/sp_metadata.xml&#039;&#039;&#039; to add in the namepace definitions by separately changing the &amp;lt;code&amp;gt;md:EntityDescriptor&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ds:KeyInfo&amp;lt;/code&amp;gt; lines as follows from:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor xmlns:md=&amp;quot;urn:oasis:names:tc:SAML:2.0:metadata&amp;quot; entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&amp;gt; &lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo xmlns:ds=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;wget&#039;&#039; to download the metadata from your Shibboleth IdP (e.g. shib.foo.example.org) to the &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; directory.&lt;br /&gt;
  root&amp;gt; wget -O /etc/shibboleth/foo/idp-metadata.xml https://shib.foo.example.org/idp/shibboleth&lt;br /&gt;
&lt;br /&gt;
=== Using Remote IdP Metatdata ===&lt;br /&gt;
&lt;br /&gt;
As IdP Metadata may expire, you may want to use the remote metadata URL rather than a local copy.  This is what you need to do to switch to using remote IdP metadata:&lt;br /&gt;
&lt;br /&gt;
* Edit the &#039;&#039;&#039;MetadataProvider&#039;&#039;&#039; line to something like the following.  The reloadInterval is best set to 7200 but this can be set less frequently:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://shib.foo.example.org/idp/metadata.xml&amp;quot; backingFilePath=&amp;quot;foo/idp-metadata.xml&amp;quot; reloadInterval=&amp;quot;7200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure the reloadInterval is appropriate for the IdP metadata you are downloading.  If you have large metadata file,(e.g. from a federated metadata service containing metadata for other IdPs), then it may be better to set this higher than the default.  However, the configuration checker may warn you that your reload interval is too long, so you may have to choose to ignore this, if you want to avoid downloading a large federated metadata file too often.&lt;br /&gt;
&lt;br /&gt;
* Make sure that the directory &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and &#039;&#039;&#039;/etc/shibboleth/foo/idp-metadata.xml&#039;&#039;&#039; if it already exists) are owned by &#039;&#039;&#039;shibd&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/idp-metadata.xml&lt;br /&gt;
&lt;br /&gt;
* To test Shibboleth you will need to make sure your &#039;&#039;&#039;LD_LIBRARY_PATH&#039;&#039;&#039; is set the same as shibd would have when started using &#039;&#039;systemctl shibd start&#039;&#039;.  This should return the message: &#039;&#039;overall configuration is loadable, check console for non-fatal problems&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
 LD_LIBRARY_PATH=/opt/shibboleth/lib64:$LD_LIBRARY_PATH shibd -t&lt;br /&gt;
&lt;br /&gt;
* The above message is because it is now advised not to leave the MetadataGenerator enabled unnecessarily.  However, whilst you are setting up Shibboleth, it is useful to have the metadata generator, save you needing to build your own Service Provider metadata file to register with your Identity Provider.  Later on you can comment out the MetadataGenerator line to stop getting this warning message.&lt;br /&gt;
&lt;br /&gt;
* Now you can restart &#039;&#039;&#039;shibd&#039;&#039;&#039; properly:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart shibd&lt;br /&gt;
&lt;br /&gt;
== Configuring Apache and EPrints ==&lt;br /&gt;
&#039;&#039;&#039;N.B. All these actions should be carried out by the &#039;&#039;eprints&#039;&#039; user, except when prepended with &#039;&#039;root&amp;gt;&#039;&#039; which means the command should be run as the &#039;&#039;root&#039;&#039; user.&#039;&#039;&#039;&lt;br /&gt;
* Add the following configuration to your archive&#039;s &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039;, after the &#039;&#039;&#039;Include /opt/eprints3/cfg/apache_ssl/foo.conf&#039;&#039;&#039;, substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name where appropriate.  (This assumes you are running Apache 2.4 or greater).  See [[#Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration |Troubleshooting]] for instructions on the configuration to use for Apache 2.2. or lower.&lt;br /&gt;
&lt;br /&gt;
 Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
 &amp;lt;Location &amp;quot;/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   SetHandler perl-script&lt;br /&gt;
   PerlHandler ModPerl::Registry&lt;br /&gt;
   PerlSendHeader Off&lt;br /&gt;
   Options ExecCGI FollowSymLinks&lt;br /&gt;
 &lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy the following code into your archive (e.g. /opt/eprints3/archives/foo/) as &#039;&#039;&#039;cgi/shibboleth&#039;&#039;&#039;.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 my $session = new EPrints::Session;&lt;br /&gt;
 exit( 0 ) unless( defined $session );&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content_type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;html&amp;amp;gt;&amp;amp;lt;head/&amp;amp;gt;&amp;amp;lt;body&amp;amp;gt;&amp;amp;lt;code&amp;amp;gt;\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 foreach my $key (sort keys(%ENV)) {&lt;br /&gt;
   print &amp;quot;&amp;amp;lt;p&amp;amp;gt;$key = $ENV{$key}&amp;amp;lt;/p&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;/code&amp;amp;gt;&amp;amp;lt;/body&amp;amp;gt;&amp;amp;lt;/html&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 exit;&lt;br /&gt;
&lt;br /&gt;
* Now restart Shibboleth and Apache:&lt;br /&gt;
  root&amp;gt; systemctl restart shibd.service&lt;br /&gt;
  root&amp;gt; apachectl restart&lt;br /&gt;
&lt;br /&gt;
* In a web browser go the &#039;&#039;&#039;/cgi/shibboleth&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/cgi/shibboleth&#039;&#039;).  You should be redirected to an error page for your your Shibboleth IdP (e.g. &#039;&#039;https://shib.foo.example.org/idp/profile/SAML2/Redirect/SSO?...&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
* If instead you are displayed with a list of key values or are forbidden to access the page, you have not configured Apache properly, if so, see [[#Apache_Configuration_Issues|Apache_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].  If you see an error message like the one below, you have not set up Shibboleth properly, if so, see [[#Shibboleth_Configuration_Issues|Shibboleth_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
 opensaml::saml2md::MetadataException&lt;br /&gt;
 The system encountered an error at Wed May 6 15:19:27 2015&lt;br /&gt;
 To report this problem, please contact the site administrator at root@localhost.&lt;br /&gt;
 Please include the following message in any email:&lt;br /&gt;
 opensaml::saml2md::MetadataException at (http://foo.eprints.org/cgi/shibboleth)&lt;br /&gt;
 Unable to locate metadata for identity provider (https://shib.foo.example.org/idp/shibboleth)&lt;br /&gt;
&lt;br /&gt;
* Next, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;cfg/cfg.d/zz_shibboleth.pl&#039;&#039;&#039;.  This is needed to redirect login and logout to use Shibboleth rather than local login.&lt;br /&gt;
 $c-&amp;gt;{get_login_url} = sub {&lt;br /&gt;
   my( $session, $target ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   # preserve CGI params&lt;br /&gt;
   $session-&amp;gt;read_params;&lt;br /&gt;
   $target = $session-&amp;gt;get_url(&lt;br /&gt;
     host =&amp;gt; 1,&lt;br /&gt;
     path =&amp;gt; &amp;quot;auto&amp;quot;,&lt;br /&gt;
     query =&amp;gt; 1,&lt;br /&gt;
   );&lt;br /&gt;
 &lt;br /&gt;
   my $url = URI-&amp;gt;new( $session-&amp;gt;config( &amp;quot;https_url&amp;quot; )  . &amp;quot;/shibboleth/login&amp;quot; );&lt;br /&gt;
   $url-&amp;gt;query_form( target =&amp;gt; &amp;quot;$target&amp;quot; );&lt;br /&gt;
   return &amp;quot;$url&amp;quot;;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 $c-&amp;gt;{on_logout} = sub {&lt;br /&gt;
   my( $session ) = @_;&lt;br /&gt;
   my $query = $session-&amp;gt;query;&lt;br /&gt;
   return unless defined $query;&lt;br /&gt;
 &lt;br /&gt;
   # remove _shibsession_ cookie&lt;br /&gt;
   my( $shibname, $shibvalue );&lt;br /&gt;
   for( $query-&amp;gt;cookie() ) {&lt;br /&gt;
     if( $_ =~ /^_shibsession/ ) {&lt;br /&gt;
       $shibname = $_;&lt;br /&gt;
       $shibvalue = $query-&amp;gt;cookie( $shibname );&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   my $cookie = $query-&amp;gt;cookie(&lt;br /&gt;
     -name    =&amp;gt; $shibname,&lt;br /&gt;
     -path    =&amp;gt; &amp;quot;/&amp;quot;,&lt;br /&gt;
     -value   =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     -host  =&amp;gt; $session-&amp;gt;config(&amp;quot;cookie_domain&amp;quot;),&lt;br /&gt;
     -expires =&amp;gt; &amp;quot;-1d&amp;quot;,&lt;br /&gt;
   );&lt;br /&gt;
   EPrints::Apache::AnApache::header_out(&lt;br /&gt;
     $session-&amp;gt;{request},&lt;br /&gt;
     &amp;quot;Set-Cookie&amp;quot; =&amp;gt; $cookie &lt;br /&gt;
   );&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 push @{$c-&amp;gt;{rewrite_exceptions}}, &amp;quot;/shibboleth/&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
* Create a folder at the top level of your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) called &#039;&#039;&#039;shibboleth&#039;&#039;&#039; and copy the main CSS file for Shibboleth into this folder:&lt;br /&gt;
 eprints&amp;gt; mkdir /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
 eprints&amp;gt; cp /usr/share/shibboleth/main.css /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
&lt;br /&gt;
* Now, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;shibboleth/login&#039;&#039;&#039;.  This is the most basic login script that should work with the minimal attributes any Shibboleth IdP returns and &#039;&#039;&#039;only logging in users with existing accounts&#039;&#039;&#039;. Look under the [[#Customisation|Customisation]] section for advice on how to modify this script to meet your requirements, such as creation user accounts on-the-fly.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
   &lt;br /&gt;
 sub get_user &lt;br /&gt;
 {&lt;br /&gt;
   my ( $username, $email ) = ( undef, &amp;quot;&amp;quot; );&lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
    ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
    $username = lc( $username );&lt;br /&gt;
    $email = $ENV{eppn};&lt;br /&gt;
   }&lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username );&lt;br /&gt;
   if( defined $user &amp;amp;&amp;amp; defined $email )&lt;br /&gt;
   {&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
     $user-&amp;gt;commit;&lt;br /&gt;
   }&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Next, add the following markup to &#039;&#039;&#039;cfg/lang/en/static/account_required.xpage&#039;&#039;&#039; under your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;).  Substituting &#039;&#039;staff and students of the University of Foo&#039;&#039; to describe to which particular group of people logged in access is restricted.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&amp;quot;no&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE page SYSTEM &amp;quot;entities.dtd&amp;quot; &amp;gt;&lt;br /&gt;
 &amp;lt;xpage:page xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:xpage=&amp;quot;http://eprints.org/ep3/xpage&amp;quot; xmlns:epc=&amp;quot;http://eprints.org/ep3/control&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:title&amp;gt;Login Failed&amp;lt;/xpage:title&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:body&amp;gt;&lt;br /&gt;
    &amp;amp;lt;p style=&#039;text-align: center;&#039;&amp;amp;gt;Please note that only staff and students of the University of Foo may log in to &amp;lt;epc:phrase ref=&amp;quot;archive_name&amp;quot; /&amp;gt;&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:body&amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, reload Apache.&lt;br /&gt;
  root&amp;gt; apachectl reload&lt;br /&gt;
&lt;br /&gt;
* In a web browser go to the &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;).  Like before with &#039;&#039;/cgi/shibboleth&#039;&#039; you should be taken to your Shibboleth IdP&#039;s site albeit displaying an error message.&lt;br /&gt;
&lt;br /&gt;
* The Shibboleth IdP shows an error message because EPrints as a Shibboleth Service Provider is not yet registered with it.  To do this you need to send the administrator of the Shibboleth IdP the metadata for your Service Provider.  You will have generated this earlier when you ran &amp;lt;code&amp;gt;metagen.sh&amp;lt;/code&amp;gt;.  Copy off your EPrints server the file that this wrote (e.g. to &amp;lt;tt&amp;gt;/etc/shibboleth/foo/sp_metadata.xml&amp;lt;/tt&amp;gt;) and send it to the Shibboleth IdP administrator.  They should be able to upload this to register EPrints as a Service Provider application.&lt;br /&gt;
&lt;br /&gt;
* Once registered, use a web browser to go to &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;) again.  This time you should be prompted for a username and password on the Shibboleth IdP site. Once you have typed this in and clicked to login, you should be returned to EPrints on the &#039;&#039;&#039;/cgi/users/home&#039;&#039;&#039; page for your repository.  If not, see [[#Login_Issues|Login Issues]] under [[#Troubleshooting|Troubleshooting]] below.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Apache Configuration Issues ===&lt;br /&gt;
==== Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration ====&lt;br /&gt;
* Similarly to the instructions for Apache 2.4 and above, place the slightly different following configuration after the &#039;&#039;&#039;Include&#039;&#039;&#039; line for &#039;&#039;apache_ssl/foo.conf&#039;&#039;, (substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name):&lt;br /&gt;
&lt;br /&gt;
  Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/opt/eprints3/archives/foo/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
    SetHandler perl-script&lt;br /&gt;
    PerlHandler ModPerl::Registry&lt;br /&gt;
    PerlSendHeader Off&lt;br /&gt;
    Options ExecCGI FollowSymLinks&lt;br /&gt;
  &lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth Configuration Issues ===&lt;br /&gt;
==== With attribute-map.xml ====&lt;br /&gt;
When authenticating using Shibboleth to login to EPrints you may see the following line in &#039;&#039;&#039;/var/log/shibboleth.shibd.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  urn:mace:dir:attribute-def:department&lt;br /&gt;
&lt;br /&gt;
In some cases this might not be an issue, as EPrints does not necessarily to make use of all the attributes returned by the IdP but without a mapping in attribute-map.xml.  In this case &#039;&#039;&#039;urn:mace:dir:attribute-def:department&#039;&#039;&#039; is not by default needed by EPrints to create/update a user account.  However, values like &#039;&#039;&#039;sn&#039;&#039;&#039;, &#039;&#039;&#039;givenName&#039;&#039;&#039; and &#039;&#039;&#039;mail&#039;&#039;&#039; are but if you have used the attribute-map.xml provided later on the page you should not see a line like above in &#039;&#039;&#039;shibd.log&#039;&#039;&#039;.  In some cases you may still see an line like this in the log even if you think you have defined the attribute.  The line below demonstrate two known issues:&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  givenName, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:basic&lt;br /&gt;
&lt;br /&gt;
# The attribute itself has no namespace it is just &#039;&#039;&#039;&#039;givenName&#039;&#039;&#039; rather than &#039;&#039;&#039;urn:mace:dir:attribute-def:givenName&#039;&#039;&#039;&lt;br /&gt;
# The attribute has a format that most also be defined in the attribute-map.xml attribute.&lt;br /&gt;
&lt;br /&gt;
Below shows how to both include the format, which is required for the attribute to be successful mapped.  As well as define the name of the attribute without a namespace:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attribute name=&amp;quot;givenName&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical Shibboleth IdP would have both a namespaced attribute name and would not apply a format to an attribute that is a simple text string.  Therefore it is worth enquiring with the IdP provider if either of these two happen to be the case.&lt;br /&gt;
&lt;br /&gt;
==== With idp-metadata.xml ====&lt;br /&gt;
If you want to be able extract scoped attributes (e.g. &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; otherwise described as &#039;&#039;&#039;eppn&#039;&#039;&#039;).  Then you will need to ensure that the expected scope of this attribute, (effectively the domain part in eduPersonPrincipalName is the scope or one of the scopes in the idp-metadata.xml you downloaded from the Shibboleth IdP.  For example if the &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; is &#039;&#039;&#039;bar@foo.ac.uk&#039;&#039;&#039;.  Then the following should be defined in idp-metadata.xml (&#039;&#039;&#039;N.B. the namespace abbreviations (md: and shibmd:) may be different for the IdP you are working with&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;md:Extensions&amp;gt;&lt;br /&gt;
    &amp;lt;shibmd:Scope regexp=&amp;quot;false&amp;quot;&amp;gt;foo.ac.uk&amp;lt;/shibmd:Scope&amp;gt;&lt;br /&gt;
  &amp;lt;/md:Extensions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Login Issues ===&lt;br /&gt;
To be added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth /etc/shibboleth/foo/attribute-map.xml config ===&lt;br /&gt;
This is adapted from the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; provided when the Shibboleth SP package is installed to only include the attribute subsequently used by EPrints Shibboleth Perl script that can be found below.  Namely:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Field name&lt;br /&gt;
!Field description			&lt;br /&gt;
!SAML v1.1 attribute URN&lt;br /&gt;
!SAMLv2 attribute URN&lt;br /&gt;
|-&lt;br /&gt;
|eppn			&lt;br /&gt;
|Edu Person Principal Name&lt;br /&gt;
|urn:mace:dir:attribute-def:eduPersonPrincipalName&lt;br /&gt;
|urn:oid:1.3.6.1.4.1.5923.1.1.1.6&lt;br /&gt;
|-&lt;br /&gt;
|sn&lt;br /&gt;
|Surname						&lt;br /&gt;
|urn:mace:dir:attribute-def:sn								&lt;br /&gt;
|urn:oid:2.5.4.4&lt;br /&gt;
|-&lt;br /&gt;
|givenName&lt;br /&gt;
|Given (first) name(s)&lt;br /&gt;
|urn:mace:dir:attribute-def:givenName&lt;br /&gt;
|urn:oid:2.5.4.42&lt;br /&gt;
|-&lt;br /&gt;
|mail&lt;br /&gt;
|Email address	&lt;br /&gt;
|urn:mace:dir:attribute-def:mail&lt;br /&gt;
|urn:oid:0.9.2342.19200300.100.1.3  &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may wish to refer to the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; is you want to use other attributes.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attributes xmlns=&amp;quot;urn:mace:shibboleth:2.0:attribute-map&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:eduPersonPrincipalName&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:1.3.6.1.4.1.5923.1.1.1.6&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:sn&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:givenName&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:mail&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.4&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.42&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:0.9.2342.19200300.100.1.3&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/Attributes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EPrints /shibboleth/login script with user account creation ===&lt;br /&gt;
This is the standard EPrints Shibboleth login script.  It makes a number of assumptions:&lt;br /&gt;
# That accounts should be created if they do not already exist for a particular user.&lt;br /&gt;
# That you wish to create a standard user account (not an editor administrator) account.&lt;br /&gt;
# That the Shibboleth IdP provides all the attributes (eduPersonPrinicpalName (seen as eppn), sn, givenName and mail) required.&lt;br /&gt;
&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 &lt;br /&gt;
 sub get_user&lt;br /&gt;
 {&lt;br /&gt;
   my ($username, $given, $family, $email) = (undef, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
     ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
     $username = lc( $username );&lt;br /&gt;
   }&lt;br /&gt;
   $email = $ENV{mail} if $ENV{mail};&lt;br /&gt;
   if( $ENV{givenName} )&lt;br /&gt;
   {&lt;br /&gt;
     $given = lc( $ENV{givenName} );&lt;br /&gt;
     $given =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $given =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
   if( $ENV{sn} )&lt;br /&gt;
   {&lt;br /&gt;
     $family = lc( $ENV{sn} );&lt;br /&gt;
     $family =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $family =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
 &lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username ); # relying on this to be case insensitive&lt;br /&gt;
 &lt;br /&gt;
   if( !defined $user )&lt;br /&gt;
   {&lt;br /&gt;
     my $usertype = &#039;user&#039;;&lt;br /&gt;
     $user = EPrints::DataObj::User::create( $session, $usertype );&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;username&amp;quot;, $username );&lt;br /&gt;
   }&lt;br /&gt;
   my $name = {&lt;br /&gt;
     given =&amp;gt; $given,&lt;br /&gt;
     family =&amp;gt; $family,&lt;br /&gt;
   };&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;name&amp;quot;, $name );&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Further Information ==&lt;br /&gt;
* Older instructions of how to set up EPrints for Shibboleth using UK Access management Federation discovery service is available [[Shibboleth authentication|here]].&lt;br /&gt;
&lt;br /&gt;
* For general information about installing and configuring Shibboleth [http://shibboleth.internet2.edu/ click here].&lt;br /&gt;
&lt;br /&gt;
* [https://docs.openathens.net/display/public/TPA/Sign+in+to+a+generic+application+using+OpenAthens#SignintoagenericapplicationusingOpenAthens-SetupthecustomSAMLresourceinOpenAthens Instructions of connection a Shibboleth Service Provider with OpenAthens]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16713</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16713"/>
		<updated>2025-01-21T14:47:45Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: /* Configuring Shibboleth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual}}&lt;br /&gt;
&#039;&#039;&#039;This page details how to install and integrate Shibboleth with EPrints 3.3.x or 3.4.x on a CentOS 7 operating system.&#039;&#039;&#039;  The process should be fairly similar for other comparable Red Hat based Linux distributions such as RHEL 7 and Fedora 21/22.  These instructions should also be generally applicable to later versions of RHEL-based Linux (e.g. Rocky Linux 8, Red Hat Enterprise Linux 9, etc.). However, they may be somewhat different for Debian-based Linux, such as Ubuntu and Debian itself and other Linux distributions.  Typically, this will just be different package names and different commands to manage applications.&lt;br /&gt;
&lt;br /&gt;
Generally, it is a good idea to run EPrints with &#039;&#039;&#039;HTTPS&#039;&#039;&#039; when using Shibboleth authentication for increased security on the attributes being sent back by the Shibboleth Identity Provider (IdP).  Therefore, it is assumed that EPrints has already been set up to use HTTPS and there already exists an &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039; under the archive directory structure.&lt;br /&gt;
&lt;br /&gt;
== Installing Shibboleth ==&lt;br /&gt;
* First, add the Shibboleth repository to your list of YUM repositories (if you need this for a different RHEL-based Linux distribution fill in the form at https://shibboleth.net/downloads/service-provider/latest/RPMS/):&lt;br /&gt;
  root&amp;gt; wget -O /etc/yum.repos.d/shibboleth.repo https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7&lt;br /&gt;
&lt;br /&gt;
* Now you can use Yum to install all package dependencies:&lt;br /&gt;
  root&amp;gt; yum install log4shib opensaml shibboleth unixODBC xerces-c xml-security-c xmltooling &lt;br /&gt;
&lt;br /&gt;
* You may be prompted to accept the importing of the key for the Shibboleth repository, for which you should type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter.&lt;br /&gt;
&lt;br /&gt;
* Once you have done that, test that &#039;&#039;&#039;shibd&#039;&#039;&#039; has no issues:&lt;br /&gt;
  root&amp;gt; LD_LIBRARY_PATH=/opt/shibboleth/lib64 shibd -t&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;shibd -t&#039;&#039; should return a couple of warning, like those listed below.  These are due to it not yet being configured.&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : insecure cookieProps setting, set to &amp;quot;https&amp;quot; for SSL/TLS-only usage&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : handlerSSL should be enabled for SSL/TLS-enabled web sites&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : no MetadataProvider available, configure at least one for standard SSO usage&lt;br /&gt;
  overall configuration is loadable, check console for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
* If there are no other warning or error messages from &#039;&#039;shibd -t&#039;&#039;, you can start it properly and check to make sure it is running. You may also want ensure Shibboleth starts at boot using &#039;&#039;&#039;systemctl  enable&#039;&#039;&#039;&lt;br /&gt;
  root&amp;gt; systemctl start shibd.service&lt;br /&gt;
  root&amp;gt; ps aux | grep shib&lt;br /&gt;
  shibd    29338  0.4  0.7 419784 15024 ?        Ssl  11:16   0:00 /usr/sbin/shibd -p /var/run/shibboleth/shibd.pid -f -w 30&lt;br /&gt;
  root     29345  0.0  0.0 112640   940 pts/2    S+   11:17   0:00 grep --color=auto -i shib&lt;br /&gt;
  root&amp;gt; systemctl enable shibd.service&lt;br /&gt;
&lt;br /&gt;
== Configuring Shibboleth ==&lt;br /&gt;
* Replace &#039;&#039;&#039;/etc/shibboleth/shibboleth2.xml&#039;&#039;&#039; with the following.  Substitute &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; for the hostname of your EPrints repository, &#039;&#039;&#039;https://shib.foo.example.org/idp/shibboleth&#039;&#039;&#039; with the entity ID for you Shibboleth IdP and &#039;&#039;&#039;foo&#039;&#039;&#039; in the pathname of files with the name or your repository (e.g. &#039;&#039;foo/attribute-map.xml&#039;&#039; becomes &#039;&#039;myrepo/attribute-map.xml&#039;&#039;).  &#039;&#039;&#039;(This configuration is intended for Shibboleth SP version 2.x and is liable to cause deprecation warnings if  you have installed a recent version of Shibboleth from a package repository.  [[Shibboleth/3.x|Here is a default shibboleth2.xml configuration for Shibboleth 3.x]]).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;SPConfig xmlns=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    xmlns:conf=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    clockSkew=&amp;quot;180&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&lt;br /&gt;
                         REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
                         cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Sessions lifetime=&amp;quot;28800&amp;quot; timeout=&amp;quot;3600&amp;quot; relayState=&amp;quot;ss:mem&amp;quot; &lt;br /&gt;
                checkAddress=&amp;quot;false&amp;quot; handlerSSL=&amp;quot;true&amp;quot; cookieProps=&amp;quot;https&amp;quot;&lt;br /&gt;
                redirectLimit=&amp;quot;exact&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;SSO entityID=&amp;quot;https://shib.foo.example.org/idp/shibboleth&amp;quot;&amp;gt;SAML2&amp;lt;/SSO&amp;gt;&lt;br /&gt;
        &amp;lt;Logout&amp;gt;SAML2 Local&amp;lt;/Logout&amp;gt;&lt;br /&gt;
        &amp;lt;LogoutInitiator type=&amp;quot;Admin&amp;quot; Location=&amp;quot;/Logout/Admin&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Status&amp;quot; Location=&amp;quot;/Status&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Session&amp;quot; Location=&amp;quot;/Session&amp;quot; showAttributeValues=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;DiscoveryFeed&amp;quot; Location=&amp;quot;/DiscoFeed&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Sessions&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Errors supportContact=&amp;quot;root@localhost&amp;quot; helpLocation=&amp;quot;/about.html&amp;quot; styleSheet=&amp;quot;/shibboleth/main.css&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; path=&amp;quot;foo/idp-metadata.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeExtractor type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;foo/attribute-map.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeFilter type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;attribute-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;/ApplicationDefaults&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;SecurityPolicyProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;security-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ProtocolProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;protocols.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/SPConfig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create the directory &#039;&#039;&#039;/etc/shibboleth/foo&#039;&#039;&#039;, substituting &#039;&#039;foo&#039;&#039; for your repository name.&lt;br /&gt;
  root&amp;gt; mkdir /etc/shibboleth/foo&lt;br /&gt;
&lt;br /&gt;
* Copy &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; into this new directory.&lt;br /&gt;
  cp /etc/shibboleth/attribute-map.xml /etc/shibboleth/foo/&lt;br /&gt;
&lt;br /&gt;
* Temporarily rename &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; to &#039;&#039;&#039;sp-cert.pem.old&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem.old&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-cert.pem.old&lt;br /&gt;
  root&amp;gt; mv sp-key.pem sp-key.pem.old&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;keygen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./keygen.sh -f -h foo.eprints.org -e https://foo.eprints.org/shibboleth&lt;br /&gt;
&lt;br /&gt;
* Move the new &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; to &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and move the &#039;&#039;.old&#039;&#039; files back in place:&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-key.pem foo/&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem.old sp-cert.pem&lt;br /&gt;
  root&amp;gt; mv sp-key.pem.old sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Check that &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; still have the owner and group &#039;&#039;&#039;shibd&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; ls -l /etc/shibboleth/foo/sp-*&lt;br /&gt;
  -rw-r--r-- 1 shibd shibd 1192 May  6 19:04 /etc/shibboleth/foo/sp-cert.pem&lt;br /&gt;
  -rw------- 1 shibd shibd 1708 May  6 19:04 /etc/shibboleth/foo/sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;metagen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.  You will ultimately need to send the output of this to the person managing the Shibboleth IdP server with which you want to register your EPrints repository as a service.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./metagen.sh -ALO -c foo/sp-cert.pem -h foo.eprints.org -e https://foo.eprints.org/shibboleth &amp;gt; foo/sp_metadata.xml&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039; foo/sp_metadata.xml&#039;&#039;&#039; to add in the namepace definitions by separately changing the &amp;lt;code&amp;gt;md:EntityDescriptor&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ds:KeyInfo&amp;lt;/code&amp;gt; lines as follows from:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor xmlns:md=&amp;quot;urn:oasis:names:tc:SAML:2.0:metadata&amp;quot; entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt; &lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo xmlns:ds=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;wget&#039;&#039; to download the metadata from your Shibboleth IdP (e.g. shib.foo.example.org) to the &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; directory.&lt;br /&gt;
  root&amp;gt; wget -O /etc/shibboleth/foo/idp-metadata.xml https://shib.foo.example.org/idp/shibboleth&lt;br /&gt;
&lt;br /&gt;
=== Using Remote IdP Metatdata ===&lt;br /&gt;
&lt;br /&gt;
As IdP Metadata may expire, you may want to use the remote metadata URL rather than a local copy.  This is what you need to do to switch to using remote IdP metadata:&lt;br /&gt;
&lt;br /&gt;
* Edit the &#039;&#039;&#039;MetadataProvider&#039;&#039;&#039; line to something like the following.  The reloadInterval is best set to 7200 but this can be set less frequently:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://shib.foo.example.org/idp/metadata.xml&amp;quot; backingFilePath=&amp;quot;foo/idp-metadata.xml&amp;quot; reloadInterval=&amp;quot;7200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure the reloadInterval is appropriate for the IdP metadata you are downloading.  If you have large metadata file,(e.g. from a federated metadata service containing metadata for other IdPs), then it may be better to set this higher than the default.  However, the configuration checker may warn you that your reload interval is too long, so you may have to choose to ignore this, if you want to avoid downloading a large federated metadata file too often.&lt;br /&gt;
&lt;br /&gt;
* Make sure that the directory &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and &#039;&#039;&#039;/etc/shibboleth/foo/idp-metadata.xml&#039;&#039;&#039; if it already exists) are owned by &#039;&#039;&#039;shibd&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/idp-metadata.xml&lt;br /&gt;
&lt;br /&gt;
* To test Shibboleth you will need to make sure your &#039;&#039;&#039;LD_LIBRARY_PATH&#039;&#039;&#039; is set the same as shibd would have when started using &#039;&#039;systemctl shibd start&#039;&#039;.  This should return the message: &#039;&#039;overall configuration is loadable, check console for non-fatal problems&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
 LD_LIBRARY_PATH=/opt/shibboleth/lib64:$LD_LIBRARY_PATH shibd -t&lt;br /&gt;
&lt;br /&gt;
* The above message is because it is now advised not to leave the MetadataGenerator enabled unnecessarily.  However, whilst you are setting up Shibboleth, it is useful to have the metadata generator, save you needing to build your own Service Provider metadata file to register with your Identity Provider.  Later on you can comment out the MetadataGenerator line to stop getting this warning message.&lt;br /&gt;
&lt;br /&gt;
* Now you can restart &#039;&#039;&#039;shibd&#039;&#039;&#039; properly:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart shibd&lt;br /&gt;
&lt;br /&gt;
== Configuring Apache and EPrints ==&lt;br /&gt;
&#039;&#039;&#039;N.B. All these actions should be carried out by the &#039;&#039;eprints&#039;&#039; user, except when prepended with &#039;&#039;root&amp;gt;&#039;&#039; which means the command should be run as the &#039;&#039;root&#039;&#039; user.&#039;&#039;&#039;&lt;br /&gt;
* Add the following configuration to your archive&#039;s &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039;, after the &#039;&#039;&#039;Include /opt/eprints3/cfg/apache_ssl/foo.conf&#039;&#039;&#039;, substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name where appropriate.  (This assumes you are running Apache 2.4 or greater).  See [[#Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration |Troubleshooting]] for instructions on the configuration to use for Apache 2.2. or lower.&lt;br /&gt;
&lt;br /&gt;
 Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
 &amp;lt;Location &amp;quot;/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   SetHandler perl-script&lt;br /&gt;
   PerlHandler ModPerl::Registry&lt;br /&gt;
   PerlSendHeader Off&lt;br /&gt;
   Options ExecCGI FollowSymLinks&lt;br /&gt;
 &lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy the following code into your archive (e.g. /opt/eprints3/archives/foo/) as &#039;&#039;&#039;cgi/shibboleth&#039;&#039;&#039;.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 my $session = new EPrints::Session;&lt;br /&gt;
 exit( 0 ) unless( defined $session );&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content_type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;html&amp;amp;gt;&amp;amp;lt;head/&amp;amp;gt;&amp;amp;lt;body&amp;amp;gt;&amp;amp;lt;code&amp;amp;gt;\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 foreach my $key (sort keys(%ENV)) {&lt;br /&gt;
   print &amp;quot;&amp;amp;lt;p&amp;amp;gt;$key = $ENV{$key}&amp;amp;lt;/p&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;/code&amp;amp;gt;&amp;amp;lt;/body&amp;amp;gt;&amp;amp;lt;/html&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 exit;&lt;br /&gt;
&lt;br /&gt;
* Now restart Shibboleth and Apache:&lt;br /&gt;
  root&amp;gt; systemctl restart shibd.service&lt;br /&gt;
  root&amp;gt; apachectl restart&lt;br /&gt;
&lt;br /&gt;
* In a web browser go the &#039;&#039;&#039;/cgi/shibboleth&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/cgi/shibboleth&#039;&#039;).  You should be redirected to an error page for your your Shibboleth IdP (e.g. &#039;&#039;https://shib.foo.example.org/idp/profile/SAML2/Redirect/SSO?...&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
* If instead you are displayed with a list of key values or are forbidden to access the page, you have not configured Apache properly, if so, see [[#Apache_Configuration_Issues|Apache_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].  If you see an error message like the one below, you have not set up Shibboleth properly, if so, see [[#Shibboleth_Configuration_Issues|Shibboleth_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
 opensaml::saml2md::MetadataException&lt;br /&gt;
 The system encountered an error at Wed May 6 15:19:27 2015&lt;br /&gt;
 To report this problem, please contact the site administrator at root@localhost.&lt;br /&gt;
 Please include the following message in any email:&lt;br /&gt;
 opensaml::saml2md::MetadataException at (http://foo.eprints.org/cgi/shibboleth)&lt;br /&gt;
 Unable to locate metadata for identity provider (https://shib.foo.example.org/idp/shibboleth)&lt;br /&gt;
&lt;br /&gt;
* Next, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;cfg/cfg.d/zz_shibboleth.pl&#039;&#039;&#039;.  This is needed to redirect login and logout to use Shibboleth rather than local login.&lt;br /&gt;
 $c-&amp;gt;{get_login_url} = sub {&lt;br /&gt;
   my( $session, $target ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   # preserve CGI params&lt;br /&gt;
   $session-&amp;gt;read_params;&lt;br /&gt;
   $target = $session-&amp;gt;get_url(&lt;br /&gt;
     host =&amp;gt; 1,&lt;br /&gt;
     path =&amp;gt; &amp;quot;auto&amp;quot;,&lt;br /&gt;
     query =&amp;gt; 1,&lt;br /&gt;
   );&lt;br /&gt;
 &lt;br /&gt;
   my $url = URI-&amp;gt;new( $session-&amp;gt;config( &amp;quot;https_url&amp;quot; )  . &amp;quot;/shibboleth/login&amp;quot; );&lt;br /&gt;
   $url-&amp;gt;query_form( target =&amp;gt; &amp;quot;$target&amp;quot; );&lt;br /&gt;
   return &amp;quot;$url&amp;quot;;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 $c-&amp;gt;{on_logout} = sub {&lt;br /&gt;
   my( $session ) = @_;&lt;br /&gt;
   my $query = $session-&amp;gt;query;&lt;br /&gt;
   return unless defined $query;&lt;br /&gt;
 &lt;br /&gt;
   # remove _shibsession_ cookie&lt;br /&gt;
   my( $shibname, $shibvalue );&lt;br /&gt;
   for( $query-&amp;gt;cookie() ) {&lt;br /&gt;
     if( $_ =~ /^_shibsession/ ) {&lt;br /&gt;
       $shibname = $_;&lt;br /&gt;
       $shibvalue = $query-&amp;gt;cookie( $shibname );&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   my $cookie = $query-&amp;gt;cookie(&lt;br /&gt;
     -name    =&amp;gt; $shibname,&lt;br /&gt;
     -path    =&amp;gt; &amp;quot;/&amp;quot;,&lt;br /&gt;
     -value   =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     -host  =&amp;gt; $session-&amp;gt;config(&amp;quot;cookie_domain&amp;quot;),&lt;br /&gt;
     -expires =&amp;gt; &amp;quot;-1d&amp;quot;,&lt;br /&gt;
   );&lt;br /&gt;
   EPrints::Apache::AnApache::header_out(&lt;br /&gt;
     $session-&amp;gt;{request},&lt;br /&gt;
     &amp;quot;Set-Cookie&amp;quot; =&amp;gt; $cookie &lt;br /&gt;
   );&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 push @{$c-&amp;gt;{rewrite_exceptions}}, &amp;quot;/shibboleth/&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
* Create a folder at the top level of your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) called &#039;&#039;&#039;shibboleth&#039;&#039;&#039; and copy the main CSS file for Shibboleth into this folder:&lt;br /&gt;
 eprints&amp;gt; mkdir /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
 eprints&amp;gt; cp /usr/share/shibboleth/main.css /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
&lt;br /&gt;
* Now, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;shibboleth/login&#039;&#039;&#039;.  This is the most basic login script that should work with the minimal attributes any Shibboleth IdP returns and &#039;&#039;&#039;only logging in users with existing accounts&#039;&#039;&#039;. Look under the [[#Customisation|Customisation]] section for advice on how to modify this script to meet your requirements, such as creation user accounts on-the-fly.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
   &lt;br /&gt;
 sub get_user &lt;br /&gt;
 {&lt;br /&gt;
   my ( $username, $email ) = ( undef, &amp;quot;&amp;quot; );&lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
    ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
    $username = lc( $username );&lt;br /&gt;
    $email = $ENV{eppn};&lt;br /&gt;
   }&lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username );&lt;br /&gt;
   if( defined $user &amp;amp;&amp;amp; defined $email )&lt;br /&gt;
   {&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
     $user-&amp;gt;commit;&lt;br /&gt;
   }&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Next, add the following markup to &#039;&#039;&#039;cfg/lang/en/static/account_required.xpage&#039;&#039;&#039; under your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;).  Substituting &#039;&#039;staff and students of the University of Foo&#039;&#039; to describe to which particular group of people logged in access is restricted.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&amp;quot;no&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE page SYSTEM &amp;quot;entities.dtd&amp;quot; &amp;gt;&lt;br /&gt;
 &amp;lt;xpage:page xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:xpage=&amp;quot;http://eprints.org/ep3/xpage&amp;quot; xmlns:epc=&amp;quot;http://eprints.org/ep3/control&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:title&amp;gt;Login Failed&amp;lt;/xpage:title&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:body&amp;gt;&lt;br /&gt;
    &amp;amp;lt;p style=&#039;text-align: center;&#039;&amp;amp;gt;Please note that only staff and students of the University of Foo may log in to &amp;lt;epc:phrase ref=&amp;quot;archive_name&amp;quot; /&amp;gt;&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:body&amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, reload Apache.&lt;br /&gt;
  root&amp;gt; apachectl reload&lt;br /&gt;
&lt;br /&gt;
* In a web browser go to the &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;).  Like before with &#039;&#039;/cgi/shibboleth&#039;&#039; you should be taken to your Shibboleth IdP&#039;s site albeit displaying an error message.&lt;br /&gt;
&lt;br /&gt;
* The Shibboleth IdP shows an error message because EPrints as a Shibboleth Service Provider is not yet registered with it.  To do this you need to send the administrator of the Shibboleth IdP the metadata for your Service Provider.  You will have generated this earlier when you ran &amp;lt;code&amp;gt;metagen.sh&amp;lt;/code&amp;gt;.  Copy off your EPrints server the file that this wrote (e.g. to &amp;lt;tt&amp;gt;/etc/shibboleth/foo/sp_metadata.xml&amp;lt;/tt&amp;gt;) and send it to the Shibboleth IdP administrator.  They should be able to upload this to register EPrints as a Service Provider application.&lt;br /&gt;
&lt;br /&gt;
* Once registered, use a web browser to go to &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;) again.  This time you should be prompted for a username and password on the Shibboleth IdP site. Once you have typed this in and clicked to login, you should be returned to EPrints on the &#039;&#039;&#039;/cgi/users/home&#039;&#039;&#039; page for your repository.  If not, see [[#Login_Issues|Login Issues]] under [[#Troubleshooting|Troubleshooting]] below.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Apache Configuration Issues ===&lt;br /&gt;
==== Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration ====&lt;br /&gt;
* Similarly to the instructions for Apache 2.4 and above, place the slightly different following configuration after the &#039;&#039;&#039;Include&#039;&#039;&#039; line for &#039;&#039;apache_ssl/foo.conf&#039;&#039;, (substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name):&lt;br /&gt;
&lt;br /&gt;
  Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/opt/eprints3/archives/foo/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
    SetHandler perl-script&lt;br /&gt;
    PerlHandler ModPerl::Registry&lt;br /&gt;
    PerlSendHeader Off&lt;br /&gt;
    Options ExecCGI FollowSymLinks&lt;br /&gt;
  &lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth Configuration Issues ===&lt;br /&gt;
==== With attribute-map.xml ====&lt;br /&gt;
When authenticating using Shibboleth to login to EPrints you may see the following line in &#039;&#039;&#039;/var/log/shibboleth.shibd.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  urn:mace:dir:attribute-def:department&lt;br /&gt;
&lt;br /&gt;
In some cases this might not be an issue, as EPrints does not necessarily to make use of all the attributes returned by the IdP but without a mapping in attribute-map.xml.  In this case &#039;&#039;&#039;urn:mace:dir:attribute-def:department&#039;&#039;&#039; is not by default needed by EPrints to create/update a user account.  However, values like &#039;&#039;&#039;sn&#039;&#039;&#039;, &#039;&#039;&#039;givenName&#039;&#039;&#039; and &#039;&#039;&#039;mail&#039;&#039;&#039; are but if you have used the attribute-map.xml provided later on the page you should not see a line like above in &#039;&#039;&#039;shibd.log&#039;&#039;&#039;.  In some cases you may still see an line like this in the log even if you think you have defined the attribute.  The line below demonstrate two known issues:&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  givenName, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:basic&lt;br /&gt;
&lt;br /&gt;
# The attribute itself has no namespace it is just &#039;&#039;&#039;&#039;givenName&#039;&#039;&#039; rather than &#039;&#039;&#039;urn:mace:dir:attribute-def:givenName&#039;&#039;&#039;&lt;br /&gt;
# The attribute has a format that most also be defined in the attribute-map.xml attribute.&lt;br /&gt;
&lt;br /&gt;
Below shows how to both include the format, which is required for the attribute to be successful mapped.  As well as define the name of the attribute without a namespace:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attribute name=&amp;quot;givenName&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical Shibboleth IdP would have both a namespaced attribute name and would not apply a format to an attribute that is a simple text string.  Therefore it is worth enquiring with the IdP provider if either of these two happen to be the case.&lt;br /&gt;
&lt;br /&gt;
==== With idp-metadata.xml ====&lt;br /&gt;
If you want to be able extract scoped attributes (e.g. &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; otherwise described as &#039;&#039;&#039;eppn&#039;&#039;&#039;).  Then you will need to ensure that the expected scope of this attribute, (effectively the domain part in eduPersonPrincipalName is the scope or one of the scopes in the idp-metadata.xml you downloaded from the Shibboleth IdP.  For example if the &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; is &#039;&#039;&#039;bar@foo.ac.uk&#039;&#039;&#039;.  Then the following should be defined in idp-metadata.xml (&#039;&#039;&#039;N.B. the namespace abbreviations (md: and shibmd:) may be different for the IdP you are working with&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;md:Extensions&amp;gt;&lt;br /&gt;
    &amp;lt;shibmd:Scope regexp=&amp;quot;false&amp;quot;&amp;gt;foo.ac.uk&amp;lt;/shibmd:Scope&amp;gt;&lt;br /&gt;
  &amp;lt;/md:Extensions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Login Issues ===&lt;br /&gt;
To be added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth /etc/shibboleth/foo/attribute-map.xml config ===&lt;br /&gt;
This is adapted from the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; provided when the Shibboleth SP package is installed to only include the attribute subsequently used by EPrints Shibboleth Perl script that can be found below.  Namely:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Field name&lt;br /&gt;
!Field description			&lt;br /&gt;
!SAML v1.1 attribute URN&lt;br /&gt;
!SAMLv2 attribute URN&lt;br /&gt;
|-&lt;br /&gt;
|eppn			&lt;br /&gt;
|Edu Person Principal Name&lt;br /&gt;
|urn:mace:dir:attribute-def:eduPersonPrincipalName&lt;br /&gt;
|urn:oid:1.3.6.1.4.1.5923.1.1.1.6&lt;br /&gt;
|-&lt;br /&gt;
|sn&lt;br /&gt;
|Surname						&lt;br /&gt;
|urn:mace:dir:attribute-def:sn								&lt;br /&gt;
|urn:oid:2.5.4.4&lt;br /&gt;
|-&lt;br /&gt;
|givenName&lt;br /&gt;
|Given (first) name(s)&lt;br /&gt;
|urn:mace:dir:attribute-def:givenName&lt;br /&gt;
|urn:oid:2.5.4.42&lt;br /&gt;
|-&lt;br /&gt;
|mail&lt;br /&gt;
|Email address	&lt;br /&gt;
|urn:mace:dir:attribute-def:mail&lt;br /&gt;
|urn:oid:0.9.2342.19200300.100.1.3  &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may wish to refer to the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; is you want to use other attributes.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attributes xmlns=&amp;quot;urn:mace:shibboleth:2.0:attribute-map&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:eduPersonPrincipalName&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:1.3.6.1.4.1.5923.1.1.1.6&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:sn&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:givenName&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:mail&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.4&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.42&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:0.9.2342.19200300.100.1.3&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/Attributes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EPrints /shibboleth/login script with user account creation ===&lt;br /&gt;
This is the standard EPrints Shibboleth login script.  It makes a number of assumptions:&lt;br /&gt;
# That accounts should be created if they do not already exist for a particular user.&lt;br /&gt;
# That you wish to create a standard user account (not an editor administrator) account.&lt;br /&gt;
# That the Shibboleth IdP provides all the attributes (eduPersonPrinicpalName (seen as eppn), sn, givenName and mail) required.&lt;br /&gt;
&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 &lt;br /&gt;
 sub get_user&lt;br /&gt;
 {&lt;br /&gt;
   my ($username, $given, $family, $email) = (undef, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
     ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
     $username = lc( $username );&lt;br /&gt;
   }&lt;br /&gt;
   $email = $ENV{mail} if $ENV{mail};&lt;br /&gt;
   if( $ENV{givenName} )&lt;br /&gt;
   {&lt;br /&gt;
     $given = lc( $ENV{givenName} );&lt;br /&gt;
     $given =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $given =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
   if( $ENV{sn} )&lt;br /&gt;
   {&lt;br /&gt;
     $family = lc( $ENV{sn} );&lt;br /&gt;
     $family =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $family =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
 &lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username ); # relying on this to be case insensitive&lt;br /&gt;
 &lt;br /&gt;
   if( !defined $user )&lt;br /&gt;
   {&lt;br /&gt;
     my $usertype = &#039;user&#039;;&lt;br /&gt;
     $user = EPrints::DataObj::User::create( $session, $usertype );&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;username&amp;quot;, $username );&lt;br /&gt;
   }&lt;br /&gt;
   my $name = {&lt;br /&gt;
     given =&amp;gt; $given,&lt;br /&gt;
     family =&amp;gt; $family,&lt;br /&gt;
   };&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;name&amp;quot;, $name );&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Further Information ==&lt;br /&gt;
* Older instructions of how to set up EPrints for Shibboleth using UK Access management Federation discovery service is available [[Shibboleth authentication|here]].&lt;br /&gt;
&lt;br /&gt;
* For general information about installing and configuring Shibboleth [http://shibboleth.internet2.edu/ click here].&lt;br /&gt;
&lt;br /&gt;
* [https://docs.openathens.net/display/public/TPA/Sign+in+to+a+generic+application+using+OpenAthens#SignintoagenericapplicationusingOpenAthens-SetupthecustomSAMLresourceinOpenAthens Instructions of connection a Shibboleth Service Provider with OpenAthens]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16712</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16712"/>
		<updated>2025-01-21T14:22:54Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual}}&lt;br /&gt;
&#039;&#039;&#039;This page details how to install and integrate Shibboleth with EPrints 3.3.x or 3.4.x on a CentOS 7 operating system.&#039;&#039;&#039;  The process should be fairly similar for other comparable Red Hat based Linux distributions such as RHEL 7 and Fedora 21/22.  These instructions should also be generally applicable to later versions of RHEL-based Linux (e.g. Rocky Linux 8, Red Hat Enterprise Linux 9, etc.). However, they may be somewhat different for Debian-based Linux, such as Ubuntu and Debian itself and other Linux distributions.  Typically, this will just be different package names and different commands to manage applications.&lt;br /&gt;
&lt;br /&gt;
Generally, it is a good idea to run EPrints with &#039;&#039;&#039;HTTPS&#039;&#039;&#039; when using Shibboleth authentication for increased security on the attributes being sent back by the Shibboleth Identity Provider (IdP).  Therefore, it is assumed that EPrints has already been set up to use HTTPS and there already exists an &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039; under the archive directory structure.&lt;br /&gt;
&lt;br /&gt;
== Installing Shibboleth ==&lt;br /&gt;
* First, add the Shibboleth repository to your list of YUM repositories (if you need this for a different RHEL-based Linux distribution fill in the form at https://shibboleth.net/downloads/service-provider/latest/RPMS/):&lt;br /&gt;
  root&amp;gt; wget -O /etc/yum.repos.d/shibboleth.repo https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7&lt;br /&gt;
&lt;br /&gt;
* Now you can use Yum to install all package dependencies:&lt;br /&gt;
  root&amp;gt; yum install log4shib opensaml shibboleth unixODBC xerces-c xml-security-c xmltooling &lt;br /&gt;
&lt;br /&gt;
* You may be prompted to accept the importing of the key for the Shibboleth repository, for which you should type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter.&lt;br /&gt;
&lt;br /&gt;
* Once you have done that, test that &#039;&#039;&#039;shibd&#039;&#039;&#039; has no issues:&lt;br /&gt;
  root&amp;gt; LD_LIBRARY_PATH=/opt/shibboleth/lib64 shibd -t&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;shibd -t&#039;&#039; should return a couple of warning, like those listed below.  These are due to it not yet being configured.&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : insecure cookieProps setting, set to &amp;quot;https&amp;quot; for SSL/TLS-only usage&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : handlerSSL should be enabled for SSL/TLS-enabled web sites&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : no MetadataProvider available, configure at least one for standard SSO usage&lt;br /&gt;
  overall configuration is loadable, check console for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
* If there are no other warning or error messages from &#039;&#039;shibd -t&#039;&#039;, you can start it properly and check to make sure it is running. You may also want ensure Shibboleth starts at boot using &#039;&#039;&#039;systemctl  enable&#039;&#039;&#039;&lt;br /&gt;
  root&amp;gt; systemctl start shibd.service&lt;br /&gt;
  root&amp;gt; ps aux | grep shib&lt;br /&gt;
  shibd    29338  0.4  0.7 419784 15024 ?        Ssl  11:16   0:00 /usr/sbin/shibd -p /var/run/shibboleth/shibd.pid -f -w 30&lt;br /&gt;
  root     29345  0.0  0.0 112640   940 pts/2    S+   11:17   0:00 grep --color=auto -i shib&lt;br /&gt;
  root&amp;gt; systemctl enable shibd.service&lt;br /&gt;
&lt;br /&gt;
== Configuring Shibboleth ==&lt;br /&gt;
* Replace &#039;&#039;&#039;/etc/shibboleth/shibboleth2.xml&#039;&#039;&#039; with the following.  Substitute &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; for the hostname of your EPrints repository, &#039;&#039;&#039;https://shib.foo.example.org/idp/shibboleth&#039;&#039;&#039; with the entity ID for you Shibboleth IdP and &#039;&#039;&#039;foo&#039;&#039;&#039; in the pathname of files with the name or your repository (e.g. &#039;&#039;foo/attribute-map.xml&#039;&#039; becomes &#039;&#039;myrepo/attribute-map.xml&#039;&#039;).  &#039;&#039;&#039;(This configuration is intended for Shibboleth SP version 2.x and is liable to cause deprecation warnings if  you have installed a recent version of Shibboleth from a package repository.  [[Shibboleth/3.x|Here is a default shibboleth2.xml configuration for Shibboleth 3.x]]).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;SPConfig xmlns=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    xmlns:conf=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    clockSkew=&amp;quot;180&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&lt;br /&gt;
                         REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
                         cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Sessions lifetime=&amp;quot;28800&amp;quot; timeout=&amp;quot;3600&amp;quot; relayState=&amp;quot;ss:mem&amp;quot; &lt;br /&gt;
                checkAddress=&amp;quot;false&amp;quot; handlerSSL=&amp;quot;true&amp;quot; cookieProps=&amp;quot;https&amp;quot;&lt;br /&gt;
                redirectLimit=&amp;quot;exact&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;SSO entityID=&amp;quot;https://shib.foo.example.org/idp/shibboleth&amp;quot;&amp;gt;SAML2&amp;lt;/SSO&amp;gt;&lt;br /&gt;
        &amp;lt;Logout&amp;gt;SAML2 Local&amp;lt;/Logout&amp;gt;&lt;br /&gt;
        &amp;lt;LogoutInitiator type=&amp;quot;Admin&amp;quot; Location=&amp;quot;/Logout/Admin&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Status&amp;quot; Location=&amp;quot;/Status&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Session&amp;quot; Location=&amp;quot;/Session&amp;quot; showAttributeValues=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;DiscoveryFeed&amp;quot; Location=&amp;quot;/DiscoFeed&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Sessions&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Errors supportContact=&amp;quot;root@localhost&amp;quot; helpLocation=&amp;quot;/about.html&amp;quot; styleSheet=&amp;quot;/shibboleth/main.css&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; path=&amp;quot;foo/idp-metadata.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeExtractor type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;foo/attribute-map.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeFilter type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;attribute-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;/ApplicationDefaults&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;SecurityPolicyProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;security-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ProtocolProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;protocols.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/SPConfig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create the directory &#039;&#039;&#039;/etc/shibboleth/foo&#039;&#039;&#039;, substituting &#039;&#039;foo&#039;&#039; for your repository name.&lt;br /&gt;
  root&amp;gt; mkdir /etc/shibboleth/foo&lt;br /&gt;
&lt;br /&gt;
* Copy &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; into this new directory.&lt;br /&gt;
  cp /etc/shibboleth/attribute-map.xml /etc/shibboleth/foo/&lt;br /&gt;
&lt;br /&gt;
* Temporarily rename &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; to &#039;&#039;&#039;sp-cert.pem.old&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem.old&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-cert.pem.old&lt;br /&gt;
  root&amp;gt; mv sp-key.pem sp-key.pem.old&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;keygen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./keygen.sh -f -h foo.eprints.org -e https://foo.eprints.org/shibboleth&lt;br /&gt;
&lt;br /&gt;
* Move the new &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; to &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; amd move the &#039;&#039;.old&#039;&#039; files back in place:&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-key.pem foo/&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem.old sp-cert.pem&lt;br /&gt;
  root&amp;gt; mv sp-key.pem.old sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Check that &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; still have the owner and group &#039;&#039;&#039;shibd&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; ls -l /etc/shibboleth/foo/sp-*&lt;br /&gt;
  -rw-r--r-- 1 shibd shibd 1192 May  6 19:04 /etc/shibboleth/foo/sp-cert.pem&lt;br /&gt;
  -rw------- 1 shibd shibd 1708 May  6 19:04 /etc/shibboleth/foo/sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;metagen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.  You will ultimately need to send the output of this to the person managing the Shibboleth IdP server with which you want to register your EPrints repository as a service.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./metagen.sh -ALO -c foo/sp-cert.pem -h foo.eprints.org -e https://foo.eprints.org/shibboleth &amp;gt; foo/sp_metadata.xml&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039; foo/sp_metadata.xml&#039;&#039;&#039; to add in the namepace definitions by separately changing the &amp;lt;code&amp;gt;md:EntityDescriptor&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ds:KeyInfo&amp;lt;/code&amp;gt; lines as follows from:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor xmlns:md=&amp;quot;urn:oasis:names:tc:SAML:2.0:metadata&amp;quot; entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt; &lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo xmlns:ds=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;wget&#039;&#039; to download the metadata from your Shibboleth IdP (e.g. shib.foo.example.org) to the &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; directory.&lt;br /&gt;
  root&amp;gt; wget -O /etc/shibboleth/foo/idp-metadata.xml https://shib.foo.example.org/idp/shibboleth&lt;br /&gt;
&lt;br /&gt;
=== Using Remote IdP Metatdata ===&lt;br /&gt;
&lt;br /&gt;
As IdP Metadata may expire, you may want to use the remote metadata URL rather than a local copy.  This is what you need to do to switch to using remote IdP metadata:&lt;br /&gt;
&lt;br /&gt;
* Edit the &#039;&#039;&#039;MetadataProvider&#039;&#039;&#039; line to something like the following.  The reloadInterval is best set to 7200 but this can be set less frequently:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://shib.foo.example.org/idp/metadata.xml&amp;quot; backingFilePath=&amp;quot;foo/idp-metadata.xml&amp;quot; reloadInterval=&amp;quot;7200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure the reloadInterval is appropriate for the IdP metadata you are downloading.  If you have large metadata file,(e.g. from a federated metadata service containing metadata for other IdPs), then it may be better to set this higher than the default.  However, the configuration checker may warn you that your reload interval is too long, so you may have to choose to ignore this, if you want to avoid downloading a large federated metadata file too often.&lt;br /&gt;
&lt;br /&gt;
* Make sure that the directory &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and &#039;&#039;&#039;/etc/shibboleth/foo/idp-metadata.xml&#039;&#039;&#039; if it already exists) are owned by &#039;&#039;&#039;shibd&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/idp-metadata.xml&lt;br /&gt;
&lt;br /&gt;
* To test Shibboleth you will need to make sure your &#039;&#039;&#039;LD_LIBRARY_PATH&#039;&#039;&#039; is set the same as shibd would have when started using &#039;&#039;systemctl shibd start&#039;&#039;.  This should return the message: &#039;&#039;overall configuration is loadable, check console for non-fatal problems&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
 LD_LIBRARY_PATH=/opt/shibboleth/lib64:$LD_LIBRARY_PATH shibd -t&lt;br /&gt;
&lt;br /&gt;
* The above message is because it is now advised not to leave the MetadataGenerator enabled unnecessarily.  However, whilst you are setting up Shibboleth, it is useful to have the metadata generator, save you needing to build your own Service Provider metadata file to register with your Identity Provider.  Later on you can comment out the MetadataGenerator line to stop getting this warning message.&lt;br /&gt;
&lt;br /&gt;
* Now you can restart &#039;&#039;&#039;shibd&#039;&#039;&#039; properly:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart shibd&lt;br /&gt;
&lt;br /&gt;
== Configuring Apache and EPrints ==&lt;br /&gt;
&#039;&#039;&#039;N.B. All these actions should be carried out by the &#039;&#039;eprints&#039;&#039; user, except when prepended with &#039;&#039;root&amp;gt;&#039;&#039; which means the command should be run as the &#039;&#039;root&#039;&#039; user.&#039;&#039;&#039;&lt;br /&gt;
* Add the following configuration to your archive&#039;s &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039;, after the &#039;&#039;&#039;Include /opt/eprints3/cfg/apache_ssl/foo.conf&#039;&#039;&#039;, substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name where appropriate.  (This assumes you are running Apache 2.4 or greater).  See [[#Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration |Troubleshooting]] for instructions on the configuration to use for Apache 2.2. or lower.&lt;br /&gt;
&lt;br /&gt;
 Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
 &amp;lt;Location &amp;quot;/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   SetHandler perl-script&lt;br /&gt;
   PerlHandler ModPerl::Registry&lt;br /&gt;
   PerlSendHeader Off&lt;br /&gt;
   Options ExecCGI FollowSymLinks&lt;br /&gt;
 &lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy the following code into your archive (e.g. /opt/eprints3/archives/foo/) as &#039;&#039;&#039;cgi/shibboleth&#039;&#039;&#039;.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 my $session = new EPrints::Session;&lt;br /&gt;
 exit( 0 ) unless( defined $session );&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content_type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;html&amp;amp;gt;&amp;amp;lt;head/&amp;amp;gt;&amp;amp;lt;body&amp;amp;gt;&amp;amp;lt;code&amp;amp;gt;\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 foreach my $key (sort keys(%ENV)) {&lt;br /&gt;
   print &amp;quot;&amp;amp;lt;p&amp;amp;gt;$key = $ENV{$key}&amp;amp;lt;/p&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;/code&amp;amp;gt;&amp;amp;lt;/body&amp;amp;gt;&amp;amp;lt;/html&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 exit;&lt;br /&gt;
&lt;br /&gt;
* Now restart Shibboleth and Apache:&lt;br /&gt;
  root&amp;gt; systemctl restart shibd.service&lt;br /&gt;
  root&amp;gt; apachectl restart&lt;br /&gt;
&lt;br /&gt;
* In a web browser go the &#039;&#039;&#039;/cgi/shibboleth&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/cgi/shibboleth&#039;&#039;).  You should be redirected to an error page for your your Shibboleth IdP (e.g. &#039;&#039;https://shib.foo.example.org/idp/profile/SAML2/Redirect/SSO?...&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
* If instead you are displayed with a list of key values or are forbidden to access the page, you have not configured Apache properly, if so, see [[#Apache_Configuration_Issues|Apache_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].  If you see an error message like the one below, you have not set up Shibboleth properly, if so, see [[#Shibboleth_Configuration_Issues|Shibboleth_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
 opensaml::saml2md::MetadataException&lt;br /&gt;
 The system encountered an error at Wed May 6 15:19:27 2015&lt;br /&gt;
 To report this problem, please contact the site administrator at root@localhost.&lt;br /&gt;
 Please include the following message in any email:&lt;br /&gt;
 opensaml::saml2md::MetadataException at (http://foo.eprints.org/cgi/shibboleth)&lt;br /&gt;
 Unable to locate metadata for identity provider (https://shib.foo.example.org/idp/shibboleth)&lt;br /&gt;
&lt;br /&gt;
* Next, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;cfg/cfg.d/zz_shibboleth.pl&#039;&#039;&#039;.  This is needed to redirect login and logout to use Shibboleth rather than local login.&lt;br /&gt;
 $c-&amp;gt;{get_login_url} = sub {&lt;br /&gt;
   my( $session, $target ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   # preserve CGI params&lt;br /&gt;
   $session-&amp;gt;read_params;&lt;br /&gt;
   $target = $session-&amp;gt;get_url(&lt;br /&gt;
     host =&amp;gt; 1,&lt;br /&gt;
     path =&amp;gt; &amp;quot;auto&amp;quot;,&lt;br /&gt;
     query =&amp;gt; 1,&lt;br /&gt;
   );&lt;br /&gt;
 &lt;br /&gt;
   my $url = URI-&amp;gt;new( $session-&amp;gt;config( &amp;quot;https_url&amp;quot; )  . &amp;quot;/shibboleth/login&amp;quot; );&lt;br /&gt;
   $url-&amp;gt;query_form( target =&amp;gt; &amp;quot;$target&amp;quot; );&lt;br /&gt;
   return &amp;quot;$url&amp;quot;;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 $c-&amp;gt;{on_logout} = sub {&lt;br /&gt;
   my( $session ) = @_;&lt;br /&gt;
   my $query = $session-&amp;gt;query;&lt;br /&gt;
   return unless defined $query;&lt;br /&gt;
 &lt;br /&gt;
   # remove _shibsession_ cookie&lt;br /&gt;
   my( $shibname, $shibvalue );&lt;br /&gt;
   for( $query-&amp;gt;cookie() ) {&lt;br /&gt;
     if( $_ =~ /^_shibsession/ ) {&lt;br /&gt;
       $shibname = $_;&lt;br /&gt;
       $shibvalue = $query-&amp;gt;cookie( $shibname );&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   my $cookie = $query-&amp;gt;cookie(&lt;br /&gt;
     -name    =&amp;gt; $shibname,&lt;br /&gt;
     -path    =&amp;gt; &amp;quot;/&amp;quot;,&lt;br /&gt;
     -value   =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     -host  =&amp;gt; $session-&amp;gt;config(&amp;quot;cookie_domain&amp;quot;),&lt;br /&gt;
     -expires =&amp;gt; &amp;quot;-1d&amp;quot;,&lt;br /&gt;
   );&lt;br /&gt;
   EPrints::Apache::AnApache::header_out(&lt;br /&gt;
     $session-&amp;gt;{request},&lt;br /&gt;
     &amp;quot;Set-Cookie&amp;quot; =&amp;gt; $cookie &lt;br /&gt;
   );&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 push @{$c-&amp;gt;{rewrite_exceptions}}, &amp;quot;/shibboleth/&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
* Create a folder at the top level of your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) called &#039;&#039;&#039;shibboleth&#039;&#039;&#039; and copy the main CSS file for Shibboleth into this folder:&lt;br /&gt;
 eprints&amp;gt; mkdir /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
 eprints&amp;gt; cp /usr/share/shibboleth/main.css /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
&lt;br /&gt;
* Now, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;shibboleth/login&#039;&#039;&#039;.  This is the most basic login script that should work with the minimal attributes any Shibboleth IdP returns and &#039;&#039;&#039;only logging in users with existing accounts&#039;&#039;&#039;. Look under the [[#Customisation|Customisation]] section for advice on how to modify this script to meet your requirements, such as creation user accounts on-the-fly.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
   &lt;br /&gt;
 sub get_user &lt;br /&gt;
 {&lt;br /&gt;
   my ( $username, $email ) = ( undef, &amp;quot;&amp;quot; );&lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
    ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
    $username = lc( $username );&lt;br /&gt;
    $email = $ENV{eppn};&lt;br /&gt;
   }&lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username );&lt;br /&gt;
   if( defined $user &amp;amp;&amp;amp; defined $email )&lt;br /&gt;
   {&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
     $user-&amp;gt;commit;&lt;br /&gt;
   }&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Next, add the following markup to &#039;&#039;&#039;cfg/lang/en/static/account_required.xpage&#039;&#039;&#039; under your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;).  Substituting &#039;&#039;staff and students of the University of Foo&#039;&#039; to describe to which particular group of people logged in access is restricted.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&amp;quot;no&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE page SYSTEM &amp;quot;entities.dtd&amp;quot; &amp;gt;&lt;br /&gt;
 &amp;lt;xpage:page xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:xpage=&amp;quot;http://eprints.org/ep3/xpage&amp;quot; xmlns:epc=&amp;quot;http://eprints.org/ep3/control&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:title&amp;gt;Login Failed&amp;lt;/xpage:title&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:body&amp;gt;&lt;br /&gt;
    &amp;amp;lt;p style=&#039;text-align: center;&#039;&amp;amp;gt;Please note that only staff and students of the University of Foo may log in to &amp;lt;epc:phrase ref=&amp;quot;archive_name&amp;quot; /&amp;gt;&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:body&amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, reload Apache.&lt;br /&gt;
  root&amp;gt; apachectl reload&lt;br /&gt;
&lt;br /&gt;
* In a web browser go to the &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;).  Like before with &#039;&#039;/cgi/shibboleth&#039;&#039; you should be taken to your Shibboleth IdP&#039;s site albeit displaying an error message.&lt;br /&gt;
&lt;br /&gt;
* The Shibboleth IdP shows an error message because EPrints as a Shibboleth Service Provider is not yet registered with it.  To do this you need to send the administrator of the Shibboleth IdP the metadata for your Service Provider.  You will have generated this earlier when you ran &amp;lt;code&amp;gt;metagen.sh&amp;lt;/code&amp;gt;.  Copy off your EPrints server the file that this wrote (e.g. to &amp;lt;tt&amp;gt;/etc/shibboleth/foo/sp_metadata.xml&amp;lt;/tt&amp;gt;) and send it to the Shibboleth IdP administrator.  They should be able to upload this to register EPrints as a Service Provider application.&lt;br /&gt;
&lt;br /&gt;
* Once registered, use a web browser to go to &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;) again.  This time you should be prompted for a username and password on the Shibboleth IdP site. Once you have typed this in and clicked to login, you should be returned to EPrints on the &#039;&#039;&#039;/cgi/users/home&#039;&#039;&#039; page for your repository.  If not, see [[#Login_Issues|Login Issues]] under [[#Troubleshooting|Troubleshooting]] below.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Apache Configuration Issues ===&lt;br /&gt;
==== Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration ====&lt;br /&gt;
* Similarly to the instructions for Apache 2.4 and above, place the slightly different following configuration after the &#039;&#039;&#039;Include&#039;&#039;&#039; line for &#039;&#039;apache_ssl/foo.conf&#039;&#039;, (substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name):&lt;br /&gt;
&lt;br /&gt;
  Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/opt/eprints3/archives/foo/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
    SetHandler perl-script&lt;br /&gt;
    PerlHandler ModPerl::Registry&lt;br /&gt;
    PerlSendHeader Off&lt;br /&gt;
    Options ExecCGI FollowSymLinks&lt;br /&gt;
  &lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth Configuration Issues ===&lt;br /&gt;
==== With attribute-map.xml ====&lt;br /&gt;
When authenticating using Shibboleth to login to EPrints you may see the following line in &#039;&#039;&#039;/var/log/shibboleth.shibd.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  urn:mace:dir:attribute-def:department&lt;br /&gt;
&lt;br /&gt;
In some cases this might not be an issue, as EPrints does not necessarily to make use of all the attributes returned by the IdP but without a mapping in attribute-map.xml.  In this case &#039;&#039;&#039;urn:mace:dir:attribute-def:department&#039;&#039;&#039; is not by default needed by EPrints to create/update a user account.  However, values like &#039;&#039;&#039;sn&#039;&#039;&#039;, &#039;&#039;&#039;givenName&#039;&#039;&#039; and &#039;&#039;&#039;mail&#039;&#039;&#039; are but if you have used the attribute-map.xml provided later on the page you should not see a line like above in &#039;&#039;&#039;shibd.log&#039;&#039;&#039;.  In some cases you may still see an line like this in the log even if you think you have defined the attribute.  The line below demonstrate two known issues:&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  givenName, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:basic&lt;br /&gt;
&lt;br /&gt;
# The attribute itself has no namespace it is just &#039;&#039;&#039;&#039;givenName&#039;&#039;&#039; rather than &#039;&#039;&#039;urn:mace:dir:attribute-def:givenName&#039;&#039;&#039;&lt;br /&gt;
# The attribute has a format that most also be defined in the attribute-map.xml attribute.&lt;br /&gt;
&lt;br /&gt;
Below shows how to both include the format, which is required for the attribute to be successful mapped.  As well as define the name of the attribute without a namespace:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attribute name=&amp;quot;givenName&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical Shibboleth IdP would have both a namespaced attribute name and would not apply a format to an attribute that is a simple text string.  Therefore it is worth enquiring with the IdP provider if either of these two happen to be the case.&lt;br /&gt;
&lt;br /&gt;
==== With idp-metadata.xml ====&lt;br /&gt;
If you want to be able extract scoped attributes (e.g. &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; otherwise described as &#039;&#039;&#039;eppn&#039;&#039;&#039;).  Then you will need to ensure that the expected scope of this attribute, (effectively the domain part in eduPersonPrincipalName is the scope or one of the scopes in the idp-metadata.xml you downloaded from the Shibboleth IdP.  For example if the &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; is &#039;&#039;&#039;bar@foo.ac.uk&#039;&#039;&#039;.  Then the following should be defined in idp-metadata.xml (&#039;&#039;&#039;N.B. the namespace abbreviations (md: and shibmd:) may be different for the IdP you are working with&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;md:Extensions&amp;gt;&lt;br /&gt;
    &amp;lt;shibmd:Scope regexp=&amp;quot;false&amp;quot;&amp;gt;foo.ac.uk&amp;lt;/shibmd:Scope&amp;gt;&lt;br /&gt;
  &amp;lt;/md:Extensions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Login Issues ===&lt;br /&gt;
To be added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth /etc/shibboleth/foo/attribute-map.xml config ===&lt;br /&gt;
This is adapted from the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; provided when the Shibboleth SP package is installed to only include the attribute subsequently used by EPrints Shibboleth Perl script that can be found below.  Namely:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Field name&lt;br /&gt;
!Field description			&lt;br /&gt;
!SAML v1.1 attribute URN&lt;br /&gt;
!SAMLv2 attribute URN&lt;br /&gt;
|-&lt;br /&gt;
|eppn			&lt;br /&gt;
|Edu Person Principal Name&lt;br /&gt;
|urn:mace:dir:attribute-def:eduPersonPrincipalName&lt;br /&gt;
|urn:oid:1.3.6.1.4.1.5923.1.1.1.6&lt;br /&gt;
|-&lt;br /&gt;
|sn&lt;br /&gt;
|Surname						&lt;br /&gt;
|urn:mace:dir:attribute-def:sn								&lt;br /&gt;
|urn:oid:2.5.4.4&lt;br /&gt;
|-&lt;br /&gt;
|givenName&lt;br /&gt;
|Given (first) name(s)&lt;br /&gt;
|urn:mace:dir:attribute-def:givenName&lt;br /&gt;
|urn:oid:2.5.4.42&lt;br /&gt;
|-&lt;br /&gt;
|mail&lt;br /&gt;
|Email address	&lt;br /&gt;
|urn:mace:dir:attribute-def:mail&lt;br /&gt;
|urn:oid:0.9.2342.19200300.100.1.3  &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may wish to refer to the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; is you want to use other attributes.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attributes xmlns=&amp;quot;urn:mace:shibboleth:2.0:attribute-map&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:eduPersonPrincipalName&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:1.3.6.1.4.1.5923.1.1.1.6&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:sn&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:givenName&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:mail&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.4&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.42&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:0.9.2342.19200300.100.1.3&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/Attributes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EPrints /shibboleth/login script with user account creation ===&lt;br /&gt;
This is the standard EPrints Shibboleth login script.  It makes a number of assumptions:&lt;br /&gt;
# That accounts should be created if they do not already exist for a particular user.&lt;br /&gt;
# That you wish to create a standard user account (not an editor administrator) account.&lt;br /&gt;
# That the Shibboleth IdP provides all the attributes (eduPersonPrinicpalName (seen as eppn), sn, givenName and mail) required.&lt;br /&gt;
&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 &lt;br /&gt;
 sub get_user&lt;br /&gt;
 {&lt;br /&gt;
   my ($username, $given, $family, $email) = (undef, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
     ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
     $username = lc( $username );&lt;br /&gt;
   }&lt;br /&gt;
   $email = $ENV{mail} if $ENV{mail};&lt;br /&gt;
   if( $ENV{givenName} )&lt;br /&gt;
   {&lt;br /&gt;
     $given = lc( $ENV{givenName} );&lt;br /&gt;
     $given =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $given =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
   if( $ENV{sn} )&lt;br /&gt;
   {&lt;br /&gt;
     $family = lc( $ENV{sn} );&lt;br /&gt;
     $family =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $family =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
 &lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username ); # relying on this to be case insensitive&lt;br /&gt;
 &lt;br /&gt;
   if( !defined $user )&lt;br /&gt;
   {&lt;br /&gt;
     my $usertype = &#039;user&#039;;&lt;br /&gt;
     $user = EPrints::DataObj::User::create( $session, $usertype );&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;username&amp;quot;, $username );&lt;br /&gt;
   }&lt;br /&gt;
   my $name = {&lt;br /&gt;
     given =&amp;gt; $given,&lt;br /&gt;
     family =&amp;gt; $family,&lt;br /&gt;
   };&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;name&amp;quot;, $name );&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Further Information ==&lt;br /&gt;
* Older instructions of how to set up EPrints for Shibboleth using UK Access management Federation discovery service is available [[Shibboleth authentication|here]].&lt;br /&gt;
&lt;br /&gt;
* For general information about installing and configuring Shibboleth [http://shibboleth.internet2.edu/ click here].&lt;br /&gt;
&lt;br /&gt;
* [https://docs.openathens.net/display/public/TPA/Sign+in+to+a+generic+application+using+OpenAthens#SignintoagenericapplicationusingOpenAthens-SetupthecustomSAMLresourceinOpenAthens Instructions of connection a Shibboleth Service Provider with OpenAthens]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16711</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16711"/>
		<updated>2025-01-21T14:20:27Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual}}&lt;br /&gt;
&#039;&#039;&#039;This page details how to install and integrate Shibboleth with EPrints 3.3.x or 3.4.x on a CentOS 7 operating system.&#039;&#039;&#039;  The process should be fairly similar for other comparable Red Hat based Linux distributions such as RHEL 7 and Fedora 21/22.  These instructions should also be generally applicable to later versions of RHEL-based Linux (e.g. Rocky Linux 8, Red Hat Enterprise Linux 9, etc.). However, they ma be somewhat different for Debian-based Linux, such as Ubuntu and Debian itself and other Linux distributions.  Typically, this will just be different package names and different commands to manage applications.&lt;br /&gt;
&lt;br /&gt;
Generally, it is a good idea to run EPrints with &#039;&#039;&#039;HTTPS&#039;&#039;&#039; when using Shibboleth authentication for increased security on the attributes being sent back by the Shibboleth Identity Provider (IdP).  Therefore, it is assumed that EPrints has already been set up to use HTTPS and there already exists an &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039; under the archive directory structure.&lt;br /&gt;
&lt;br /&gt;
== Installing Shibboleth ==&lt;br /&gt;
* First, add the Shibboleth repository to your list of YUM repositories (if you need this for a different RHEL-based Linux distribution fill in the form at https://shibboleth.net/downloads/service-provider/latest/RPMS/):&lt;br /&gt;
  root&amp;gt; wget -O /etc/yum.repos.d/shibboleth.repo https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7&lt;br /&gt;
&lt;br /&gt;
* Now you can use Yum to install all package dependencies:&lt;br /&gt;
  root&amp;gt; yum install log4shib opensaml shibboleth unixODBC xerces-c xml-security-c xmltooling &lt;br /&gt;
&lt;br /&gt;
* You may be prompted to accept the importing of the key for the Shibboleth repository, for which you should type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter.&lt;br /&gt;
&lt;br /&gt;
* Once you have done that, test that &#039;&#039;&#039;shibd&#039;&#039;&#039; has no issues:&lt;br /&gt;
  root&amp;gt; LD_LIBRARY_PATH=/opt/shibboleth/lib64 shibd -t&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;shibd -t&#039;&#039; should return a couple of warning, like those listed below.  These are due to it not yet being configured.&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : insecure cookieProps setting, set to &amp;quot;https&amp;quot; for SSL/TLS-only usage&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : handlerSSL should be enabled for SSL/TLS-enabled web sites&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : no MetadataProvider available, configure at least one for standard SSO usage&lt;br /&gt;
  overall configuration is loadable, check console for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
* If there are no other warning or error messages from &#039;&#039;shibd -t&#039;&#039;, you can start it properly and check to make sure it is running. You may also want ensure Shibboleth starts at boot using &#039;&#039;&#039;systemctl  enable&#039;&#039;&#039;&lt;br /&gt;
  root&amp;gt; systemctl start shibd.service&lt;br /&gt;
  root&amp;gt; ps aux | grep shib&lt;br /&gt;
  shibd    29338  0.4  0.7 419784 15024 ?        Ssl  11:16   0:00 /usr/sbin/shibd -p /var/run/shibboleth/shibd.pid -f -w 30&lt;br /&gt;
  root     29345  0.0  0.0 112640   940 pts/2    S+   11:17   0:00 grep --color=auto -i shib&lt;br /&gt;
  root&amp;gt; systemctl enable shibd.service&lt;br /&gt;
&lt;br /&gt;
== Configuring Shibboleth ==&lt;br /&gt;
* Replace &#039;&#039;&#039;/etc/shibboleth/shibboleth2.xml&#039;&#039;&#039; with the following.  Substitute &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; for the hostname of your EPrints repository, &#039;&#039;&#039;https://shib.foo.example.org/idp/shibboleth&#039;&#039;&#039; with the entity ID for you Shibboleth IdP and &#039;&#039;&#039;foo&#039;&#039;&#039; in the pathname of files with the name or your repository (e.g. &#039;&#039;foo/attribute-map.xml&#039;&#039; becomes &#039;&#039;myrepo/attribute-map.xml&#039;&#039;).  &#039;&#039;&#039;(This configuration is intended for Shibboleth SP version 2.x and is liable to cause deprecation warnings if  you have installed a recent version of Shibboleth from a package repository.  [[Shibboleth/3.x|Here is a default shibboleth2.xml configuration for Shibboleth 3.x]]).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;SPConfig xmlns=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    xmlns:conf=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    clockSkew=&amp;quot;180&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&lt;br /&gt;
                         REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
                         cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Sessions lifetime=&amp;quot;28800&amp;quot; timeout=&amp;quot;3600&amp;quot; relayState=&amp;quot;ss:mem&amp;quot; &lt;br /&gt;
                checkAddress=&amp;quot;false&amp;quot; handlerSSL=&amp;quot;true&amp;quot; cookieProps=&amp;quot;https&amp;quot;&lt;br /&gt;
                redirectLimit=&amp;quot;exact&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;SSO entityID=&amp;quot;https://shib.foo.example.org/idp/shibboleth&amp;quot;&amp;gt;SAML2&amp;lt;/SSO&amp;gt;&lt;br /&gt;
        &amp;lt;Logout&amp;gt;SAML2 Local&amp;lt;/Logout&amp;gt;&lt;br /&gt;
        &amp;lt;LogoutInitiator type=&amp;quot;Admin&amp;quot; Location=&amp;quot;/Logout/Admin&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Status&amp;quot; Location=&amp;quot;/Status&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Session&amp;quot; Location=&amp;quot;/Session&amp;quot; showAttributeValues=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;DiscoveryFeed&amp;quot; Location=&amp;quot;/DiscoFeed&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Sessions&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Errors supportContact=&amp;quot;root@localhost&amp;quot; helpLocation=&amp;quot;/about.html&amp;quot; styleSheet=&amp;quot;/shibboleth/main.css&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; path=&amp;quot;foo/idp-metadata.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeExtractor type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;foo/attribute-map.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeFilter type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;attribute-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;/ApplicationDefaults&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;SecurityPolicyProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;security-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ProtocolProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;protocols.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/SPConfig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create the directory &#039;&#039;&#039;/etc/shibboleth/foo&#039;&#039;&#039;, substituting &#039;&#039;foo&#039;&#039; for your repository name.&lt;br /&gt;
  root&amp;gt; mkdir /etc/shibboleth/foo&lt;br /&gt;
&lt;br /&gt;
* Copy &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; into this new directory.&lt;br /&gt;
  cp /etc/shibboleth/attribute-map.xml /etc/shibboleth/foo/&lt;br /&gt;
&lt;br /&gt;
* Temporarily rename &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; to &#039;&#039;&#039;sp-cert.pem.old&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem.old&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-cert.pem.old&lt;br /&gt;
  root&amp;gt; mv sp-key.pem sp-key.pem.old&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;keygen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./keygen.sh -f -h foo.eprints.org -e https://foo.eprints.org/shibboleth&lt;br /&gt;
&lt;br /&gt;
* Move the new &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; to &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; amd move the &#039;&#039;.old&#039;&#039; files back in place:&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-key.pem foo/&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem.old sp-cert.pem&lt;br /&gt;
  root&amp;gt; mv sp-key.pem.old sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Check that &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; still have the owner and group &#039;&#039;&#039;shibd&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; ls -l /etc/shibboleth/foo/sp-*&lt;br /&gt;
  -rw-r--r-- 1 shibd shibd 1192 May  6 19:04 /etc/shibboleth/foo/sp-cert.pem&lt;br /&gt;
  -rw------- 1 shibd shibd 1708 May  6 19:04 /etc/shibboleth/foo/sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;metagen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.  You will ultimately need to send the output of this to the person managing the Shibboleth IdP server with which you want to register your EPrints repository as a service.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./metagen.sh -ALO -c foo/sp-cert.pem -h foo.eprints.org -e https://foo.eprints.org/shibboleth &amp;gt; foo/sp_metadata.xml&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039; foo/sp_metadata.xml&#039;&#039;&#039; to add in the namepace definitions by separately changing the &amp;lt;code&amp;gt;md:EntityDescriptor&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ds:KeyInfo&amp;lt;/code&amp;gt; lines as follows from:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor xmlns:md=&amp;quot;urn:oasis:names:tc:SAML:2.0:metadata&amp;quot; entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt; &lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo xmlns:ds=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;wget&#039;&#039; to download the metadata from your Shibboleth IdP (e.g. shib.foo.example.org) to the &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; directory.&lt;br /&gt;
  root&amp;gt; wget -O /etc/shibboleth/foo/idp-metadata.xml https://shib.foo.example.org/idp/shibboleth&lt;br /&gt;
&lt;br /&gt;
=== Using Remote IdP Metatdata ===&lt;br /&gt;
&lt;br /&gt;
As IdP Metadata may expire, you may want to use the remote metadata URL rather than a local copy.  This is what you need to do to switch to using remote IdP metadata:&lt;br /&gt;
&lt;br /&gt;
* Edit the &#039;&#039;&#039;MetadataProvider&#039;&#039;&#039; line to something like the following.  The reloadInterval is best set to 7200 but this can be set less frequently:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://shib.foo.example.org/idp/metadata.xml&amp;quot; backingFilePath=&amp;quot;foo/idp-metadata.xml&amp;quot; reloadInterval=&amp;quot;7200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure the reloadInterval is appropriate for the IdP metadata you are downloading.  If you have large metadata file,(e.g. from a federated metadata service containing metadata for other IdPs), then it may be better to set this higher than the default.  However, the configuration checker may warn you that your reload interval is too long, so you may have to choose to ignore this, if you want to avoid downloading a large federated metadata file too often.&lt;br /&gt;
&lt;br /&gt;
* Make sure that the directory &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and &#039;&#039;&#039;/etc/shibboleth/foo/idp-metadata.xml&#039;&#039;&#039; if it already exists) are owned by &#039;&#039;&#039;shibd&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/idp-metadata.xml&lt;br /&gt;
&lt;br /&gt;
* To test Shibboleth you will need to make sure your &#039;&#039;&#039;LD_LIBRARY_PATH&#039;&#039;&#039; is set the same as shibd would have when started using &#039;&#039;systemctl shibd start&#039;&#039;.  This should return the message: &#039;&#039;overall configuration is loadable, check console for non-fatal problems&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
 LD_LIBRARY_PATH=/opt/shibboleth/lib64:$LD_LIBRARY_PATH shibd -t&lt;br /&gt;
&lt;br /&gt;
* The above message is because it is now advised not to leave the MetadataGenerator enabled unnecessarily.  However, whilst you are setting up Shibboleth, it is useful to have the metadata generator, save you needing to build your own Service Provider metadata file to register with your Identity Provider.  Later on you can comment out the MetadataGenerator line to stop getting this warning message.&lt;br /&gt;
&lt;br /&gt;
* Now you can restart &#039;&#039;&#039;shibd&#039;&#039;&#039; properly:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart shibd&lt;br /&gt;
&lt;br /&gt;
== Configuring Apache and EPrints ==&lt;br /&gt;
&#039;&#039;&#039;N.B. All these actions should be carried out by the &#039;&#039;eprints&#039;&#039; user, except when prepended with &#039;&#039;root&amp;gt;&#039;&#039; which means the command should be run as the &#039;&#039;root&#039;&#039; user.&#039;&#039;&#039;&lt;br /&gt;
* Add the following configuration to your archive&#039;s &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039;, after the &#039;&#039;&#039;Include /opt/eprints3/cfg/apache_ssl/foo.conf&#039;&#039;&#039;, substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name where appropriate.  (This assumes you are running Apache 2.4 or greater).  See [[#Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration |Troubleshooting]] for instructions on the configuration to use for Apache 2.2. or lower.&lt;br /&gt;
&lt;br /&gt;
 Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
 &amp;lt;Location &amp;quot;/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   SetHandler perl-script&lt;br /&gt;
   PerlHandler ModPerl::Registry&lt;br /&gt;
   PerlSendHeader Off&lt;br /&gt;
   Options ExecCGI FollowSymLinks&lt;br /&gt;
 &lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy the following code into your archive (e.g. /opt/eprints3/archives/foo/) as &#039;&#039;&#039;cgi/shibboleth&#039;&#039;&#039;.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 my $session = new EPrints::Session;&lt;br /&gt;
 exit( 0 ) unless( defined $session );&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content_type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;html&amp;amp;gt;&amp;amp;lt;head/&amp;amp;gt;&amp;amp;lt;body&amp;amp;gt;&amp;amp;lt;code&amp;amp;gt;\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 foreach my $key (sort keys(%ENV)) {&lt;br /&gt;
   print &amp;quot;&amp;amp;lt;p&amp;amp;gt;$key = $ENV{$key}&amp;amp;lt;/p&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;/code&amp;amp;gt;&amp;amp;lt;/body&amp;amp;gt;&amp;amp;lt;/html&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 exit;&lt;br /&gt;
&lt;br /&gt;
* Now restart Shibboleth and Apache:&lt;br /&gt;
  root&amp;gt; systemctl restart shibd.service&lt;br /&gt;
  root&amp;gt; apachectl restart&lt;br /&gt;
&lt;br /&gt;
* In a web browser go the &#039;&#039;&#039;/cgi/shibboleth&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/cgi/shibboleth&#039;&#039;).  You should be redirected to an error page for your your Shibboleth IdP (e.g. &#039;&#039;https://shib.foo.example.org/idp/profile/SAML2/Redirect/SSO?...&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
* If instead you are displayed with a list of key values or are forbidden to access the page, you have not configured Apache properly, if so, see [[#Apache_Configuration_Issues|Apache_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].  If you see an error message like the one below, you have not set up Shibboleth properly, if so, see [[#Shibboleth_Configuration_Issues|Shibboleth_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
 opensaml::saml2md::MetadataException&lt;br /&gt;
 The system encountered an error at Wed May 6 15:19:27 2015&lt;br /&gt;
 To report this problem, please contact the site administrator at root@localhost.&lt;br /&gt;
 Please include the following message in any email:&lt;br /&gt;
 opensaml::saml2md::MetadataException at (http://foo.eprints.org/cgi/shibboleth)&lt;br /&gt;
 Unable to locate metadata for identity provider (https://shib.foo.example.org/idp/shibboleth)&lt;br /&gt;
&lt;br /&gt;
* Next, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;cfg/cfg.d/zz_shibboleth.pl&#039;&#039;&#039;.  This is needed to redirect login and logout to use Shibboleth rather than local login.&lt;br /&gt;
 $c-&amp;gt;{get_login_url} = sub {&lt;br /&gt;
   my( $session, $target ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   # preserve CGI params&lt;br /&gt;
   $session-&amp;gt;read_params;&lt;br /&gt;
   $target = $session-&amp;gt;get_url(&lt;br /&gt;
     host =&amp;gt; 1,&lt;br /&gt;
     path =&amp;gt; &amp;quot;auto&amp;quot;,&lt;br /&gt;
     query =&amp;gt; 1,&lt;br /&gt;
   );&lt;br /&gt;
 &lt;br /&gt;
   my $url = URI-&amp;gt;new( $session-&amp;gt;config( &amp;quot;https_url&amp;quot; )  . &amp;quot;/shibboleth/login&amp;quot; );&lt;br /&gt;
   $url-&amp;gt;query_form( target =&amp;gt; &amp;quot;$target&amp;quot; );&lt;br /&gt;
   return &amp;quot;$url&amp;quot;;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 $c-&amp;gt;{on_logout} = sub {&lt;br /&gt;
   my( $session ) = @_;&lt;br /&gt;
   my $query = $session-&amp;gt;query;&lt;br /&gt;
   return unless defined $query;&lt;br /&gt;
 &lt;br /&gt;
   # remove _shibsession_ cookie&lt;br /&gt;
   my( $shibname, $shibvalue );&lt;br /&gt;
   for( $query-&amp;gt;cookie() ) {&lt;br /&gt;
     if( $_ =~ /^_shibsession/ ) {&lt;br /&gt;
       $shibname = $_;&lt;br /&gt;
       $shibvalue = $query-&amp;gt;cookie( $shibname );&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   my $cookie = $query-&amp;gt;cookie(&lt;br /&gt;
     -name    =&amp;gt; $shibname,&lt;br /&gt;
     -path    =&amp;gt; &amp;quot;/&amp;quot;,&lt;br /&gt;
     -value   =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     -host  =&amp;gt; $session-&amp;gt;config(&amp;quot;cookie_domain&amp;quot;),&lt;br /&gt;
     -expires =&amp;gt; &amp;quot;-1d&amp;quot;,&lt;br /&gt;
   );&lt;br /&gt;
   EPrints::Apache::AnApache::header_out(&lt;br /&gt;
     $session-&amp;gt;{request},&lt;br /&gt;
     &amp;quot;Set-Cookie&amp;quot; =&amp;gt; $cookie &lt;br /&gt;
   );&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 push @{$c-&amp;gt;{rewrite_exceptions}}, &amp;quot;/shibboleth/&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
* Create a folder at the top level of your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) called &#039;&#039;&#039;shibboleth&#039;&#039;&#039; and copy the main CSS file for Shibboleth into this folder:&lt;br /&gt;
 eprints&amp;gt; mkdir /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
 eprints&amp;gt; cp /usr/share/shibboleth/main.css /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
&lt;br /&gt;
* Now, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;shibboleth/login&#039;&#039;&#039;.  This is the most basic login script that should work with the minimal attributes any Shibboleth IdP returns and &#039;&#039;&#039;only logging in users with existing accounts&#039;&#039;&#039;. Look under the [[#Customisation|Customisation]] section for advice on how to modify this script to meet your requirements, such as creation user accounts on-the-fly.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
   &lt;br /&gt;
 sub get_user &lt;br /&gt;
 {&lt;br /&gt;
   my ( $username, $email ) = ( undef, &amp;quot;&amp;quot; );&lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
    ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
    $username = lc( $username );&lt;br /&gt;
    $email = $ENV{eppn};&lt;br /&gt;
   }&lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username );&lt;br /&gt;
   if( defined $user &amp;amp;&amp;amp; defined $email )&lt;br /&gt;
   {&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
     $user-&amp;gt;commit;&lt;br /&gt;
   }&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Next, add the following markup to &#039;&#039;&#039;cfg/lang/en/static/account_required.xpage&#039;&#039;&#039; under your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;).  Substituting &#039;&#039;staff and students of the University of Foo&#039;&#039; to describe to which particular group of people logged in access is restricted.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&amp;quot;no&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE page SYSTEM &amp;quot;entities.dtd&amp;quot; &amp;gt;&lt;br /&gt;
 &amp;lt;xpage:page xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:xpage=&amp;quot;http://eprints.org/ep3/xpage&amp;quot; xmlns:epc=&amp;quot;http://eprints.org/ep3/control&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:title&amp;gt;Login Failed&amp;lt;/xpage:title&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:body&amp;gt;&lt;br /&gt;
    &amp;amp;lt;p style=&#039;text-align: center;&#039;&amp;amp;gt;Please note that only staff and students of the University of Foo may log in to &amp;lt;epc:phrase ref=&amp;quot;archive_name&amp;quot; /&amp;gt;&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:body&amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, reload Apache.&lt;br /&gt;
  root&amp;gt; apachectl reload&lt;br /&gt;
&lt;br /&gt;
* In a web browser go to the &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;).  Like before with &#039;&#039;/cgi/shibboleth&#039;&#039; you should be taken to your Shibboleth IdP&#039;s site albeit displaying an error message.&lt;br /&gt;
&lt;br /&gt;
* The Shibboleth IdP shows an error message because EPrints as a Shibboleth Service Provider is not yet registered with it.  To do this you need to send the administrator of the Shibboleth IdP the metadata for your Service Provider.  You will have generated this earlier when you ran &amp;lt;code&amp;gt;metagen.sh&amp;lt;/code&amp;gt;.  Copy off your EPrints server the file that this wrote (e.g. to &amp;lt;tt&amp;gt;/etc/shibboleth/foo/sp_metadata.xml&amp;lt;/tt&amp;gt;) and send it to the Shibboleth IdP administrator.  They should be able to upload this to register EPrints as a Service Provider application.&lt;br /&gt;
&lt;br /&gt;
* Once registered, use a web browser to go to &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;) again.  This time you should be prompted for a username and password on the Shibboleth IdP site. Once you have typed this in and clicked to login, you should be returned to EPrints on the &#039;&#039;&#039;/cgi/users/home&#039;&#039;&#039; page for your repository.  If not, see [[#Login_Issues|Login Issues]] under [[#Troubleshooting|Troubleshooting]] below.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Apache Configuration Issues ===&lt;br /&gt;
==== Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration ====&lt;br /&gt;
* Similarly to the instructions for Apache 2.4 and above, place the slightly different following configuration after the &#039;&#039;&#039;Include&#039;&#039;&#039; line for &#039;&#039;apache_ssl/foo.conf&#039;&#039;, (substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name):&lt;br /&gt;
&lt;br /&gt;
  Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/opt/eprints3/archives/foo/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
    SetHandler perl-script&lt;br /&gt;
    PerlHandler ModPerl::Registry&lt;br /&gt;
    PerlSendHeader Off&lt;br /&gt;
    Options ExecCGI FollowSymLinks&lt;br /&gt;
  &lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth Configuration Issues ===&lt;br /&gt;
==== With attribute-map.xml ====&lt;br /&gt;
When authenticating using Shibboleth to login to EPrints you may see the following line in &#039;&#039;&#039;/var/log/shibboleth.shibd.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  urn:mace:dir:attribute-def:department&lt;br /&gt;
&lt;br /&gt;
In some cases this might not be an issue, as EPrints does not necessarily to make use of all the attributes returned by the IdP but without a mapping in attribute-map.xml.  In this case &#039;&#039;&#039;urn:mace:dir:attribute-def:department&#039;&#039;&#039; is not by default needed by EPrints to create/update a user account.  However, values like &#039;&#039;&#039;sn&#039;&#039;&#039;, &#039;&#039;&#039;givenName&#039;&#039;&#039; and &#039;&#039;&#039;mail&#039;&#039;&#039; are but if you have used the attribute-map.xml provided later on the page you should not see a line like above in &#039;&#039;&#039;shibd.log&#039;&#039;&#039;.  In some cases you may still see an line like this in the log even if you think you have defined the attribute.  The line below demonstrate two known issues:&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  givenName, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:basic&lt;br /&gt;
&lt;br /&gt;
# The attribute itself has no namespace it is just &#039;&#039;&#039;&#039;givenName&#039;&#039;&#039; rather than &#039;&#039;&#039;urn:mace:dir:attribute-def:givenName&#039;&#039;&#039;&lt;br /&gt;
# The attribute has a format that most also be defined in the attribute-map.xml attribute.&lt;br /&gt;
&lt;br /&gt;
Below shows how to both include the format, which is required for the attribute to be successful mapped.  As well as define the name of the attribute without a namespace:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attribute name=&amp;quot;givenName&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical Shibboleth IdP would have both a namespaced attribute name and would not apply a format to an attribute that is a simple text string.  Therefore it is worth enquiring with the IdP provider if either of these two happen to be the case.&lt;br /&gt;
&lt;br /&gt;
==== With idp-metadata.xml ====&lt;br /&gt;
If you want to be able extract scoped attributes (e.g. &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; otherwise described as &#039;&#039;&#039;eppn&#039;&#039;&#039;).  Then you will need to ensure that the expected scope of this attribute, (effectively the domain part in eduPersonPrincipalName is the scope or one of the scopes in the idp-metadata.xml you downloaded from the Shibboleth IdP.  For example if the &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; is &#039;&#039;&#039;bar@foo.ac.uk&#039;&#039;&#039;.  Then the following should be defined in idp-metadata.xml (&#039;&#039;&#039;N.B. the namespace abbreviations (md: and shibmd:) may be different for the IdP you are working with&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;md:Extensions&amp;gt;&lt;br /&gt;
    &amp;lt;shibmd:Scope regexp=&amp;quot;false&amp;quot;&amp;gt;foo.ac.uk&amp;lt;/shibmd:Scope&amp;gt;&lt;br /&gt;
  &amp;lt;/md:Extensions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Login Issues ===&lt;br /&gt;
To be added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth /etc/shibboleth/foo/attribute-map.xml config ===&lt;br /&gt;
This is adapted from the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; provided when the Shibboleth SP package is installed to only include the attribute subsequently used by EPrints Shibboleth Perl script that can be found below.  Namely:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Field name&lt;br /&gt;
!Field description			&lt;br /&gt;
!SAML v1.1 attribute URN&lt;br /&gt;
!SAMLv2 attribute URN&lt;br /&gt;
|-&lt;br /&gt;
|eppn			&lt;br /&gt;
|Edu Person Principal Name&lt;br /&gt;
|urn:mace:dir:attribute-def:eduPersonPrincipalName&lt;br /&gt;
|urn:oid:1.3.6.1.4.1.5923.1.1.1.6&lt;br /&gt;
|-&lt;br /&gt;
|sn&lt;br /&gt;
|Surname						&lt;br /&gt;
|urn:mace:dir:attribute-def:sn								&lt;br /&gt;
|urn:oid:2.5.4.4&lt;br /&gt;
|-&lt;br /&gt;
|givenName&lt;br /&gt;
|Given (first) name(s)&lt;br /&gt;
|urn:mace:dir:attribute-def:givenName&lt;br /&gt;
|urn:oid:2.5.4.42&lt;br /&gt;
|-&lt;br /&gt;
|mail&lt;br /&gt;
|Email address	&lt;br /&gt;
|urn:mace:dir:attribute-def:mail&lt;br /&gt;
|urn:oid:0.9.2342.19200300.100.1.3  &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may wish to refer to the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; is you want to use other attributes.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attributes xmlns=&amp;quot;urn:mace:shibboleth:2.0:attribute-map&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:eduPersonPrincipalName&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:1.3.6.1.4.1.5923.1.1.1.6&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:sn&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:givenName&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:mail&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.4&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.42&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:0.9.2342.19200300.100.1.3&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/Attributes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EPrints /shibboleth/login script with user account creation ===&lt;br /&gt;
This is the standard EPrints Shibboleth login script.  It makes a number of assumptions:&lt;br /&gt;
# That accounts should be created if they do not already exist for a particular user.&lt;br /&gt;
# That you wish to create a standard user account (not an editor administrator) account.&lt;br /&gt;
# That the Shibboleth IdP provides all the attributes (eduPersonPrinicpalName (seen as eppn), sn, givenName and mail) required.&lt;br /&gt;
&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 &lt;br /&gt;
 sub get_user&lt;br /&gt;
 {&lt;br /&gt;
   my ($username, $given, $family, $email) = (undef, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
     ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
     $username = lc( $username );&lt;br /&gt;
   }&lt;br /&gt;
   $email = $ENV{mail} if $ENV{mail};&lt;br /&gt;
   if( $ENV{givenName} )&lt;br /&gt;
   {&lt;br /&gt;
     $given = lc( $ENV{givenName} );&lt;br /&gt;
     $given =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $given =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
   if( $ENV{sn} )&lt;br /&gt;
   {&lt;br /&gt;
     $family = lc( $ENV{sn} );&lt;br /&gt;
     $family =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $family =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
 &lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username ); # relying on this to be case insensitive&lt;br /&gt;
 &lt;br /&gt;
   if( !defined $user )&lt;br /&gt;
   {&lt;br /&gt;
     my $usertype = &#039;user&#039;;&lt;br /&gt;
     $user = EPrints::DataObj::User::create( $session, $usertype );&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;username&amp;quot;, $username );&lt;br /&gt;
   }&lt;br /&gt;
   my $name = {&lt;br /&gt;
     given =&amp;gt; $given,&lt;br /&gt;
     family =&amp;gt; $family,&lt;br /&gt;
   };&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;name&amp;quot;, $name );&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Further Information ==&lt;br /&gt;
* Older instructions of how to set up EPrints for Shibboleth using UK Access management Federation discovery service is available [[Shibboleth authentication|here]].&lt;br /&gt;
&lt;br /&gt;
* For general information about installing and configuring Shibboleth [http://shibboleth.internet2.edu/ click here].&lt;br /&gt;
&lt;br /&gt;
* [https://docs.openathens.net/display/public/TPA/Sign+in+to+a+generic+application+using+OpenAthens#SignintoagenericapplicationusingOpenAthens-SetupthecustomSAMLresourceinOpenAthens Instructions of connection a Shibboleth Service Provider with OpenAthens]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16710</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Shibboleth&amp;diff=16710"/>
		<updated>2025-01-21T14:19:49Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual}}&lt;br /&gt;
&#039;&#039;&#039;This page details how to install and integrate Shibboleth with EPrints 3.3.x or 3.4.x on a CentOS 7 operating system.&#039;&#039;&#039;  The process should be fairly similar for other comparable Red Hat based Linux distributions such as RHEL 7 and Fedora 21/22.  These instructions should also be generally application to later versions of RHEL-based Linux (e.g. Rocky Linux 8, Red Hat Enterprise Linux 9, etc.). However, they ma be somewhat different for Debian-based Linux, such as Ubuntu and Debian itself and other Linux distributions.  Typically, this will just be different package names and different commands to manage applications.&lt;br /&gt;
&lt;br /&gt;
Generally, it is a good idea to run EPrints with &#039;&#039;&#039;HTTPS&#039;&#039;&#039; when using Shibboleth authentication for increased security on the attributes being sent back by the Shibboleth Identity Provider (IdP).  Therefore, it is assumed that EPrints has already been set up to use HTTPS and there already exists an &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039; under the archive directory structure.&lt;br /&gt;
&lt;br /&gt;
== Installing Shibboleth ==&lt;br /&gt;
* First, add the Shibboleth repository to your list of YUM repositories (if you need this for a different RHEL-based Linux distribution fill in the form at https://shibboleth.net/downloads/service-provider/latest/RPMS/):&lt;br /&gt;
  root&amp;gt; wget -O /etc/yum.repos.d/shibboleth.repo https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7&lt;br /&gt;
&lt;br /&gt;
* Now you can use Yum to install all package dependencies:&lt;br /&gt;
  root&amp;gt; yum install log4shib opensaml shibboleth unixODBC xerces-c xml-security-c xmltooling &lt;br /&gt;
&lt;br /&gt;
* You may be prompted to accept the importing of the key for the Shibboleth repository, for which you should type &#039;&#039;&#039;y&#039;&#039;&#039; and press enter.&lt;br /&gt;
&lt;br /&gt;
* Once you have done that, test that &#039;&#039;&#039;shibd&#039;&#039;&#039; has no issues:&lt;br /&gt;
  root&amp;gt; LD_LIBRARY_PATH=/opt/shibboleth/lib64 shibd -t&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;shibd -t&#039;&#039; should return a couple of warning, like those listed below.  These are due to it not yet being configured.&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : insecure cookieProps setting, set to &amp;quot;https&amp;quot; for SSL/TLS-only usage&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : handlerSSL should be enabled for SSL/TLS-enabled web sites&lt;br /&gt;
  2015-05-11 10:39:01 WARN Shibboleth.Application : no MetadataProvider available, configure at least one for standard SSO usage&lt;br /&gt;
  overall configuration is loadable, check console for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
* If there are no other warning or error messages from &#039;&#039;shibd -t&#039;&#039;, you can start it properly and check to make sure it is running. You may also want ensure Shibboleth starts at boot using &#039;&#039;&#039;systemctl  enable&#039;&#039;&#039;&lt;br /&gt;
  root&amp;gt; systemctl start shibd.service&lt;br /&gt;
  root&amp;gt; ps aux | grep shib&lt;br /&gt;
  shibd    29338  0.4  0.7 419784 15024 ?        Ssl  11:16   0:00 /usr/sbin/shibd -p /var/run/shibboleth/shibd.pid -f -w 30&lt;br /&gt;
  root     29345  0.0  0.0 112640   940 pts/2    S+   11:17   0:00 grep --color=auto -i shib&lt;br /&gt;
  root&amp;gt; systemctl enable shibd.service&lt;br /&gt;
&lt;br /&gt;
== Configuring Shibboleth ==&lt;br /&gt;
* Replace &#039;&#039;&#039;/etc/shibboleth/shibboleth2.xml&#039;&#039;&#039; with the following.  Substitute &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; for the hostname of your EPrints repository, &#039;&#039;&#039;https://shib.foo.example.org/idp/shibboleth&#039;&#039;&#039; with the entity ID for you Shibboleth IdP and &#039;&#039;&#039;foo&#039;&#039;&#039; in the pathname of files with the name or your repository (e.g. &#039;&#039;foo/attribute-map.xml&#039;&#039; becomes &#039;&#039;myrepo/attribute-map.xml&#039;&#039;).  &#039;&#039;&#039;(This configuration is intended for Shibboleth SP version 2.x and is liable to cause deprecation warnings if  you have installed a recent version of Shibboleth from a package repository.  [[Shibboleth/3.x|Here is a default shibboleth2.xml configuration for Shibboleth 3.x]]).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;SPConfig xmlns=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    xmlns:conf=&amp;quot;urn:mace:shibboleth:3.0:native:sp:config&amp;quot;&lt;br /&gt;
    clockSkew=&amp;quot;180&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://foo.eprints.org/shibboleth&amp;quot;&lt;br /&gt;
                         REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
                         cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Sessions lifetime=&amp;quot;28800&amp;quot; timeout=&amp;quot;3600&amp;quot; relayState=&amp;quot;ss:mem&amp;quot; &lt;br /&gt;
                checkAddress=&amp;quot;false&amp;quot; handlerSSL=&amp;quot;true&amp;quot; cookieProps=&amp;quot;https&amp;quot;&lt;br /&gt;
                redirectLimit=&amp;quot;exact&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;SSO entityID=&amp;quot;https://shib.foo.example.org/idp/shibboleth&amp;quot;&amp;gt;SAML2&amp;lt;/SSO&amp;gt;&lt;br /&gt;
        &amp;lt;Logout&amp;gt;SAML2 Local&amp;lt;/Logout&amp;gt;&lt;br /&gt;
        &amp;lt;LogoutInitiator type=&amp;quot;Admin&amp;quot; Location=&amp;quot;/Logout/Admin&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Status&amp;quot; Location=&amp;quot;/Status&amp;quot; acl=&amp;quot;127.0.0.1 ::1&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;Session&amp;quot; Location=&amp;quot;/Session&amp;quot; showAttributeValues=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;Handler type=&amp;quot;DiscoveryFeed&amp;quot; Location=&amp;quot;/DiscoFeed&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Sessions&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;Errors supportContact=&amp;quot;root@localhost&amp;quot; helpLocation=&amp;quot;/about.html&amp;quot; styleSheet=&amp;quot;/shibboleth/main.css&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; path=&amp;quot;foo/idp-metadata.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeExtractor type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;foo/attribute-map.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeFilter type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;attribute-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;foo/sp-key.pem&amp;quot; certificate=&amp;quot;foo/sp-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;/ApplicationDefaults&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;SecurityPolicyProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; path=&amp;quot;security-policy.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ProtocolProvider type=&amp;quot;XML&amp;quot; validate=&amp;quot;true&amp;quot; reloadChanges=&amp;quot;false&amp;quot; path=&amp;quot;protocols.xml&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/SPConfig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create the directory &#039;&#039;&#039;/etc/shibboleth/foo&#039;&#039;&#039;, substituting &#039;&#039;foo&#039;&#039; for your repository name.&lt;br /&gt;
  root&amp;gt; mkdir /etc/shibboleth/foo&lt;br /&gt;
&lt;br /&gt;
* Copy &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; into this new directory.&lt;br /&gt;
  cp /etc/shibboleth/attribute-map.xml /etc/shibboleth/foo/&lt;br /&gt;
&lt;br /&gt;
* Temporarily rename &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; to &#039;&#039;&#039;sp-cert.pem.old&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem.old&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-cert.pem.old&lt;br /&gt;
  root&amp;gt; mv sp-key.pem sp-key.pem.old&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;keygen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./keygen.sh -f -h foo.eprints.org -e https://foo.eprints.org/shibboleth&lt;br /&gt;
&lt;br /&gt;
* Move the new &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; to &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; amd move the &#039;&#039;.old&#039;&#039; files back in place:&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem sp-key.pem foo/&lt;br /&gt;
  root&amp;gt; mv sp-cert.pem.old sp-cert.pem&lt;br /&gt;
  root&amp;gt; mv sp-key.pem.old sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Check that &#039;&#039;&#039;sp-cert.pem&#039;&#039;&#039; and &#039;&#039;&#039;sp-key.pem&#039;&#039;&#039; in &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; still have the owner and group &#039;&#039;&#039;shibd&#039;&#039;&#039;.&lt;br /&gt;
  root&amp;gt; ls -l /etc/shibboleth/foo/sp-*&lt;br /&gt;
  -rw-r--r-- 1 shibd shibd 1192 May  6 19:04 /etc/shibboleth/foo/sp-cert.pem&lt;br /&gt;
  -rw------- 1 shibd shibd 1708 May  6 19:04 /etc/shibboleth/foo/sp-key.pem&lt;br /&gt;
&lt;br /&gt;
* Run &#039;&#039;&#039;metagen.sh&#039;&#039;&#039; from the &#039;&#039;&#039;/etc/shibboleth/&#039;&#039;&#039; directory, as follows replacing &#039;&#039;&#039;foo.eprints.org&#039;&#039;&#039; with your EPrints repository hostname.  You will ultimately need to send the output of this to the person managing the Shibboleth IdP server with which you want to register your EPrints repository as a service.&lt;br /&gt;
  root&amp;gt; cd /etc/shibboleth&lt;br /&gt;
  root&amp;gt; ./metagen.sh -ALO -c foo/sp-cert.pem -h foo.eprints.org -e https://foo.eprints.org/shibboleth &amp;gt; foo/sp_metadata.xml&lt;br /&gt;
&lt;br /&gt;
* Modify &#039;&#039;&#039; foo/sp_metadata.xml&#039;&#039;&#039; to add in the namepace definitions by separately changing the &amp;lt;code&amp;gt;md:EntityDescriptor&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ds:KeyInfo&amp;lt;/code&amp;gt; lines as follows from:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
 &amp;lt;md:EntityDescriptor xmlns:md=&amp;quot;urn:oasis:names:tc:SAML:2.0:metadata&amp;quot; entityID=&amp;quot;https://for.eprints.org/shibboleth&amp;quot;&amp;gt; &lt;br /&gt;
   ...&lt;br /&gt;
     ...&lt;br /&gt;
       &amp;lt;ds:KeyInfo xmlns:ds=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;wget&#039;&#039; to download the metadata from your Shibboleth IdP (e.g. shib.foo.example.org) to the &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; directory.&lt;br /&gt;
  root&amp;gt; wget -O /etc/shibboleth/foo/idp-metadata.xml https://shib.foo.example.org/idp/shibboleth&lt;br /&gt;
&lt;br /&gt;
=== Using Remote IdP Metatdata ===&lt;br /&gt;
&lt;br /&gt;
As IdP Metadata may expire, you may want to use the remote metadata URL rather than a local copy.  This is what you need to do to switch to using remote IdP metadata:&lt;br /&gt;
&lt;br /&gt;
* Edit the &#039;&#039;&#039;MetadataProvider&#039;&#039;&#039; line to something like the following.  The reloadInterval is best set to 7200 but this can be set less frequently:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://shib.foo.example.org/idp/metadata.xml&amp;quot; backingFilePath=&amp;quot;foo/idp-metadata.xml&amp;quot; reloadInterval=&amp;quot;7200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure the reloadInterval is appropriate for the IdP metadata you are downloading.  If you have large metadata file,(e.g. from a federated metadata service containing metadata for other IdPs), then it may be better to set this higher than the default.  However, the configuration checker may warn you that your reload interval is too long, so you may have to choose to ignore this, if you want to avoid downloading a large federated metadata file too often.&lt;br /&gt;
&lt;br /&gt;
* Make sure that the directory &#039;&#039;&#039;/etc/shibboleth/foo/&#039;&#039;&#039; and &#039;&#039;&#039;/etc/shibboleth/foo/idp-metadata.xml&#039;&#039;&#039; if it already exists) are owned by &#039;&#039;&#039;shibd&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/&lt;br /&gt;
 chown shibd:shibd /etc/shibboleth/foo/idp-metadata.xml&lt;br /&gt;
&lt;br /&gt;
* To test Shibboleth you will need to make sure your &#039;&#039;&#039;LD_LIBRARY_PATH&#039;&#039;&#039; is set the same as shibd would have when started using &#039;&#039;systemctl shibd start&#039;&#039;.  This should return the message: &#039;&#039;overall configuration is loadable, check console for non-fatal problems&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
 LD_LIBRARY_PATH=/opt/shibboleth/lib64:$LD_LIBRARY_PATH shibd -t&lt;br /&gt;
&lt;br /&gt;
* The above message is because it is now advised not to leave the MetadataGenerator enabled unnecessarily.  However, whilst you are setting up Shibboleth, it is useful to have the metadata generator, save you needing to build your own Service Provider metadata file to register with your Identity Provider.  Later on you can comment out the MetadataGenerator line to stop getting this warning message.&lt;br /&gt;
&lt;br /&gt;
* Now you can restart &#039;&#039;&#039;shibd&#039;&#039;&#039; properly:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart shibd&lt;br /&gt;
&lt;br /&gt;
== Configuring Apache and EPrints ==&lt;br /&gt;
&#039;&#039;&#039;N.B. All these actions should be carried out by the &#039;&#039;eprints&#039;&#039; user, except when prepended with &#039;&#039;root&amp;gt;&#039;&#039; which means the command should be run as the &#039;&#039;root&#039;&#039; user.&#039;&#039;&#039;&lt;br /&gt;
* Add the following configuration to your archive&#039;s &#039;&#039;&#039;ssl/securevhost.conf&#039;&#039;&#039;, after the &#039;&#039;&#039;Include /opt/eprints3/cfg/apache_ssl/foo.conf&#039;&#039;&#039;, substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name where appropriate.  (This assumes you are running Apache 2.4 or greater).  See [[#Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration |Troubleshooting]] for instructions on the configuration to use for Apache 2.2. or lower.&lt;br /&gt;
&lt;br /&gt;
 Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
 &amp;lt;Location &amp;quot;/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
   SetHandler perl-script&lt;br /&gt;
   PerlHandler ModPerl::Registry&lt;br /&gt;
   PerlSendHeader Off&lt;br /&gt;
   Options ExecCGI FollowSymLinks&lt;br /&gt;
 &lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
   AuthType shibboleth&lt;br /&gt;
   ShibRequestSetting requireSession 1&lt;br /&gt;
   require shib-session&lt;br /&gt;
 &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy the following code into your archive (e.g. /opt/eprints3/archives/foo/) as &#039;&#039;&#039;cgi/shibboleth&#039;&#039;&#039;.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 my $session = new EPrints::Session;&lt;br /&gt;
 exit( 0 ) unless( defined $session );&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content_type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;html&amp;amp;gt;&amp;amp;lt;head/&amp;amp;gt;&amp;amp;lt;body&amp;amp;gt;&amp;amp;lt;code&amp;amp;gt;\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 foreach my $key (sort keys(%ENV)) {&lt;br /&gt;
   print &amp;quot;&amp;amp;lt;p&amp;amp;gt;$key = $ENV{$key}&amp;amp;lt;/p&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 print &amp;quot;&amp;amp;lt;/code&amp;amp;gt;&amp;amp;lt;/body&amp;amp;gt;&amp;amp;lt;/html&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 exit;&lt;br /&gt;
&lt;br /&gt;
* Now restart Shibboleth and Apache:&lt;br /&gt;
  root&amp;gt; systemctl restart shibd.service&lt;br /&gt;
  root&amp;gt; apachectl restart&lt;br /&gt;
&lt;br /&gt;
* In a web browser go the &#039;&#039;&#039;/cgi/shibboleth&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/cgi/shibboleth&#039;&#039;).  You should be redirected to an error page for your your Shibboleth IdP (e.g. &#039;&#039;https://shib.foo.example.org/idp/profile/SAML2/Redirect/SSO?...&#039;&#039;).  &lt;br /&gt;
&lt;br /&gt;
* If instead you are displayed with a list of key values or are forbidden to access the page, you have not configured Apache properly, if so, see [[#Apache_Configuration_Issues|Apache_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].  If you see an error message like the one below, you have not set up Shibboleth properly, if so, see [[#Shibboleth_Configuration_Issues|Shibboleth_Configuration_Issues]] under [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
 opensaml::saml2md::MetadataException&lt;br /&gt;
 The system encountered an error at Wed May 6 15:19:27 2015&lt;br /&gt;
 To report this problem, please contact the site administrator at root@localhost.&lt;br /&gt;
 Please include the following message in any email:&lt;br /&gt;
 opensaml::saml2md::MetadataException at (http://foo.eprints.org/cgi/shibboleth)&lt;br /&gt;
 Unable to locate metadata for identity provider (https://shib.foo.example.org/idp/shibboleth)&lt;br /&gt;
&lt;br /&gt;
* Next, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;cfg/cfg.d/zz_shibboleth.pl&#039;&#039;&#039;.  This is needed to redirect login and logout to use Shibboleth rather than local login.&lt;br /&gt;
 $c-&amp;gt;{get_login_url} = sub {&lt;br /&gt;
   my( $session, $target ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   # preserve CGI params&lt;br /&gt;
   $session-&amp;gt;read_params;&lt;br /&gt;
   $target = $session-&amp;gt;get_url(&lt;br /&gt;
     host =&amp;gt; 1,&lt;br /&gt;
     path =&amp;gt; &amp;quot;auto&amp;quot;,&lt;br /&gt;
     query =&amp;gt; 1,&lt;br /&gt;
   );&lt;br /&gt;
 &lt;br /&gt;
   my $url = URI-&amp;gt;new( $session-&amp;gt;config( &amp;quot;https_url&amp;quot; )  . &amp;quot;/shibboleth/login&amp;quot; );&lt;br /&gt;
   $url-&amp;gt;query_form( target =&amp;gt; &amp;quot;$target&amp;quot; );&lt;br /&gt;
   return &amp;quot;$url&amp;quot;;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 $c-&amp;gt;{on_logout} = sub {&lt;br /&gt;
   my( $session ) = @_;&lt;br /&gt;
   my $query = $session-&amp;gt;query;&lt;br /&gt;
   return unless defined $query;&lt;br /&gt;
 &lt;br /&gt;
   # remove _shibsession_ cookie&lt;br /&gt;
   my( $shibname, $shibvalue );&lt;br /&gt;
   for( $query-&amp;gt;cookie() ) {&lt;br /&gt;
     if( $_ =~ /^_shibsession/ ) {&lt;br /&gt;
       $shibname = $_;&lt;br /&gt;
       $shibvalue = $query-&amp;gt;cookie( $shibname );&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   my $cookie = $query-&amp;gt;cookie(&lt;br /&gt;
     -name    =&amp;gt; $shibname,&lt;br /&gt;
     -path    =&amp;gt; &amp;quot;/&amp;quot;,&lt;br /&gt;
     -value   =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     -host  =&amp;gt; $session-&amp;gt;config(&amp;quot;cookie_domain&amp;quot;),&lt;br /&gt;
     -expires =&amp;gt; &amp;quot;-1d&amp;quot;,&lt;br /&gt;
   );&lt;br /&gt;
   EPrints::Apache::AnApache::header_out(&lt;br /&gt;
     $session-&amp;gt;{request},&lt;br /&gt;
     &amp;quot;Set-Cookie&amp;quot; =&amp;gt; $cookie &lt;br /&gt;
   );&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 push @{$c-&amp;gt;{rewrite_exceptions}}, &amp;quot;/shibboleth/&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
* Create a folder at the top level of your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) called &#039;&#039;&#039;shibboleth&#039;&#039;&#039; and copy the main CSS file for Shibboleth into this folder:&lt;br /&gt;
 eprints&amp;gt; mkdir /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
 eprints&amp;gt; cp /usr/share/shibboleth/main.css /opt/eprints3/archives/foo/shibboleth/&lt;br /&gt;
&lt;br /&gt;
* Now, copy the following code into your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;) as &#039;&#039;&#039;shibboleth/login&#039;&#039;&#039;.  This is the most basic login script that should work with the minimal attributes any Shibboleth IdP returns and &#039;&#039;&#039;only logging in users with existing accounts&#039;&#039;&#039;. Look under the [[#Customisation|Customisation]] section for advice on how to modify this script to meet your requirements, such as creation user accounts on-the-fly.&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
   &lt;br /&gt;
 sub get_user &lt;br /&gt;
 {&lt;br /&gt;
   my ( $username, $email ) = ( undef, &amp;quot;&amp;quot; );&lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
    ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
    $username = lc( $username );&lt;br /&gt;
    $email = $ENV{eppn};&lt;br /&gt;
   }&lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username );&lt;br /&gt;
   if( defined $user &amp;amp;&amp;amp; defined $email )&lt;br /&gt;
   {&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
     $user-&amp;gt;commit;&lt;br /&gt;
   }&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Next, add the following markup to &#039;&#039;&#039;cfg/lang/en/static/account_required.xpage&#039;&#039;&#039; under your archive (e.g. &#039;&#039;/opt/eprints3/archives/foo/&#039;&#039;).  Substituting &#039;&#039;staff and students of the University of Foo&#039;&#039; to describe to which particular group of people logged in access is restricted.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&amp;quot;no&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE page SYSTEM &amp;quot;entities.dtd&amp;quot; &amp;gt;&lt;br /&gt;
 &amp;lt;xpage:page xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:xpage=&amp;quot;http://eprints.org/ep3/xpage&amp;quot; xmlns:epc=&amp;quot;http://eprints.org/ep3/control&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:title&amp;gt;Login Failed&amp;lt;/xpage:title&amp;gt;&lt;br /&gt;
 &amp;lt;xpage:body&amp;gt;&lt;br /&gt;
    &amp;amp;lt;p style=&#039;text-align: center;&#039;&amp;amp;gt;Please note that only staff and students of the University of Foo may log in to &amp;lt;epc:phrase ref=&amp;quot;archive_name&amp;quot; /&amp;gt;&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:body&amp;gt;&lt;br /&gt;
 &amp;lt;/xpage:page&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, reload Apache.&lt;br /&gt;
  root&amp;gt; apachectl reload&lt;br /&gt;
&lt;br /&gt;
* In a web browser go to the &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;).  Like before with &#039;&#039;/cgi/shibboleth&#039;&#039; you should be taken to your Shibboleth IdP&#039;s site albeit displaying an error message.&lt;br /&gt;
&lt;br /&gt;
* The Shibboleth IdP shows an error message because EPrints as a Shibboleth Service Provider is not yet registered with it.  To do this you need to send the administrator of the Shibboleth IdP the metadata for your Service Provider.  You will have generated this earlier when you ran &amp;lt;code&amp;gt;metagen.sh&amp;lt;/code&amp;gt;.  Copy off your EPrints server the file that this wrote (e.g. to &amp;lt;tt&amp;gt;/etc/shibboleth/foo/sp_metadata.xml&amp;lt;/tt&amp;gt;) and send it to the Shibboleth IdP administrator.  They should be able to upload this to register EPrints as a Service Provider application.&lt;br /&gt;
&lt;br /&gt;
* Once registered, use a web browser to go to &#039;&#039;&#039;/shibboleth/login&#039;&#039;&#039; page for your repository, (e.g. &#039;&#039;https://foo.eprints.org/shibboleth/login&#039;&#039;) again.  This time you should be prompted for a username and password on the Shibboleth IdP site. Once you have typed this in and clicked to login, you should be returned to EPrints on the &#039;&#039;&#039;/cgi/users/home&#039;&#039;&#039; page for your repository.  If not, see [[#Login_Issues|Login Issues]] under [[#Troubleshooting|Troubleshooting]] below.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Apache Configuration Issues ===&lt;br /&gt;
==== Apache 2.2 (and lower) Configuration for EPrints Shibboleth Integration ====&lt;br /&gt;
* Similarly to the instructions for Apache 2.4 and above, place the slightly different following configuration after the &#039;&#039;&#039;Include&#039;&#039;&#039; line for &#039;&#039;apache_ssl/foo.conf&#039;&#039;, (substituting &#039;&#039;&#039;foo&#039;&#039;&#039; for your archive&#039;s name):&lt;br /&gt;
&lt;br /&gt;
  Alias /shibboleth /opt/eprints3/archives/foo/shibboleth&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/opt/eprints3/archives/foo/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
    SetHandler perl-script&lt;br /&gt;
    PerlHandler ModPerl::Registry&lt;br /&gt;
    PerlSendHeader Off&lt;br /&gt;
    Options ExecCGI FollowSymLinks&lt;br /&gt;
  &lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Location /cgi/shibboleth&amp;gt;&lt;br /&gt;
    AuthType shibboleth&lt;br /&gt;
    ShibRequireSession On&lt;br /&gt;
    require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth Configuration Issues ===&lt;br /&gt;
==== With attribute-map.xml ====&lt;br /&gt;
When authenticating using Shibboleth to login to EPrints you may see the following line in &#039;&#039;&#039;/var/log/shibboleth.shibd.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  urn:mace:dir:attribute-def:department&lt;br /&gt;
&lt;br /&gt;
In some cases this might not be an issue, as EPrints does not necessarily to make use of all the attributes returned by the IdP but without a mapping in attribute-map.xml.  In this case &#039;&#039;&#039;urn:mace:dir:attribute-def:department&#039;&#039;&#039; is not by default needed by EPrints to create/update a user account.  However, values like &#039;&#039;&#039;sn&#039;&#039;&#039;, &#039;&#039;&#039;givenName&#039;&#039;&#039; and &#039;&#039;&#039;mail&#039;&#039;&#039; are but if you have used the attribute-map.xml provided later on the page you should not see a line like above in &#039;&#039;&#039;shibd.log&#039;&#039;&#039;.  In some cases you may still see an line like this in the log even if you think you have defined the attribute.  The line below demonstrate two known issues:&lt;br /&gt;
&lt;br /&gt;
  2015-09-09 09:26:43 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name:  givenName, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:basic&lt;br /&gt;
&lt;br /&gt;
# The attribute itself has no namespace it is just &#039;&#039;&#039;&#039;givenName&#039;&#039;&#039; rather than &#039;&#039;&#039;urn:mace:dir:attribute-def:givenName&#039;&#039;&#039;&lt;br /&gt;
# The attribute has a format that most also be defined in the attribute-map.xml attribute.&lt;br /&gt;
&lt;br /&gt;
Below shows how to both include the format, which is required for the attribute to be successful mapped.  As well as define the name of the attribute without a namespace:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attribute name=&amp;quot;givenName&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical Shibboleth IdP would have both a namespaced attribute name and would not apply a format to an attribute that is a simple text string.  Therefore it is worth enquiring with the IdP provider if either of these two happen to be the case.&lt;br /&gt;
&lt;br /&gt;
==== With idp-metadata.xml ====&lt;br /&gt;
If you want to be able extract scoped attributes (e.g. &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; otherwise described as &#039;&#039;&#039;eppn&#039;&#039;&#039;).  Then you will need to ensure that the expected scope of this attribute, (effectively the domain part in eduPersonPrincipalName is the scope or one of the scopes in the idp-metadata.xml you downloaded from the Shibboleth IdP.  For example if the &#039;&#039;&#039;eduPersonPrincipalName&#039;&#039;&#039; is &#039;&#039;&#039;bar@foo.ac.uk&#039;&#039;&#039;.  Then the following should be defined in idp-metadata.xml (&#039;&#039;&#039;N.B. the namespace abbreviations (md: and shibmd:) may be different for the IdP you are working with&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;md:Extensions&amp;gt;&lt;br /&gt;
    &amp;lt;shibmd:Scope regexp=&amp;quot;false&amp;quot;&amp;gt;foo.ac.uk&amp;lt;/shibmd:Scope&amp;gt;&lt;br /&gt;
  &amp;lt;/md:Extensions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Login Issues ===&lt;br /&gt;
To be added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
=== Shibboleth /etc/shibboleth/foo/attribute-map.xml config ===&lt;br /&gt;
This is adapted from the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; provided when the Shibboleth SP package is installed to only include the attribute subsequently used by EPrints Shibboleth Perl script that can be found below.  Namely:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!Field name&lt;br /&gt;
!Field description			&lt;br /&gt;
!SAML v1.1 attribute URN&lt;br /&gt;
!SAMLv2 attribute URN&lt;br /&gt;
|-&lt;br /&gt;
|eppn			&lt;br /&gt;
|Edu Person Principal Name&lt;br /&gt;
|urn:mace:dir:attribute-def:eduPersonPrincipalName&lt;br /&gt;
|urn:oid:1.3.6.1.4.1.5923.1.1.1.6&lt;br /&gt;
|-&lt;br /&gt;
|sn&lt;br /&gt;
|Surname						&lt;br /&gt;
|urn:mace:dir:attribute-def:sn								&lt;br /&gt;
|urn:oid:2.5.4.4&lt;br /&gt;
|-&lt;br /&gt;
|givenName&lt;br /&gt;
|Given (first) name(s)&lt;br /&gt;
|urn:mace:dir:attribute-def:givenName&lt;br /&gt;
|urn:oid:2.5.4.42&lt;br /&gt;
|-&lt;br /&gt;
|mail&lt;br /&gt;
|Email address	&lt;br /&gt;
|urn:mace:dir:attribute-def:mail&lt;br /&gt;
|urn:oid:0.9.2342.19200300.100.1.3  &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may wish to refer to the default &#039;&#039;&#039;attribute-map.xml&#039;&#039;&#039; is you want to use other attributes.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Attributes xmlns=&amp;quot;urn:mace:shibboleth:2.0:attribute-map&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:eduPersonPrincipalName&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:1.3.6.1.4.1.5923.1.1.1.6&amp;quot; id=&amp;quot;eppn&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;AttributeDecoder xsi:type=&amp;quot;ScopedAttributeDecoder&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:sn&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:givenName&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:mace:dir:attribute-def:mail&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.4&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;sn&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:2.5.4.42&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;givenName&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Attribute name=&amp;quot;urn:oid:0.9.2342.19200300.100.1.3&amp;quot; nameFormat=&amp;quot;urn:oasis:names:tc:SAML:2.0:attrname-format:basic&amp;quot; id=&amp;quot;mail&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/Attributes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== EPrints /shibboleth/login script with user account creation ===&lt;br /&gt;
This is the standard EPrints Shibboleth login script.  It makes a number of assumptions:&lt;br /&gt;
# That accounts should be created if they do not already exist for a particular user.&lt;br /&gt;
# That you wish to create a standard user account (not an editor administrator) account.&lt;br /&gt;
# That the Shibboleth IdP provides all the attributes (eduPersonPrinicpalName (seen as eppn), sn, givenName and mail) required.&lt;br /&gt;
&lt;br /&gt;
 use EPrints;&lt;br /&gt;
 use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $session = EPrints::Session-&amp;gt;new();&lt;br /&gt;
 my $url = $session-&amp;gt;param( &amp;quot;target&amp;quot; );&lt;br /&gt;
 if ( defined $url )&lt;br /&gt;
 {&lt;br /&gt;
   my $target_uri = URI-&amp;gt;new( $url );&lt;br /&gt;
   my $repository_uri = URI-&amp;gt;new( $session-&amp;gt;get_repository-&amp;gt;get_conf( &#039;base_url&#039; ) );&lt;br /&gt;
   if ( !$target_uri-&amp;gt;can( &#039;host&#039; ) || $target_uri-&amp;gt;host ne $repository_uri-&amp;gt;host )&lt;br /&gt;
   {&lt;br /&gt;
     $url = undef;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;userhome&amp;quot; ) unless EPrints::Utils::is_set( $url );&lt;br /&gt;
 &lt;br /&gt;
 my $user = &amp;amp;get_user;&lt;br /&gt;
 &lt;br /&gt;
 if( defined $user )&lt;br /&gt;
 {&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;last_login&amp;quot;, EPrints::Time::get_iso_timestamp() );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
 &lt;br /&gt;
   EPrints::DataObj::LoginTicket-&amp;gt;expire_all( $session );&lt;br /&gt;
   $session-&amp;gt;dataset( &amp;quot;loginticket&amp;quot; )-&amp;gt;create_dataobj({&lt;br /&gt;
     userid =&amp;gt; $user-&amp;gt;id,&lt;br /&gt;
   })-&amp;gt;set_cookies();&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   $url = $session-&amp;gt;get_repository-&amp;gt;get_conf( &amp;quot;base_url&amp;quot; ) . &amp;quot;/account_required.html&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $session-&amp;gt;send_http_header( &amp;quot;content-type&amp;quot; =&amp;gt; &amp;quot;text/html&amp;quot; );&lt;br /&gt;
 print &#039;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;url=&#039;.$url.&#039;&amp;quot;/&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#039;;&lt;br /&gt;
 $session-&amp;gt;terminate;&lt;br /&gt;
 &lt;br /&gt;
 sub get_user&lt;br /&gt;
 {&lt;br /&gt;
   my ($username, $given, $family, $email) = (undef, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
   if( $ENV{eppn} )&lt;br /&gt;
   {&lt;br /&gt;
     ( $username ) = split( /@/, $ENV{eppn}, 2);&lt;br /&gt;
     $username = lc( $username );&lt;br /&gt;
   }&lt;br /&gt;
   $email = $ENV{mail} if $ENV{mail};&lt;br /&gt;
   if( $ENV{givenName} )&lt;br /&gt;
   {&lt;br /&gt;
     $given = lc( $ENV{givenName} );&lt;br /&gt;
     $given =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $given =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
   if( $ENV{sn} )&lt;br /&gt;
   {&lt;br /&gt;
     $family = lc( $ENV{sn} );&lt;br /&gt;
     $family =~ s/^(.)/uc($1)/e;&lt;br /&gt;
     $family =~ s/([- ].)/uc($1)/e;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return unless EPrints::Utils::is_set( $username );&lt;br /&gt;
 &lt;br /&gt;
   my $user = $session-&amp;gt;user_by_username( $username ); # relying on this to be case insensitive&lt;br /&gt;
 &lt;br /&gt;
   if( !defined $user )&lt;br /&gt;
   {&lt;br /&gt;
     my $usertype = &#039;user&#039;;&lt;br /&gt;
     $user = EPrints::DataObj::User::create( $session, $usertype );&lt;br /&gt;
     $user-&amp;gt;set_value( &amp;quot;username&amp;quot;, $username );&lt;br /&gt;
   }&lt;br /&gt;
   my $name = {&lt;br /&gt;
     given =&amp;gt; $given,&lt;br /&gt;
     family =&amp;gt; $family,&lt;br /&gt;
   };&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;name&amp;quot;, $name );&lt;br /&gt;
   $user-&amp;gt;set_value( &amp;quot;email&amp;quot;, $email );&lt;br /&gt;
   $user-&amp;gt;commit;&lt;br /&gt;
   return $user;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Further Information ==&lt;br /&gt;
* Older instructions of how to set up EPrints for Shibboleth using UK Access management Federation discovery service is available [[Shibboleth authentication|here]].&lt;br /&gt;
&lt;br /&gt;
* For general information about installing and configuring Shibboleth [http://shibboleth.internet2.edu/ click here].&lt;br /&gt;
&lt;br /&gt;
* [https://docs.openathens.net/display/public/TPA/Sign+in+to+a+generic+application+using+OpenAthens#SignintoagenericapplicationusingOpenAthens-SetupthecustomSAMLresourceinOpenAthens Instructions of connection a Shibboleth Service Provider with OpenAthens]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=How_to_configure_DKIM_email_verification_(using_sendmail_on_Rocky9)&amp;diff=16523</id>
		<title>How to configure DKIM email verification (using sendmail on Rocky9)</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=How_to_configure_DKIM_email_verification_(using_sendmail_on_Rocky9)&amp;diff=16523"/>
		<updated>2024-07-25T08:28:59Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
These instructions have been tested on CentOS7 and Rocky9 both of which using sendmail (not postfix). You will likely be able to adapt these instructions fairly easily to suit your operating system and mail transfer program.&lt;br /&gt;
&lt;br /&gt;
== Steps ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As eprints user&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Create a directory to store the keys&lt;br /&gt;
&lt;br /&gt;
 mkdir /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As root user&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Install the opendkim libraries&lt;br /&gt;
&lt;br /&gt;
 dnf install opendkim opendkim-tools&lt;br /&gt;
&lt;br /&gt;
2. Open the opendkim config file and change the following lines&lt;br /&gt;
&lt;br /&gt;
 vim /etc/opendkim.conf&lt;br /&gt;
&lt;br /&gt;
2. a. Change &lt;br /&gt;
&lt;br /&gt;
 Mode V &lt;br /&gt;
to &lt;br /&gt;
 Mode sv&lt;br /&gt;
&lt;br /&gt;
2. b. Remove comments from the following lines:&lt;br /&gt;
&lt;br /&gt;
 KeyTable                /etc/opendkim/KeyTable&lt;br /&gt;
 SigningTable            refile:/etc/opendkim/SigningTable&lt;br /&gt;
 ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts&lt;br /&gt;
 InternalHosts           refile:/etc/opendkim/TrustedHosts&lt;br /&gt;
&lt;br /&gt;
2. c. Add the following lines (the DOMAIN is the domain which our server sending email on behalf of)&lt;br /&gt;
&lt;br /&gt;
 Domain &amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
 RequireSafeKeys False&lt;br /&gt;
&lt;br /&gt;
2. d. Replace the Socket declaration with the following line (it should be commented out above the declaration being used)&lt;br /&gt;
&lt;br /&gt;
 Socket  inet:8891@localhost&lt;br /&gt;
&lt;br /&gt;
3. Modify /etc/opendkim/KeyTable, to add the following line&lt;br /&gt;
&lt;br /&gt;
 default._domainkey.&amp;lt;DOMAIN&amp;gt; &amp;lt;DOMAIN&amp;gt;:default:/opt/eprints3/archives/&amp;lt;REPOID&amp;gt;/dkim/default.private&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; `default._domainkey.eprints-hosting.org eprints-hosting.org:default:/opt/eprints3/archives/repoid/dkim/default.private`&lt;br /&gt;
&lt;br /&gt;
4. Modify /etc/opendkim/SigningTable, to add the following line&lt;br /&gt;
&lt;br /&gt;
 *@&amp;lt;DOMAIN&amp;gt; default._domainkey.&amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; `*@eprints-hosting.org default._domainkey.eprints-hosting.org`&lt;br /&gt;
&lt;br /&gt;
5. Modify /etc/opendkim/TrustedHosts, to add the following line&lt;br /&gt;
&lt;br /&gt;
 *.&amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; *.eprints-hosting.org&lt;br /&gt;
&lt;br /&gt;
6. Generate the keypair&lt;br /&gt;
&lt;br /&gt;
 sudo opendkim-genkey -b 1024 -d &amp;lt;DOMAIN&amp;gt; -D /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim&amp;lt;DOMAIN&amp;gt; -s default -v&lt;br /&gt;
&lt;br /&gt;
7. Change ownership and permissions&lt;br /&gt;
&lt;br /&gt;
 sudo chown opendkim:opendkim /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim/* -R&lt;br /&gt;
 sudo chmod 660 /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim/*&lt;br /&gt;
&lt;br /&gt;
8. Send the txt public key to whoever has access to the DNS records, probably their IT team&lt;br /&gt;
&lt;br /&gt;
 cat /etc/opendkim/keys/&amp;lt;DOMAIN&amp;gt;/default.txt&lt;br /&gt;
&lt;br /&gt;
It should look something like this.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;v=DKIM1; k=rsa; &amp;quot; &amp;quot;p=REALLY-LONG-HASH-VALUE/HASH-VALUE/HASH-VALUE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
9. Start opendkim&lt;br /&gt;
&lt;br /&gt;
 systemctl start opendkim; systemctl enable opendkim&lt;br /&gt;
&lt;br /&gt;
10. Make sure it is running with the following commands&lt;br /&gt;
&lt;br /&gt;
 service opendkim status&lt;br /&gt;
This should say running.&lt;br /&gt;
&lt;br /&gt;
 ps -aux | grep dkim&lt;br /&gt;
The opendkim process should be running: &amp;quot;/usr/sbin/opendkim -f -x /etc/opendkim.con&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 netstat -nap | grep 8891&lt;br /&gt;
This command should show that opendkim is listening on localhost port 8819&lt;br /&gt;
&lt;br /&gt;
11. Sendmail Configuration&lt;br /&gt;
&lt;br /&gt;
11. a. Modify sendmail.mc, append the following line&lt;br /&gt;
&lt;br /&gt;
 INPUT_MAIL_FILTER(`opendkim&#039;, `S=inet:8891@localhost&#039;)&lt;br /&gt;
&lt;br /&gt;
11. b. re-make sendmail.cf, restart sendmail.&lt;br /&gt;
&lt;br /&gt;
 /etc/mail/make&lt;br /&gt;
 systemctl restart sendmail&lt;br /&gt;
&lt;br /&gt;
12. Send a test email&lt;br /&gt;
&lt;br /&gt;
 echo “Subject: DKIM testing” | sendmail test-recipient@address.email&lt;br /&gt;
&lt;br /&gt;
13. If the test email has worked, test again using the web interface admin tool &amp;quot;Send Test Email&amp;quot;&lt;br /&gt;
&lt;br /&gt;
14. Debug any issues using &lt;br /&gt;
&lt;br /&gt;
 tail -F /var/log/maillog*&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=How_to_configure_DKIM_email_verification_(using_sendmail_on_Rocky9)&amp;diff=16522</id>
		<title>How to configure DKIM email verification (using sendmail on Rocky9)</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=How_to_configure_DKIM_email_verification_(using_sendmail_on_Rocky9)&amp;diff=16522"/>
		<updated>2024-07-25T08:26:52Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: Created page with &amp;quot;== Manual Steps ==  &amp;#039;&amp;#039;&amp;#039;As eprints user&amp;#039;&amp;#039;&amp;#039;  1. Create a directory to store the keys   mkdir /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim  &amp;#039;&amp;#039;&amp;#039;As root user&amp;#039;&amp;#039;&amp;#039;  1. Install the opendkim l...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Manual Steps ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As eprints user&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Create a directory to store the keys&lt;br /&gt;
&lt;br /&gt;
 mkdir /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;As root user&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Install the opendkim libraries&lt;br /&gt;
&lt;br /&gt;
 dnf install opendkim opendkim-tools&lt;br /&gt;
&lt;br /&gt;
2. Open the opendkim config file and change the following lines&lt;br /&gt;
&lt;br /&gt;
 vim /etc/opendkim.conf&lt;br /&gt;
&lt;br /&gt;
2. a. Change &lt;br /&gt;
&lt;br /&gt;
 Mode V &lt;br /&gt;
to &lt;br /&gt;
 Mode sv&lt;br /&gt;
&lt;br /&gt;
2. b. Remove comments from the following lines:&lt;br /&gt;
&lt;br /&gt;
 KeyTable                /etc/opendkim/KeyTable&lt;br /&gt;
 SigningTable            refile:/etc/opendkim/SigningTable&lt;br /&gt;
 ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts&lt;br /&gt;
 InternalHosts           refile:/etc/opendkim/TrustedHosts&lt;br /&gt;
&lt;br /&gt;
2. c. Add the following lines (the DOMAIN is the domain which our server sending email on behalf of)&lt;br /&gt;
&lt;br /&gt;
 Domain &amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
 RequireSafeKeys False&lt;br /&gt;
&lt;br /&gt;
2. d. Replace the Socket declaration with the following line (it should be commented out above the declaration being used)&lt;br /&gt;
&lt;br /&gt;
 Socket  inet:8891@localhost&lt;br /&gt;
&lt;br /&gt;
3. Modify /etc/opendkim/KeyTable, to add the following line&lt;br /&gt;
&lt;br /&gt;
 default._domainkey.&amp;lt;DOMAIN&amp;gt; &amp;lt;DOMAIN&amp;gt;:default:/opt/eprints3/archives/&amp;lt;REPOID&amp;gt;/dkim/default.private&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; `default._domainkey.eprints-hosting.org eprints-hosting.org:default:/opt/eprints3/archives/repoid/dkim/default.private`&lt;br /&gt;
&lt;br /&gt;
4. Modify /etc/opendkim/SigningTable, to add the following line&lt;br /&gt;
&lt;br /&gt;
 *@&amp;lt;DOMAIN&amp;gt; default._domainkey.&amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; `*@eprints-hosting.org default._domainkey.eprints-hosting.org`&lt;br /&gt;
&lt;br /&gt;
5. Modify /etc/opendkim/TrustedHosts, to add the following line&lt;br /&gt;
&lt;br /&gt;
 *.&amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;example:&#039;&#039;&#039; *.eprints-hosting.org&lt;br /&gt;
&lt;br /&gt;
6. Generate the keypair&lt;br /&gt;
&lt;br /&gt;
 sudo opendkim-genkey -b 1024 -d &amp;lt;DOMAIN&amp;gt; -D /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim&amp;lt;DOMAIN&amp;gt; -s default -v&lt;br /&gt;
&lt;br /&gt;
7. Change ownership and permissions&lt;br /&gt;
&lt;br /&gt;
 sudo chown opendkim:opendkim /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim/* -R&lt;br /&gt;
 sudo chmod 660 /opt/eprints3/archives/&amp;lt;REPO-ID&amp;gt;/dkim/*&lt;br /&gt;
&lt;br /&gt;
8. Send the txt public key to whoever has access to the DNS records, probably their IT team&lt;br /&gt;
&lt;br /&gt;
 cat /etc/opendkim/keys/&amp;lt;DOMAIN&amp;gt;/default.txt&lt;br /&gt;
&lt;br /&gt;
It should look something like this.&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;v=DKIM1; k=rsa; &amp;quot; &amp;quot;p=REALLY-LONG-HASH-VALUE/HASH-VALUE/HASH-VALUE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
9. Start opendkim&lt;br /&gt;
&lt;br /&gt;
 systemctl start opendkim; systemctl enable opendkim&lt;br /&gt;
&lt;br /&gt;
10. Make sure it is running with the following commands&lt;br /&gt;
&lt;br /&gt;
 service opendkim status&lt;br /&gt;
This should say running.&lt;br /&gt;
&lt;br /&gt;
 ps -aux | grep dkim&lt;br /&gt;
The opendkim process should be running: &amp;quot;/usr/sbin/opendkim -f -x /etc/opendkim.con&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 netstat -nap | grep 8891&lt;br /&gt;
This command should show that opendkim is listening on localhost port 8819&lt;br /&gt;
&lt;br /&gt;
11. Sendmail Configuration&lt;br /&gt;
&lt;br /&gt;
11. a. Modify sendmail.mc, append the following line&lt;br /&gt;
&lt;br /&gt;
 INPUT_MAIL_FILTER(`opendkim&#039;, `S=inet:8891@localhost&#039;)&lt;br /&gt;
&lt;br /&gt;
11. b. re-make sendmail.cf, restart sendmail.&lt;br /&gt;
&lt;br /&gt;
 /etc/mail/make&lt;br /&gt;
 systemctl restart sendmail&lt;br /&gt;
&lt;br /&gt;
12. Send a test email&lt;br /&gt;
&lt;br /&gt;
 echo “Subject: DKIM testing” | sendmail test-recipient@address.email&lt;br /&gt;
&lt;br /&gt;
13. If the test email has worked, test again using the web interface admin tool &amp;quot;Send Test Email&amp;quot;&lt;br /&gt;
&lt;br /&gt;
14. Debug any issues using &lt;br /&gt;
&lt;br /&gt;
 tail -F /var/log/maillog*&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Manual&amp;diff=16521</id>
		<title>Manual</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Manual&amp;diff=16521"/>
		<updated>2024-07-25T08:22:19Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: /* How-to Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
See the [[Main Page]] for other areas of this wiki.&lt;br /&gt;
&lt;br /&gt;
* [[Introduction|Introduction to EPrints]] and [[History|History of EPrints]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellpadding=&amp;quot;10&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;33%&amp;quot; valign=&amp;quot;top&amp;quot;&amp;gt; &lt;br /&gt;
= Releases =&lt;br /&gt;
{{releasenotes}}&lt;br /&gt;
&#039;&#039;See also the note on [[EPrints Version Numbering]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
{{Download}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
* [[Recommended Platforms]]&lt;br /&gt;
* [[Required software]]&lt;br /&gt;
* Install Guides&lt;br /&gt;
** [[Installing EPrints on RHEL/Fedora/CentOS]]&lt;br /&gt;
*** Primarily RedHat Enterprise Linux (RHEL) and CentOS 7 and 8.&lt;br /&gt;
*** Guides for installing from RPM package and from source.&lt;br /&gt;
** [[Installing EPrints on Debian/Ubuntu]]&lt;br /&gt;
*** Primarily Ubuntu 18.04 LTS and 20.04 LTS.&lt;br /&gt;
*** Guides for installing from Deb package and from source.&lt;br /&gt;
* [[Installation|Generic EPrints installation instructions]]&lt;br /&gt;
* [[How to use EPrints with HTTPS]]&lt;br /&gt;
** [[Setting up HTTPS using Let&#039;s Encrypt]]&lt;br /&gt;
** [[HTTPS-only and HSTS]]&lt;br /&gt;
* [[Installing EPrints using Docker]]&lt;br /&gt;
&lt;br /&gt;
= Post Installation =&lt;br /&gt;
* [[Getting Started with EPrints 3]]&lt;br /&gt;
&lt;br /&gt;
= Maintenance =&lt;br /&gt;
* [[Backups]]&lt;br /&gt;
* [[Generate Scripts]]&lt;br /&gt;
* [[Alerts]]&lt;br /&gt;
* [[Log Files]]&lt;br /&gt;
* [[Automating your maintenance]]&lt;br /&gt;
* [[Troubleshooting]]&lt;br /&gt;
* [[Apache Hardening]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td width=&amp;quot;33%&amp;quot; valign=&amp;quot;top&amp;quot; style=&amp;quot;border-left: solid 1px #ccc; border-right: solid 1px #ccc;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Training Materials =&lt;br /&gt;
* [[:Category:Training Video|EPrints Training Course]]&lt;br /&gt;
* [http://www.eprints.org/software/training/ Training materials] provided by EPrints Services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= How-to Guides =&lt;br /&gt;
&#039;&#039;[http://en.wikipedia.org/wiki/Howto What is a how-to?]&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Howto|Orientation/Overview]] &amp;lt;span style=&amp;quot;color: #f94; font-size: 130%&amp;quot;&amp;gt;(Start here)&amp;lt;/span&amp;gt;&lt;br /&gt;
** [[Configuration orientation|New to EPrints 3?]]  - &#039;&#039;before diving into the how-tos, take some time to read through this brief orientation guide and familiarise yourself with the EPrints configuration landscape ...&#039;&#039;&lt;br /&gt;
* [[Front Page Warning | Removing the Front Page Warning]] - Your first go at branding&lt;br /&gt;
* [[Branding with confidence]] - &#039;&#039;one of the most common EPrints customisations is to add your own institution&#039;s branding and &amp;quot;look and feel&amp;quot; to the interface...&#039;&#039;&lt;br /&gt;
** [[Branding, the next level]] - &#039;&#039;how to completely change the interface to your own design&#039;&#039;&lt;br /&gt;
* [[OAI]]&lt;br /&gt;
* [[Adding new views]]&lt;br /&gt;
* Workflow&lt;br /&gt;
* Deposit Types&lt;br /&gt;
** [[Removing types]]&lt;br /&gt;
* Metadata&lt;br /&gt;
* Subjects (fold in with Organisation Hierarchy under &amp;quot;controled vocabularies&amp;quot;)&lt;br /&gt;
* [[EPrints_3_Organisation_Hierarchy|Organisation Hierarchy]] - &#039;&#039;how to put your own organisation&#039;s Hierarchy into EPrints 3&#039;&#039;&lt;br /&gt;
* Searches&lt;br /&gt;
* [[Autocompletion and Authority Files (Romeo Autocomplete)]] - &#039;&#039;add autocomplete functionality to the Publication Title input field based on an authority file downloaded from EPrints Romeo...&#039;&#039;&lt;br /&gt;
* [[Create Export Plugins]] - &#039;&#039;create a Perl Module that will export your data...&#039;&#039;&lt;br /&gt;
* [[Login-Only Repository]] - &#039;&#039;require a username and password to access all pages (including search, browse, and the front page)...&#039;&#039;&lt;br /&gt;
* [[Change Deposit Status in Bulk]] - &#039;&#039;move a large number of deposits from inbox to archive.&#039;&#039;&lt;br /&gt;
* [[SWORD]] - &#039;&#039;how to configure the SWORD protocol on EPrints.&#039;&#039;&lt;br /&gt;
* [[Custom handlers]] - &#039;&#039;how to add a custom handler for intergration with third-party applications.&#039;&#039;&lt;br /&gt;
* [[User Deposit Agreement]] - &#039;&#039;How to add a user deposit agreement to the workflow.&#039;&#039;&lt;br /&gt;
* [[ORCID]]&lt;br /&gt;
** [[Import From ORCID]]&lt;br /&gt;
* Javascript&lt;br /&gt;
** [[Include Javascript in the workflow]]&lt;br /&gt;
* DKIM email verification&lt;br /&gt;
** [[How to configure DKIM email verification (using sendmail on Rocky9)]]&lt;br /&gt;
&lt;br /&gt;
= How to contribute =&lt;br /&gt;
There&#039;s a number of different ways you can contribute to the EPrints project. This section covers all the ones we can think of...&lt;br /&gt;
&lt;br /&gt;
Always make an entry on http://files.eprints.org/ for your contribution, even if you don&#039;t upload the files. This will make it the one-stop place for people to find EPrints extensions.&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Documentation Needed| Create some of the missing documentation]]&lt;br /&gt;
* [[Contribute: Plugins | Plugins]]&lt;br /&gt;
* [[Contribute: Scripts | Scripts]]&lt;br /&gt;
* [[Contribute: Themes | Themes]]&lt;br /&gt;
* [[Contribute: Translations | Translations]]&lt;br /&gt;
* [[Contribute: Other | Other neighbourly things to do]]&lt;br /&gt;
* [[Extension Packages]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Misc =&lt;br /&gt;
* [[Preservation Support]] in EPrints 3&lt;br /&gt;
* [[:Category:Languages|Language support and translations]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;33%&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Technical Reference =&lt;br /&gt;
* [[EPrints Directory Structure]] - How code and configuation files are organised.&lt;br /&gt;
* [[EPrints Glossary]] - A listing of terminology used within EPrints.&lt;br /&gt;
* [[User Menu]] - Explaining the menu options available to an EPrints user.&lt;br /&gt;
* [[Admin|Admin Menu]] - Explaining the tools available to a repository administrator.&lt;br /&gt;
* [[Metadata]] - configuring metadata fields.&lt;br /&gt;
* [[Archives/ARCHIVEID/cfg/|Repository Configuration]]&lt;br /&gt;
* [[XML Configuration]] Files&lt;br /&gt;
** [[EPScript]] - documentation for the EP3 Scripting language (for use in citations and workflow files).&lt;br /&gt;
** [[EPrints Control Format]] - the structure used to embed EPScript in an XML configuration file.&lt;br /&gt;
** [[Citation Format]]&lt;br /&gt;
** [[Workflow Format]] - the structure of the EP3 workflow files&lt;br /&gt;
** [[Phrase Format]]&lt;br /&gt;
** [[Template Format]]&lt;br /&gt;
** [[XPAGE Format]]&lt;br /&gt;
* [[XML Export Format]]&lt;br /&gt;
* EPrints data structure &lt;br /&gt;
** of the software&lt;br /&gt;
** of the database (relating the dataobjects to each other using eprints fields)&lt;br /&gt;
* [[Data Object]]s and data sets&lt;br /&gt;
** The [[EPrint Object]]&lt;br /&gt;
** The [[User Object]]&lt;br /&gt;
** The [[Document Object]]&lt;br /&gt;
** The [[Subject Object]]&lt;br /&gt;
** The [[Saved Search Object]]&lt;br /&gt;
** The [[History Object]]&lt;br /&gt;
** The [[Access Object]]&lt;br /&gt;
** The [[Request Object]]&lt;br /&gt;
* [[:Category:Plugins|Plugins]]&lt;br /&gt;
** [[Create Export Plugins|Export]]&lt;br /&gt;
** Import &lt;br /&gt;
** [[Screen Plugins|Screen]]&lt;br /&gt;
* [[Autocompletion]]&lt;br /&gt;
** [[Understanding IDs in Workflow Forms]]&lt;br /&gt;
* [[API]]&lt;br /&gt;
* [[Dynamic Template System]]&lt;br /&gt;
* [[Config Options by File]]&lt;br /&gt;
&lt;br /&gt;
= The EPrints Bazaar =&lt;br /&gt;
* [[:Category:EPrints_Bazaar|The EPrints Bazaar]] (Start Here)&lt;br /&gt;
* The [[EPM Specification]]&lt;br /&gt;
* [[:Category:Bazaar_Package|Bazaar Packages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=IRStats2&amp;diff=16175</id>
		<title>IRStats2</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=IRStats2&amp;diff=16175"/>
		<updated>2024-02-05T11:22:25Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: /* Embedding Stats on Abstract Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:API]]&lt;br /&gt;
[[Category:IRStats]]&lt;br /&gt;
[[Category:Plugins]]&lt;br /&gt;
[[Category:Bazaar_Package]]&lt;br /&gt;
[[Category:Eprints3.4]]&lt;br /&gt;
[[Category:Eprints3.3]]&lt;br /&gt;
&lt;br /&gt;
=What is IRStats2?=&lt;br /&gt;
IRStats2 is a statistical framework for EPrints - It comes with some cool default tools and reports and it can also be customised to, for instance, add new metrics or data sets. It has a Javascript API to include stats on any pages you want.&lt;br /&gt;
&lt;br /&gt;
IRStats2 is developed against EPrints 3.4 and 3.3 but it was written to also work on EPrints 3.2. However, as EPrints 3.2 is no longer supported there is likewise no support for running IRStats2 on EPrints 3.2. &lt;br /&gt;
&lt;br /&gt;
=What&#039;s new in version 1.1?=&lt;br /&gt;
This new version includes a number of improvements to existing features such as easier deployment, faster database code, tool tips and improved browser detection, as well as a number of smaller tweaks and fixes.&lt;br /&gt;
&lt;br /&gt;
It now also includes filtering to allow the blocking of web crawling robots as standard.&lt;br /&gt;
&lt;br /&gt;
==Changes in 1.1, since 1.0.x==&lt;br /&gt;
&lt;br /&gt;
=== Features ===&lt;br /&gt;
* IP based robot filtering and default values&lt;br /&gt;
* Adding an option to only show live items in the stats&lt;br /&gt;
&lt;br /&gt;
=== Improvements ===&lt;br /&gt;
* Avoid using experimental perl code.(i.e. ~~ )&lt;br /&gt;
* Restructure to make epm deployment easier&lt;br /&gt;
* Tooltip help text for KeyFigures&lt;br /&gt;
* Optimisation for InnoDB&lt;br /&gt;
* CSV, JSON, XML saves file as instead of open directly in the browser&lt;br /&gt;
* Added missing libraries check (Date::Calc and Geo::IP) on bazaar installation page. resolves [https://github.com/eprints/irstats2/issues/10 #10]&lt;br /&gt;
* %IGNORE_LIST of words (stopwords) are very few and only in &amp;quot;en&amp;quot;&lt;br /&gt;
* Add support for transactions&lt;br /&gt;
&lt;br /&gt;
=== Bug Fixes ===&lt;br /&gt;
* Stats::View::google::Graph lose first statistics [https://github.com/eprints/irstats2/issues/69 #69]&lt;br /&gt;
* Browser identification issue [https://github.com/eprints/irstats2/issues/66 #66]&lt;br /&gt;
* The title of Screen::IRStats2::Report should not change according to report you chose&lt;br /&gt;
* Avoid XSS vulnerability in some CGI output&lt;br /&gt;
&lt;br /&gt;
=Installation=&lt;br /&gt;
&lt;br /&gt;
==Dependencies==&lt;br /&gt;
* Geo&amp;amp;#58;&amp;amp;#58;IP or Geo&amp;amp;#58;&amp;amp;#58;IP::PurePerl&lt;br /&gt;
* Date::Calc&lt;br /&gt;
&lt;br /&gt;
Both can usually be installed via your Linux package managers (apt-get, yum, ...) or via CPAN.&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
 apt-get install libgeo-ip-perl libdate-calc-perl&lt;br /&gt;
&lt;br /&gt;
=== RedHat/CentOS/Fedora ===&lt;br /&gt;
 yum install perl-Geo-IP perl-Date-Calce&lt;br /&gt;
&lt;br /&gt;
=== CPAN ===&lt;br /&gt;
 cpan Geo&amp;amp;#58;&amp;amp;#58;IP Date::Calc&lt;br /&gt;
&lt;br /&gt;
==EPrints 3.3 and 3.4==&lt;br /&gt;
IRStats2 can be installed directly via the Bazaar on EPrints 3.3 and 3.4.&lt;br /&gt;
&lt;br /&gt;
===EPrints 3.3.11 (inc. 3.4.x) onwards===&lt;br /&gt;
Installing IRStats2 from the Bazaar is all you need to do. It is recommend that you restart Apache after doing so.&lt;br /&gt;
&lt;br /&gt;
===EPrints 3.3.1 to 3.3.10===&lt;br /&gt;
You need to install IRStats2 from the Bazaar as above, but you also need to apply a few patches to enable the Google map showing the &amp;quot;Origins of downloads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The patches relate to an incompatibility between the Prototype JS library (used by EPrints) and Google Charts (used by IRStats2). The two patches you need to apply are:&lt;br /&gt;
&lt;br /&gt;
*[https://github.com/eprints/eprints/commit/f7a9088aae29b8732cb5d8edd83d17e94f069e63 Upgrade Prototype]&lt;br /&gt;
*[https://github.com/eprints/eprints/issues/130 Fix auto-completers]&lt;br /&gt;
&lt;br /&gt;
==EPrints 3.2.x==&lt;br /&gt;
See [[IRStats2/EPrints 3.2]]&lt;br /&gt;
&lt;br /&gt;
==Processing==&lt;br /&gt;
IRStats2 uses its own tables to manage statistics, which it populates from the EPrints access table (a table containing a row for every access to EPrints objects). Once installed, IRStats needs to process the full contents of this table. Processing works in two steps: the initial processing and then a daily incremental processing. Because the initial processing will take care of all your legacy &amp;quot;download&amp;quot; data, this can take a (very) long time. It may take a few days if your repository is very large, although more likely it will take a few hours.&lt;br /&gt;
&lt;br /&gt;
For the initial processing, run, as the &amp;quot;eprints&amp;quot; user, the below command (and remember this may take a long time to complete). If you are running it from an SSH session, you may want to use the &amp;quot;screen&amp;quot; Linux utility to make sure your SSH session will persist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/eprints3/archives/REPO_ID/bin/stats/process_stats REPO_ID --setup --verbose&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the daily incremental processing, add the below line in cron. It is a good idea to let this run over-night when there is less traffic to your repository (note the redirections of output to /dev/null will make the script run silently).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
perl /opt/eprints3/archives/REPO_ID/bin/stats/process_stats REPO_ID 1&amp;gt;/dev/null 2&amp;gt;/dev/null&lt;br /&gt;
The two redirections to /dev/null forces the process to not output anything.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Viewing Stats=&lt;br /&gt;
The main IRStats2 dashboard is available at: http://yourrepo.url/cgi/stats/report&lt;br /&gt;
&lt;br /&gt;
== Embedding Stats on Abstract Pages ==&lt;br /&gt;
&lt;br /&gt;
Edit the EPrint Summary Page citation file (this can be done from the command line or the configuration editor) and add the following phrase near the bottom:&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;epc:phrase ref=&amp;quot;lib/irstats2:embedded:summary_page:eprint:downloads&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;epc:param name=&amp;quot;eprintid&amp;quot;&amp;gt;&amp;lt;epc:print expr=&amp;quot;eprintid&amp;quot;/&amp;gt;&amp;lt;/epc:param&amp;gt;&lt;br /&gt;
  &amp;lt;/epc:phrase&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then restart apache and regenerate the abstract pages.&lt;br /&gt;
&lt;br /&gt;
=Configuration=&lt;br /&gt;
This section details how to configure IRStats2 and mostly relates to the file cfg/cfg.d/z_irstats2.pl.&lt;br /&gt;
&lt;br /&gt;
It is recommended that you edit your changes in a separate file (e.g. zz_irstats2_local.pl - must be loaded AFTER z_irstats2.pl) as this will make Bazaar updates easier to apply.&lt;br /&gt;
&lt;br /&gt;
==Datasets/Datatypes==&lt;br /&gt;
Since IRStats2 can handle any EPrints datasets (not just the &#039;access&#039; dataset which records downloads), you can declare in the configuration which EPrints datasets to process. For each EPrints dataset configured, IRStats2 will pass on the records from the Database to each processing module. This is coupled to the Stats::Processor modules and you will see that, by default, IRStats2 processes:&lt;br /&gt;
&lt;br /&gt;
*The &amp;quot;access&amp;quot; dataset with the associated Stats::Processor::Access modules&lt;br /&gt;
*The &amp;quot;eprint&amp;quot; dataset with the associated Stats::Processor::EPrint modules&lt;br /&gt;
*The &amp;quot;history&amp;quot; dataset with, as you have guessed, the Stats::Processor::History modules&lt;br /&gt;
&lt;br /&gt;
Each module will provide specific datum, which is declared in the module itself. For instance, Stats::Processor::Access::Downloads provides us with the &amp;quot;downloads&amp;quot; and &amp;quot;views&amp;quot; data-types.&lt;br /&gt;
&lt;br /&gt;
===Configuration example and options===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
access =&amp;gt; { &lt;br /&gt;
	filters =&amp;gt; [ &#039;Robots&#039;, &#039;Repeat&#039; ], &lt;br /&gt;
	incremental =&amp;gt; 1 &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only two options which can be used are:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;incremental&#039;&#039;&#039;: 1 or 0 (default 1) - tells IRStats2 to incrementally process the DB records. Since IRStats2 data must be processed daily, this indicates whether you should reprocess the entire dataset every day. For downloads (ie. the &amp;quot;access&amp;quot; dataset), you only need to reprocess the daily downloads, there is no need to restart from 0. However, some metrics used for the &amp;quot;eprint&amp;quot; dataset requires the entire dataset to be re-processed daily, which is OK as the &amp;quot;eprint&amp;quot; dataset is usually much smaller than the &amp;quot;access&amp;quot; one.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;filters&#039;&#039;&#039;: an array of Filters (default []) - tells IRStats2 to apply filters before processing the records. This is especially useful for &amp;quot;access&amp;quot; records where hits by robots/crawlers are usually removed. Filters are very similar to Processor modules, except that they must return a boolean to indicate whether to keep or to discard the record. If the record is kept then it is passed on to the related Processor modules.&lt;br /&gt;
&lt;br /&gt;
Remember that if you want to process new datasets (e.g. &amp;quot;user&amp;quot;) then you must write the associated Stats::Processor modules, otherwise nothing would happen.&lt;br /&gt;
&lt;br /&gt;
==Sets==&lt;br /&gt;
A Set tells IRStats2 how to group data points and it is done via an existing (&amp;quot;eprint&amp;quot;) meta-field. Each value of that set (in essence, the distinct values of the field) will become a set value you can use in IRStats2 to give you statistics on the value. For instance, you can get download stats by author or by item type. Both &amp;quot;author&amp;quot; and &amp;quot;item type&amp;quot; are sets. Most Set definitions are straight-forward to declare, with the exception of &amp;quot;creators&amp;quot; (a.k.a. &amp;quot;authors&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===Configuration example and options===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
                &#039;field&#039; =&amp;gt; &#039;divisions&#039;,&lt;br /&gt;
                &#039;groupings&#039; =&amp;gt; [ &#039;authors&#039; ]&lt;br /&gt;
},&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This defines the Set &amp;quot;divisions&amp;quot; - if the divisions field reflects the hierarchical structure of your institution (as it should) then you can get stats per division/school/faculty. You can also get &amp;quot;Top publications&amp;quot; per division.&lt;br /&gt;
&lt;br /&gt;
Here are all the options you may use when defining a Set:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039;: (optional - default to &#039;field&#039;) - the name of the set&lt;br /&gt;
*&#039;&#039;&#039;field&#039;&#039;&#039;: the &amp;quot;eprint&amp;quot; field to use to generate set values&lt;br /&gt;
*&#039;&#039;&#039;groupings&#039;&#039;&#039;: (optional - default to []) - an ARRAY of set names to use as groupings. A new grouping, within a set, fills in the statement: &amp;quot;I want to be able to see Top Y per set&amp;quot;. For instance for the set &#039;divisions&#039; and the grouping &#039;authors&#039;: &amp;quot;I want to be able to see Top Authors per Divisions&amp;quot;.&lt;br /&gt;
*&#039;&#039;&#039;anon&#039;&#039;&#039;: (optional - default to ) - whether to make the set values anonymous (and hex MD5 is used instead). This is particularly useful when using authors&#039; ID which is usually their email address (and you don&#039;t want to make these public).&lt;br /&gt;
*&#039;&#039;&#039;use_ids&#039;&#039;&#039;: For compound fields only (especially for creators). Tell IRStats2 to use the &amp;quot;id&amp;quot; part to generate distinct set values. This is more accurate that using the &amp;quot;name&amp;quot; part only.&lt;br /&gt;
*&#039;&#039;&#039;id_field&#039;&#039;&#039;: For compound fields only. The name of the &amp;quot;id&amp;quot; field - usually it is just &amp;quot;id&amp;quot;, as in &amp;quot;creators_id&amp;quot;.&lt;br /&gt;
*&#039;&#039;&#039;minimum_filter_length&#039;&#039;&#039;: Used by the Set Finder on the Reports. If set, this only start searching for set values after the user has entered minimum_filter_length characters. Some sets can be large (esp. creators) and we do not really want to preload the potential 100&#039;s of thousands of authors names on the UI. Instead we ask the user to search for author&#039;s names.&lt;br /&gt;
*&#039;&#039;&#039;render_single_value&#039;&#039;&#039;: A CODEREF that must return a DOM element. This will tell how to render a set value, if you do not wish to use the default renderers. The function will receive three variables: $repo, $setname and $setvalue.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;quot;eprint&amp;quot; is a built-in Set and should not be defined in the configuration. The &amp;quot;eprint&amp;quot; Set is the collection of all the eprints (or &amp;quot;publications&amp;quot;) of your repository. It is the assumed Set when no set is declared, as for the scenario &amp;quot;show me the top publications [among the entire repository]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Reports==&lt;br /&gt;
Reports are single pages which group different metrics together. The main report page (http://yourrepo.url/cgi/stats/report) is such an example. If you create a new report, &amp;quot;my_report&amp;quot;, it will be available at the URL: http://yourepo.url/cgi/stats/report/my_report.&lt;br /&gt;
&lt;br /&gt;
In the configuration, Reports can be seen as a top-to-bottom stack of Stats::View modules. Such modules know how to draw certain stats such as graphs, tables or pie charts, they just need to be position on the report. The module handling the generation of reports (Screen::IRStats2::Report) takes care of passing on the correct context to each Stats::View module. Such contexts include any date filters or set values selected by a visiting user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#A basic report showing the monthly downloads graph and the top downloaded publications:&lt;br /&gt;
my_report =&amp;gt; {&lt;br /&gt;
	items =&amp;gt; [&lt;br /&gt;
		{ &lt;br /&gt;
			plugin =&amp;gt; &#039;ReportHeader&#039;&lt;br /&gt;
		},&lt;br /&gt;
		{&lt;br /&gt;
			plugin =&amp;gt; &#039;Google::Graph&#039;,&lt;br /&gt;
                        datatype =&amp;gt; &#039;downloads&#039;,&lt;br /&gt;
                        options =&amp;gt; {&lt;br /&gt;
                                date_resolution =&amp;gt; &#039;month&#039;,&lt;br /&gt;
                                graph_type =&amp;gt; &#039;column&#039;,&lt;br /&gt;
                        },&lt;br /&gt;
		},&lt;br /&gt;
                {&lt;br /&gt;
                        plugin =&amp;gt; &#039;Table&#039;,&lt;br /&gt;
                        datatype =&amp;gt; &#039;downloads&#039;,&lt;br /&gt;
                        options =&amp;gt; {&lt;br /&gt;
                                limit =&amp;gt; 10,&lt;br /&gt;
                                top =&amp;gt; &#039;eprint&#039;,&lt;br /&gt;
                                title_phrase =&amp;gt; &#039;top_downloads&#039;&lt;br /&gt;
                        },&lt;br /&gt;
                },&lt;br /&gt;
&lt;br /&gt;
	],&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;options&#039;&#039;&#039; are detailed in the [https://wiki.eprints.org/w/IRStats2#API API] section.&lt;br /&gt;
&lt;br /&gt;
==Security==&lt;br /&gt;
Users must have the following two roles to view stats:&lt;br /&gt;
&lt;br /&gt;
  *+irstats2/view&lt;br /&gt;
  *+irstats2/export&lt;br /&gt;
&lt;br /&gt;
However these two roles are given to the &amp;quot;public&amp;quot; by default, meaning that anyone can view and/or export the stats. These lines may be commented out in the configuration to prevent this behaviour.&lt;br /&gt;
&lt;br /&gt;
=API=&lt;br /&gt;
&lt;br /&gt;
This section presents a few examples on how to get data out of IRStats2 for embedding data on pages or for re-use in analysis scripts (for instance).&lt;br /&gt;
&lt;br /&gt;
There are two ways to get data out:&lt;br /&gt;
&lt;br /&gt;
#From a script: this is the real API, using PERL&lt;br /&gt;
#From an Ajax request: this is usually to embed data on pages&lt;br /&gt;
&lt;br /&gt;
==Core concepts==&lt;br /&gt;
&lt;br /&gt;
===Datatype===&lt;br /&gt;
Datatype refers to which data to provide with IRStats2 able to process any of data on your repository. The typical use of IRStats2 is however for usage statistics so this is the main dataset, but data on deposits, open access, full text (etc) are also processed. Some repositories even include data from Scopus (citation counts).&lt;br /&gt;
&lt;br /&gt;
Main datatypes:&lt;br /&gt;
&lt;br /&gt;
*downloads: good old download statistics - downloads of full-text documents&lt;br /&gt;
*views: number of hits on the summary page (of a publication)&lt;br /&gt;
*deposits: number of publications deposited&lt;br /&gt;
*doc_access: provides 4 metrics (full_text, no_full_text, open_access and no_open_access) used for computing percentages of Open Access and Full-Text *documents in the repository&lt;br /&gt;
*doc_format: MIME type of full-texts&lt;br /&gt;
*history: analysis of the &amp;quot;history&amp;quot; dataset - this provides information on when publications were created, edited, made live, deleted etc.&lt;br /&gt;
*referrer: information on how site visitors got to the repository (e.g. from Google, internal uni pages, etc)&lt;br /&gt;
*search_terms: if coming from a search site (or the internal EPrints search) which words were used to get to the publication&lt;br /&gt;
*browser: which browser visitors used on the repository&lt;br /&gt;
&lt;br /&gt;
===Sets===&lt;br /&gt;
By default, IRStats2 returns data over the entire repository, i.e. the entire set of eprints is assumed. You can however restrict which &amp;quot;set&amp;quot; to use: the publications of an author, of a university division, of a subject, etc.&lt;br /&gt;
&lt;br /&gt;
===Dates and ranges===&lt;br /&gt;
You can also restrict by dates or by a range. By default, all the stats are returned without any dates restrictions.&lt;br /&gt;
&lt;br /&gt;
Dates can be set as YYYYMMDD or YYYY-MM-DD or YYYY/MM/DD (e.g. 20170101, 2017-11-04 etc). Dates is a hash containing two keys: from and to (either may be omitted to say: from that particular date, or up to that particular date).&lt;br /&gt;
&lt;br /&gt;
Ranges follow a %d%c format and the upper limit is &amp;quot;now&amp;quot; or &amp;quot;today&amp;quot;, for instance:&lt;br /&gt;
&lt;br /&gt;
*6m: over the past 6 months&lt;br /&gt;
*12d: over the past 12 days&lt;br /&gt;
*3y: over the past 3 years&lt;br /&gt;
&lt;br /&gt;
Only &amp;quot;m&amp;quot; (months), &amp;quot;d&amp;quot; (days) or &amp;quot;y&amp;quot; (years) may be used. 12m is the same as 1y.&lt;br /&gt;
&lt;br /&gt;
===Groupings===&lt;br /&gt;
This tells IRStats2 how to group data and is generally only used for things like &amp;quot;give me the TOP eprints&amp;quot;, &amp;quot;give me the TOP authors&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
So having a &amp;quot;grouping&amp;quot; set to &amp;quot;eprint&amp;quot; means the top eprints. If set to &amp;quot;authors&amp;quot;, the top authors etc. The grouping must be a valid set except for when it equals to &amp;quot;eprint&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
It is possible to limit the amount of records being returned (for when this is relevant: if you want the top downloads, since the beginning of time, then you&#039;d only get one data row back, which is that count). But for queries which ask for, say, the top authors, it is then interesting to be able to get only the first 10 authors. 10 here is the limit.&lt;br /&gt;
&lt;br /&gt;
It is also possible to ask IRStats2 to return certain data field in queries. For top eprints, you generally want the &amp;quot;eprintid&amp;quot; field. To draw timeline graphs (eg. evolution of downloads over-time), you&#039;d want the &amp;quot;datestamp&amp;quot; field. More examples are illustrated below.&lt;br /&gt;
&lt;br /&gt;
==Data from scripts==&lt;br /&gt;
&lt;br /&gt;
===Main API===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# get the IRStats2 handler, required to query IRStats2&lt;br /&gt;
my $handler = $repo-&amp;gt;plugin( &amp;quot;Stats::Handler&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
# ask IRStats2 to show debug statements (SQL queries)&lt;br /&gt;
$handler-&amp;gt;debug(1);&lt;br /&gt;
&lt;br /&gt;
# Create a Context object&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { datatype: &amp;quot;downloads&amp;quot; } );&lt;br /&gt;
&lt;br /&gt;
# Retrieve data rows&lt;br /&gt;
my $data = $handler-&amp;gt;data( $ctx )-&amp;gt;select();&lt;br /&gt;
&lt;br /&gt;
# How many rows returned:&lt;br /&gt;
printf &amp;quot;I got %d data rows back\n&amp;quot;, $data-&amp;gt;count;&lt;br /&gt;
&lt;br /&gt;
# Get stats for divisions &amp;quot;uos-ecs&amp;quot;:&lt;br /&gt;
$ctx-&amp;gt;set( { set_name =&amp;gt; &#039;divisions&#039;, set_value =&amp;gt; &#039;uos-ecs&#039; } );&lt;br /&gt;
&lt;br /&gt;
# Get stats over the last 6 months:&lt;br /&gt;
$ctx-&amp;gt;dates( { range =&amp;gt; &#039;6m&#039; } );&lt;br /&gt;
&lt;br /&gt;
# Get stats between 1st January 2012 and 31st March 2012:&lt;br /&gt;
$ctx-&amp;gt;dates( { from =&amp;gt; &#039;20120101&#039;, to =&amp;gt; &#039;20120331&#039; } );&lt;br /&gt;
&lt;br /&gt;
# Data may be exported (see Stats/Export/ for a list of currently supported plug-ins):&lt;br /&gt;
my $export = $repo-&amp;gt;plugin( &amp;quot;Stats::Export::CSV&amp;quot; );&lt;br /&gt;
$data-&amp;gt;export( { export_plugin =&amp;gt; $export } );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full Examples===&lt;br /&gt;
Actually those are not really full examples. They assume you can write the beginning of a PERL script and that you have already instantiated the Stats Handler (cf. above) as $handler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# How many downloads in total over the entire repository&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { datatype =&amp;gt; &amp;quot;downloads&amp;quot; } );&lt;br /&gt;
printf &amp;quot;I got %d downloads\n&amp;quot;, $handler-&amp;gt;data( $ctx )-&amp;gt;select-&amp;gt;sum_all;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# How many downloads in 2013 over the entire repository&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { datatype =&amp;gt; &amp;quot;downloads&amp;quot;, range =&amp;gt; &amp;quot;2013&amp;quot; } );&lt;br /&gt;
printf &amp;quot;I got %d downloads\n&amp;quot;, $handler-&amp;gt;data( $ctx )-&amp;gt;select-&amp;gt;sum_all;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The top 5 EPrints over the entire repository&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { grouping =&amp;gt; &amp;quot;eprint&amp;quot;, datatype =&amp;gt; &amp;quot;downloads&amp;quot; } );&lt;br /&gt;
&lt;br /&gt;
my $stats = $handler-&amp;gt;data( $ctx )-&amp;gt;select( fields =&amp;gt; [&amp;quot;eprintid&amp;quot;], limit =&amp;gt; 5 );&lt;br /&gt;
&lt;br /&gt;
foreach( @{ $stats-&amp;gt;data } )&lt;br /&gt;
{&lt;br /&gt;
        printf &amp;quot;EPrint %d got %d downloads\n&amp;quot;, $_-&amp;gt;{eprintid}, $_-&amp;gt;{count};&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The top 10 Subjects (let&#039;s assume LoC) for deposits (not downloads!!)&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { set_name =&amp;gt; &amp;quot;subjects&amp;quot;, datatype =&amp;gt; &amp;quot;deposits&amp;quot; } );&lt;br /&gt;
&lt;br /&gt;
my $stats = $handler-&amp;gt;data( $ctx )-&amp;gt;select( fields =&amp;gt; [&amp;quot;set_value&amp;quot;], limit =&amp;gt; 10 );&lt;br /&gt;
&lt;br /&gt;
my $i = 1;&lt;br /&gt;
foreach( @{ $stats-&amp;gt;data } )&lt;br /&gt;
{&lt;br /&gt;
        printf &amp;quot;%d) %s with %d items deposited\n&amp;quot;, $i++, $_-&amp;gt;{set_value}, $_-&amp;gt;{count};&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The top 5 downloaded EPrints for LoC Subject &amp;quot;D1&amp;quot;&lt;br /&gt;
my $ctx = $handler-&amp;gt;context( { set_name =&amp;gt; &amp;quot;subjects&amp;quot;, set_value =&amp;gt; &#039;D1&#039;, datatype =&amp;gt; &amp;quot;downloads&amp;quot; } );&lt;br /&gt;
&lt;br /&gt;
my $stats = $handler-&amp;gt;data( $ctx )-&amp;gt;select( fields =&amp;gt; [&amp;quot;eprintid&amp;quot;], limit =&amp;gt; 5 );&lt;br /&gt;
&lt;br /&gt;
my $i = 1;&lt;br /&gt;
foreach( @{ $stats-&amp;gt;data } )&lt;br /&gt;
{&lt;br /&gt;
        printf &amp;quot;%d) EPrintd %d with %d downloads\n&amp;quot;, $i++, $_-&amp;gt;{eprintid}, $_-&amp;gt;{count};&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Embedding data==&lt;br /&gt;
This is similar to retrieving data from scripts (cf. section above) but with a few extra options:&lt;br /&gt;
&lt;br /&gt;
*&amp;quot;view&amp;quot;: the name of the Stats::View plug-in which will draw the requested stuff (a Table? a Graph? etc.)&lt;br /&gt;
*&amp;quot;container_id&amp;quot;: the DOM element &amp;quot;id&amp;quot;, where the drawn stuff will be inserted on the page (if the Ajax callback is successful)&lt;br /&gt;
&lt;br /&gt;
Then there exists a number of options proper to each View plug-in. See the provided examples below.&lt;br /&gt;
&lt;br /&gt;
===Graphs===&lt;br /&gt;
The typical example is to embed the global downloads graph. This is usually the first displayed item on the IRStats2 main report page (/cgi/stats/report).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This will basically insert the downloads graph into the &amp;quot;mygraph&amp;quot; div element. Note that it&#039;s using the supplied &amp;quot;irstats2_googlegraph&amp;quot; CSS class.&lt;br /&gt;
&lt;br /&gt;
      Context options:&lt;br /&gt;
      - irs2report: What type of report/data do you want to display (e.g. &amp;quot;main&amp;quot;, &amp;quot;deposits&amp;quot;, &amp;quot;requests&amp;quot;)&lt;br /&gt;
      - range: What date range show this report cover (e.g. &amp;quot;_ALL_&amp;quot; is across all dates, &amp;quot;1y&amp;quot; is the last year &amp;quot;1m&amp;quot; is the last month, etc.) &lt;br /&gt;
      - datatype: What type of data is being displayed (e.g. &amp;quot;downloads&amp;quot;, &amp;quot;views&amp;quot;, &amp;quot;deposits&amp;quot;, &amp;quot;countries&amp;quot;)&lt;br /&gt;
      - datafilter: What attribute on which to filter the data (e.g. &amp;quot;archive&amp;quot;)&lt;br /&gt;
      - set_name: A set on which to filter (e.g. &amp;quot;authors&amp;quot;, &amp;quot;type&amp;quot;, &amp;quot;divisions&amp;quot;, &amp;quot;subjects&amp;quot;, &amp;quot;eprintid&amp;quot;)&lt;br /&gt;
      - set_value: A value in the set on which to filterm (e.g for an author the hash of their name such as &amp;quot;c6edf1ce30d927a9a005e4b272ead4b4&amp;quot; for a division or subject, their subject ID, for eprint type, its type ID)&lt;br /&gt;
      &lt;br /&gt;
      Graph options:&lt;br /&gt;
      - graph_type: either &amp;quot;column&amp;quot; or &amp;quot;area&amp;quot;&lt;br /&gt;
      - show_average: either 1 or 0 - displays the average graph&#039;&lt;br /&gt;
      - date_resolution: either &amp;quot;year&amp;quot;, &amp;quot;month&amp;quot; or &amp;quot;day&amp;quot; - groups data by year, month or day (be careful: selecting day may generate LOTS of data points)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mygraph&amp;quot; class=&amp;quot;irstats2_googlegraph&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
document.observe(&amp;quot;dom:loaded&amp;quot;,function(){&lt;br /&gt;
         new EPJS_Stats_GoogleGraph( { &lt;br /&gt;
                &#039;context&#039;: {&#039;irs2report&#039;: &#039;main&#039;, &#039;range&#039;: &#039;_ALL_&#039;, &#039;datatype&#039;: &#039;downloads&#039;},&lt;br /&gt;
                &#039;options&#039;: { &#039;graph_type&#039;: &#039;column&#039;, &#039;container_id&#039;: &#039;mygraph&#039;, &#039;view&#039;: &#039;Google::Graph&#039;, &#039;show_average&#039;: &#039;1&#039;, &#039;date_resolution&#039;: &#039;month&#039; } &lt;br /&gt;
        });&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tables===&lt;br /&gt;
The example below displays the top 10 downloaded eprints in the repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This will insert the top table into the &amp;quot;mytable&amp;quot; div element. Note that it&#039;s using the supplied&lt;br /&gt;
     &amp;quot;irstats2_table&amp;quot; CSS class.&lt;br /&gt;
      &lt;br /&gt;
      Context options:&lt;br /&gt;
      - irs2report: What type of report/data do you want to display (e.g. &amp;quot;most_popular_eprints&amp;quot;, &amp;quot;most_popular_authors&amp;quot;)&lt;br /&gt;
      - range: What date range show this report cover (e.g. &amp;quot;_ALL_&amp;quot; is across all dates, &amp;quot;1y&amp;quot; is the last year &amp;quot;1m&amp;quot; is the last month, etc.) &lt;br /&gt;
      - datatype: What type of data is being displayed (e.g. &amp;quot;downloads&amp;quot;, &amp;quot;views&amp;quot;)&lt;br /&gt;
      - set_name: A set on which to filter (e.g. &amp;quot;authors&amp;quot;, &amp;quot;type&amp;quot;, &amp;quot;divisions&amp;quot;, &amp;quot;subjects&amp;quot;, &amp;quot;eprintid&amp;quot;)&lt;br /&gt;
      - set_value: A value in the set on which to filterm (e.g for an author the hash of their name such as &amp;quot;c6edf1ce30d927a9a005e4b272ead4b4&amp;quot; for a division or subject, their subject ID, for eprint type, its type ID)&lt;br /&gt;
&lt;br /&gt;
      Table options:&lt;br /&gt;
      - top: the top &amp;quot;thing&amp;quot; to display - similar to the &amp;quot;grouping&amp;quot; parameter when using scripts&lt;br /&gt;
      - limit: the max number of items to retrieve&lt;br /&gt;
      - show_count: 1 or 0 - display the counts or not&lt;br /&gt;
      - show_order: 1 or 0 - display the ordering (1,2,3 ...) or not&lt;br /&gt;
      - show_more: 1 or 0 - shows the &amp;quot;show more&amp;quot; options or not (to retrieve more results)&lt;br /&gt;
      - human_display: 1 or 0 - separate 1000 with a comma (as done in English): 10000 becomes 10,000&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;mytable&amp;quot; class=&amp;quot;irstats_table&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
document.observe( &amp;quot;dom:loaded&amp;quot;, function() {&lt;br /&gt;
&lt;br /&gt;
        new EPJS_Stats_Table( {&lt;br /&gt;
                &#039;context&#039;: { &#039;irs2report&#039;: &#039;most_popular_eprints&#039;, &#039;range&#039;: &#039;_ALL_&#039;, &#039;datatype&#039;: &#039;downloads&#039;},&lt;br /&gt;
                &#039;options&#039;: { &#039;container_id&#039;: &#039;mytable&#039;, &#039;top&#039;: &#039;eprint&#039;, &#039;view&#039;: &#039;Table&#039;, &#039;limit&#039;: &#039;5&#039; }   &lt;br /&gt;
        } );&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
Graphs and Tables are the most common displays, but there are a few other ones to explore. The javascript classes are in 90_irstats2.js and the associated PERL Class in Stats/View/&lt;br /&gt;
&lt;br /&gt;
*GoogleSpark: similar to GoogleGraph but shows a sparkline instead (which is essentially a tiny graph).&lt;br /&gt;
*GoogleGeoChart: country map&lt;br /&gt;
*GooglePieChart: a pie chart&lt;br /&gt;
*Counter: a simple counter (for instance to show the download count for your repository).&lt;br /&gt;
&lt;br /&gt;
The View prefixed by &amp;quot;Google&amp;quot; means that they are rendered by the Google Chart Javascript library. Important note: no data is sent to Google! The data is, instead, drawn by the browser client using SVG.&lt;br /&gt;
&lt;br /&gt;
== Example: Creating a processor for citation statistics ==&lt;br /&gt;
&lt;br /&gt;
IRStats2 can evaluate any field or combination of fields in the above mentioned datasets. For this, new datatypes and associated Stats::Processor modules must be created.&lt;br /&gt;
&lt;br /&gt;
A simple case is statistics on citation count of publications, since the datatype of the associated field is a scalar.&lt;br /&gt;
&lt;br /&gt;
Citation counts can be harvested using the [http://files.eprints.org/815/  Citation count dataset and import plugins] from Queensland University of Technology. Upon following the installation procedure, the fields scopus_impact, wos_impact and gscholar_impact are created in the EPrint table.&lt;br /&gt;
&lt;br /&gt;
=== Modifying an existing Processor module ===&lt;br /&gt;
&lt;br /&gt;
We create now a Processor module that evaluates the scopus_impact field and provides a scopus_citations datatype. &lt;br /&gt;
&lt;br /&gt;
First, we inspect the Stats::Processor::EPrint Processor modules to find out which Processor module is best suited for adapting. A good candidate is lib/plugins/EPrints/Plugin/Stats/Processor/EPrint/DocumentAccess.pm. We copy it to archives/{repo}/cfg/plugins/EPrints/Plugin/Stats/Process/EPrint/ScopusCitations.pm and modify it as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package EPrints::Plugin::Stats::Processor::EPrint::ScopusCitations;&lt;br /&gt;
&lt;br /&gt;
our @ISA = qw/ EPrints::Plugin::Stats::Processor /;&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
sub new&lt;br /&gt;
{&lt;br /&gt;
	my( $class, %params ) = @_;&lt;br /&gt;
	my $self = $class-&amp;gt;SUPER::new( %params );&lt;br /&gt;
&lt;br /&gt;
#  provide the name of the datatype&lt;br /&gt;
	$self-&amp;gt;{provides} = [ &amp;quot;scopus_citations&amp;quot; ];&lt;br /&gt;
&lt;br /&gt;
	$self-&amp;gt;{disable} = 0;&lt;br /&gt;
&lt;br /&gt;
	return $self;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sub process_record&lt;br /&gt;
{&lt;br /&gt;
	my ($self, $eprint ) = @_;&lt;br /&gt;
&lt;br /&gt;
	my $epid = $eprint-&amp;gt;get_id;&lt;br /&gt;
	return unless( defined $epid );&lt;br /&gt;
&lt;br /&gt;
	my $status = $eprint-&amp;gt;get_value( &amp;quot;eprint_status&amp;quot; );&lt;br /&gt;
	unless( defined $status ) &lt;br /&gt;
	{&lt;br /&gt;
##		print STDERR &amp;quot;IRStats2: warning - status not set for eprint=&amp;quot;.$eprint-&amp;gt;get_id.&amp;quot;\n&amp;quot;;&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return unless( $status eq &#039;archive&#039; );&lt;br /&gt;
&lt;br /&gt;
	my $datestamp = $eprint-&amp;gt;get_value( &amp;quot;datestamp&amp;quot; ) || $eprint-&amp;gt;get_value( &amp;quot;lastmod&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	my $date = $self-&amp;gt;parse_datestamp( $self-&amp;gt;{session}, $datestamp );&lt;br /&gt;
&lt;br /&gt;
	my $year = $date-&amp;gt;{year};&lt;br /&gt;
	my $month = $date-&amp;gt;{month};&lt;br /&gt;
	my $day = $date-&amp;gt;{day};&lt;br /&gt;
&lt;br /&gt;
# get the citation count&lt;br /&gt;
	my $scopus_citation_count = $eprint-&amp;gt;get_value( &amp;quot;scopus_impact&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
# store the citation count per eprint id&lt;br /&gt;
	if (defined $scopus_citation_count)&lt;br /&gt;
	{&lt;br /&gt;
		$self-&amp;gt;{cache}-&amp;gt;{&amp;quot;$year$month$day&amp;quot;}-&amp;gt;{$epid}-&amp;gt;{scopus} = $scopus_citation_count;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to enable the new Processor plugin in our IRStats2 configuration file. In the Bazaar config section, add the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$c-&amp;gt;{plugins}{&amp;quot;Stats::Processor::EPrint::ScopusCitations&amp;quot;}{params}{disable} = 0;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Reports section, we can add now a new citation report that uses the scopus_citations datatype:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        citations =&amp;gt; {&lt;br /&gt;
                items =&amp;gt; [&lt;br /&gt;
                { plugin =&amp;gt; &#039;ReportHeader&#039; },&lt;br /&gt;
                {&lt;br /&gt;
                        plugin =&amp;gt; &#039;Grid&#039;,&lt;br /&gt;
                        options =&amp;gt; {&lt;br /&gt;
                                items =&amp;gt; [&lt;br /&gt;
                                {&lt;br /&gt;
                                        plugin =&amp;gt; &#039;Table&#039;,&lt;br /&gt;
                                        datatype =&amp;gt; &#039;scopus_citations&#039;,&lt;br /&gt;
                                        options =&amp;gt; {&lt;br /&gt;
                                                limit =&amp;gt; 10,&lt;br /&gt;
                                                top =&amp;gt; &#039;eprint&#039;,&lt;br /&gt;
                                                title_phrase =&amp;gt; &#039;top_scopus_citations&#039;,&lt;br /&gt;
                                        },&lt;br /&gt;
                                },]&lt;br /&gt;
                        },&lt;br /&gt;
                },&lt;br /&gt;
                {&lt;br /&gt;
                        plugin =&amp;gt; &#039;Grid&#039;,&lt;br /&gt;
                        options =&amp;gt; {&lt;br /&gt;
                                items =&amp;gt; [&lt;br /&gt;
                                {&lt;br /&gt;
                                        plugin =&amp;gt; &#039;Table&#039;,&lt;br /&gt;
                                        datatype =&amp;gt; &#039;scopus_citations&#039;,&lt;br /&gt;
                                        options =&amp;gt; {&lt;br /&gt;
                                                limit =&amp;gt; 10,&lt;br /&gt;
                                                top =&amp;gt; &#039;authors&#039;,&lt;br /&gt;
                                                title_phrase =&amp;gt; &#039;top_scopus_citations_authors&#039;&lt;br /&gt;
                                        }&lt;br /&gt;
                                },]&lt;br /&gt;
                        },&lt;br /&gt;
                },&lt;br /&gt;
                ],&lt;br /&gt;
                category =&amp;gt; &#039;advanced&#039;,&lt;br /&gt;
        },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, the phrases in irstats2.xml must be completed accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Generalization ===&lt;br /&gt;
&lt;br /&gt;
For each citation datum, a processor module is required. We see, that these will differ only slightly,&lt;br /&gt;
namely in the datatype declaration in the new() method, and in the processing of the citation datum field &lt;br /&gt;
in the last part of the process_record() method. Therefore, we can generalize the processor by providing &lt;br /&gt;
an abstract value tracker module. It does the following:&lt;br /&gt;
&lt;br /&gt;
In the new() method, it provides an abstract value tracker datatype. Note that the plugin is disabled.&lt;br /&gt;
In the process_record() method, it makes reference to the field that is processed and a value_id to where the value will be stored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package EPrints::Plugin::Stats::Processor::EPrint::AbstractValueTracker;&lt;br /&gt;
&lt;br /&gt;
our @ISA = qw/ EPrints::Plugin::Stats::Processor /;&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
sub new&lt;br /&gt;
{&lt;br /&gt;
	my( $class, %params ) = @_;&lt;br /&gt;
	my $self = $class-&amp;gt;SUPER::new( %params );&lt;br /&gt;
	&lt;br /&gt;
	$self-&amp;gt;{provides} = [ &amp;quot;abstract_value_tracker&amp;quot; ];&lt;br /&gt;
	$self-&amp;gt;{disable} = 1;&lt;br /&gt;
	&lt;br /&gt;
	$self-&amp;gt;{field_id} = &#039;DEFINE IN SUBCLASS&#039;;&lt;br /&gt;
	$self-&amp;gt;{value_id} = &#039;DEFINE IN SUBCLASS&#039;;&lt;br /&gt;
	&lt;br /&gt;
	return $self;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sub process_record&lt;br /&gt;
{&lt;br /&gt;
	my ($self, $eprint ) = @_;&lt;br /&gt;
	&lt;br /&gt;
	my $epid = $eprint-&amp;gt;get_id;&lt;br /&gt;
	return unless( defined $epid );&lt;br /&gt;
&lt;br /&gt;
	my $status = $eprint-&amp;gt;get_value( &amp;quot;eprint_status&amp;quot; );&lt;br /&gt;
	unless( defined $status )&lt;br /&gt;
	{&lt;br /&gt;
#		print STDERR &amp;quot;IRStats2: warning - status not set for eprint=&amp;quot;.$eprint-&amp;gt;get_id.&amp;quot;\n&amp;quot;;&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return unless( $status eq &#039;archive&#039; );&lt;br /&gt;
&lt;br /&gt;
	my $datestamp = $eprint-&amp;gt;get_value( &amp;quot;datestamp&amp;quot; ) || $eprint-&amp;gt;get_value( &amp;quot;lastmod&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	my $date = $self-&amp;gt;parse_datestamp( $self-&amp;gt;{session}, $datestamp );&lt;br /&gt;
&lt;br /&gt;
	my $year = $date-&amp;gt;{year};&lt;br /&gt;
	my $month = $date-&amp;gt;{month};&lt;br /&gt;
	my $day = $date-&amp;gt;{day};&lt;br /&gt;
&lt;br /&gt;
	my $value = $eprint-&amp;gt;value($self-&amp;gt;{field_id});&lt;br /&gt;
&lt;br /&gt;
	if (defined $value)&lt;br /&gt;
	{&lt;br /&gt;
		$self-&amp;gt;{cache}-&amp;gt;{&amp;quot;$year$month$day&amp;quot;}-&amp;gt;{$epid}-&amp;gt;{$self-&amp;gt;{value_id}} = $value;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, the declaration of new scalar datatypes reduces to the task to defining a subclass for each datatype, &lt;br /&gt;
and to declaring the assocation between the datatype and the field to be processed in the IRStats2 configuration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package EPrints::Plugin::Stats::Processor::EPrint::ScopusCitations;&lt;br /&gt;
&lt;br /&gt;
use EPrints::Plugin::Stats::Processor::EPrint::AbstractValueTracker;&lt;br /&gt;
our @ISA = qw/ EPrints::Plugin::Stats::Processor::EPrint::AbstractValueTracker /;&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
sub new&lt;br /&gt;
{&lt;br /&gt;
	my( $class, %params ) = @_;&lt;br /&gt;
	my $self = $class-&amp;gt;SUPER::new( %params );&lt;br /&gt;
	my $repo = $self-&amp;gt;repository;&lt;br /&gt;
&lt;br /&gt;
	$self-&amp;gt;{provides} = [ &amp;quot;scopus_citations&amp;quot; ];&lt;br /&gt;
&lt;br /&gt;
	$self-&amp;gt;{disable} = 0;&lt;br /&gt;
	&lt;br /&gt;
	$self-&amp;gt;{field_id} = $repo-&amp;gt;config(&#039;irstats2&#039;,&#039;scopus_citations&#039;,&#039;field_id&#039;);&lt;br /&gt;
	$self-&amp;gt;{value_id} = &#039;scopus&#039;;&lt;br /&gt;
&lt;br /&gt;
	return $self;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
1;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
############&lt;br /&gt;
# Datatypes&lt;br /&gt;
############&lt;br /&gt;
# Declare as $c-&amp;gt;{irstats2}-&amp;gt;{datatypename}-&amp;gt;{field_id} = &#039;fieldname&#039;;&lt;br /&gt;
&lt;br /&gt;
$c-&amp;gt;{irstats2}-&amp;gt;{scopus_citations}-&amp;gt;{field_id} = &#039;scopus_impact&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Specific requirements by Scopus and Web of Science ===&lt;br /&gt;
&lt;br /&gt;
If you have a valid API key to the Scopus and Web of Science APIs, it is allowed by both database producers to show aggregate citation counts, given that a link back to the record in the Scopus and Web of Science database and attribution to their brand is provided. I leave that to you to figure out how this can be achieved in the Table view.&lt;br /&gt;
&lt;br /&gt;
Google Scholar does not allow to harvest citation counts.&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
=== No style on stats ===&lt;br /&gt;
&lt;br /&gt;
If you attempt to view the stats panel and it does not render correctly, run generate_static and restart apache.&lt;br /&gt;
&lt;br /&gt;
=== Can&#039;t call method &amp;quot;add_trigger&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Error when running process_stats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Use of uninitialized value in concatenation (.) or string at (eval 70) line 11.&lt;br /&gt;
Use of uninitialized value in concatenation (.) or string at (eval 70) line 16.&lt;br /&gt;
Use of uninitialized value in concatenation (.) or string at (eval 70) line 19.&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------&lt;br /&gt;
---------------- EPrints System Error ----------------------------&lt;br /&gt;
------------------------------------------------------------------&lt;br /&gt;
Error in configuration:&lt;br /&gt;
Can&#039;t call method &amp;quot;add_trigger&amp;quot; on unblessed reference at /usr/share/eprints3/archives/sandbox/bin/../cfg/cfg.d/z_irstats2.pl line 162.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------&lt;br /&gt;
EPrints System Error inducing stack dump&lt;br /&gt;
 at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints.pm line 146.&lt;br /&gt;
	EPrints::abort(&amp;quot;EPrints&amp;quot;) called at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints/Config.pm line 151&lt;br /&gt;
	EPrints::Config::load_system_config() called at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints/Config.pm line 96&lt;br /&gt;
	EPrints::Config::init() called at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints.pm line 706&lt;br /&gt;
	require EPrints.pm called at /usr/share/eprints3/archives/sandbox/bin/stats/process_stats line 12&lt;br /&gt;
	main::BEGIN() called at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints.pm line 0&lt;br /&gt;
	eval {...} called at /usr/share/eprints3/archives/sandbox/bin/stats/../../../../perl_lib/EPrints.pm line 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is due to the FindBin library not working correctly.  Open the process_stats script and remove the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use lib &amp;quot;$FindBin::Bin/../../../../perl_lib&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When executing, use -I to explicitly set the EPrints perl_lib directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
perl -I/EPRINTS_ROOT/perl_lib /EPRINTS_ROOT/archives/ARCHIVEID/bin/stats/process_stats&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Argument &amp;quot;/opt/eprints3/lib/geoip/GeoIP.dat&amp;quot; isn&#039;t numeric ===&lt;br /&gt;
&lt;br /&gt;
If you see the error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Argument &amp;quot;/opt/eprints3/lib/geoip/GeoIP.dat&amp;quot; isn&#039;t numeric in subroutine entry at /opt/eprints3/lib/plugins/EPrints/Plugin/Stats/Processor/Access/Country.pm line 36, &amp;lt;DATA&amp;gt; line 960.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is due to a change in functionality of the GeoIP library.  Open the file:&lt;br /&gt;
&lt;br /&gt;
 /EPRINTS_ROOT/lib/plugins/EPrints/Plugin/Stats/Processor/Access/Country.pm&lt;br /&gt;
&lt;br /&gt;
... and replace the line:&lt;br /&gt;
&lt;br /&gt;
 $self-&amp;gt;{geoip} = $pkg-&amp;gt;new( $dat_file );&lt;br /&gt;
&lt;br /&gt;
... with ...&lt;br /&gt;
&lt;br /&gt;
 $self-&amp;gt;{geoip} = $pkg-&amp;gt;open( $dat_file );&lt;br /&gt;
&lt;br /&gt;
Remember to add a suitable comment identifying who made the change, when it was made and why.  This will make upgrading easier.&lt;br /&gt;
&lt;br /&gt;
=== process_stats locked ===&lt;br /&gt;
&lt;br /&gt;
If IRStats terminates prematurely, it can leave a lock in the database that will need to be removed.  A script has been written to release this lock, but should only be run if you are certain that IRStats2 is not currently running.  The code is available on [https://github.com/gobfrey/irstats2_clear_lock github].&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=User_Deposit_Agreement&amp;diff=16164</id>
		<title>User Deposit Agreement</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=User_Deposit_Agreement&amp;diff=16164"/>
		<updated>2023-12-04T15:48:27Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== DOCUMENTATION NOT COMPLETE ==&lt;br /&gt;
&lt;br /&gt;
== Why add a user deposit agreement? ==&lt;br /&gt;
&lt;br /&gt;
You may wish for users to explicitly comply with a set of user agreement terms and conditions. The terms may be stated in a hosted file which can be linked to or hosted within your eprints instance as a pdf or xpage file.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
EPrints 3.4 (All minor versions)&lt;br /&gt;
&lt;br /&gt;
== Process for adding a user deposit agreement ==&lt;br /&gt;
&lt;br /&gt;
To be written...&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=User_Deposit_Agreement&amp;diff=16163</id>
		<title>User Deposit Agreement</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=User_Deposit_Agreement&amp;diff=16163"/>
		<updated>2023-12-04T15:47:18Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: Created page with &amp;quot;== DOCUMENTATION NOT COMPLETE ==  == Why add a user deposit agreement? ==  You may wish for users to explicitly comply with a set of user agreement terms and conditions. The t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== DOCUMENTATION NOT COMPLETE ==&lt;br /&gt;
&lt;br /&gt;
== Why add a user deposit agreement? ==&lt;br /&gt;
&lt;br /&gt;
You may wish for users to explicitly comply with a set of user agreement terms and conditions. The terms may be stated in a hosted file which can be linked to or hosted within your eprints instance as a pdf or xpage file.&lt;br /&gt;
&lt;br /&gt;
== Process for adding a user deposit agreement ==&lt;br /&gt;
&lt;br /&gt;
To be written...&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Manual&amp;diff=16162</id>
		<title>Manual</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Manual&amp;diff=16162"/>
		<updated>2023-12-04T15:44:11Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: /* How-to Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
See the [[Main Page]] for other areas of this wiki.&lt;br /&gt;
&lt;br /&gt;
* [[Introduction|Introduction to EPrints]] and [[History|History of EPrints]] &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellpadding=&amp;quot;10&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;33%&amp;quot; valign=&amp;quot;top&amp;quot;&amp;gt; &lt;br /&gt;
= Releases =&lt;br /&gt;
{{releasenotes}}&lt;br /&gt;
&#039;&#039;See also the note on [[EPrints Version Numbering]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
{{Download}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
* [[Recommended Platforms]]&lt;br /&gt;
* [[Required software]]&lt;br /&gt;
* Install Guides&lt;br /&gt;
** [[Installing EPrints on RHEL/Fedora/CentOS]]&lt;br /&gt;
*** Primarily RedHat Enterprise Linux (RHEL) and CentOS 7 and 8.&lt;br /&gt;
*** Guides for installing from RPM package and from source.&lt;br /&gt;
** [[Installing EPrints on Debian/Ubuntu]]&lt;br /&gt;
*** Primarily Ubuntu 18.04 LTS and 20.04 LTS.&lt;br /&gt;
*** Guides for installing from Deb package and from source.&lt;br /&gt;
* [[Installation|Generic EPrints installation instructions]]&lt;br /&gt;
* [[How to use EPrints with HTTPS]]&lt;br /&gt;
** [[Setting up HTTPS using Let&#039;s Encrypt]]&lt;br /&gt;
** [[HTTPS-only and HSTS]]&lt;br /&gt;
* [[Installing EPrints using Docker]]&lt;br /&gt;
&lt;br /&gt;
= Post Installation =&lt;br /&gt;
* [[Getting Started with EPrints 3]]&lt;br /&gt;
&lt;br /&gt;
= Maintenance =&lt;br /&gt;
* [[Backups]]&lt;br /&gt;
* [[Generate Scripts]]&lt;br /&gt;
* [[Alerts]]&lt;br /&gt;
* [[Log Files]]&lt;br /&gt;
* [[Automating your maintenance]]&lt;br /&gt;
* [[Troubleshooting]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td width=&amp;quot;33%&amp;quot; valign=&amp;quot;top&amp;quot; style=&amp;quot;border-left: solid 1px #ccc; border-right: solid 1px #ccc;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Training Materials =&lt;br /&gt;
* [[:Category:Training Video|EPrints Training Course]]&lt;br /&gt;
* [http://www.eprints.org/software/training/ Training materials] provided by EPrints Services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= How-to Guides =&lt;br /&gt;
&#039;&#039;[http://en.wikipedia.org/wiki/Howto What is a how-to?]&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Howto|Orientation/Overview]] &amp;lt;span style=&amp;quot;color: #f94; font-size: 130%&amp;quot;&amp;gt;(Start here)&amp;lt;/span&amp;gt;&lt;br /&gt;
** [[Configuration orientation|New to EPrints 3?]]  - &#039;&#039;before diving into the how-tos, take some time to read through this brief orientation guide and familiarise yourself with the EPrints configuration landscape ...&#039;&#039;&lt;br /&gt;
* [[Front Page Warning | Removing the Front Page Warning]] - Your first go at branding&lt;br /&gt;
* [[Branding with confidence]] - &#039;&#039;one of the most common EPrints customisations is to add your own institution&#039;s branding and &amp;quot;look and feel&amp;quot; to the interface...&#039;&#039;&lt;br /&gt;
** [[Branding, the next level]] - &#039;&#039;how to completely change the interface to your own design&#039;&#039;&lt;br /&gt;
* [[OAI]]&lt;br /&gt;
* [[Adding new views]]&lt;br /&gt;
* Workflow&lt;br /&gt;
* Deposit Types&lt;br /&gt;
** [[Removing types]]&lt;br /&gt;
* Metadata&lt;br /&gt;
* Subjects (fold in with Organisation Hierarchy under &amp;quot;controled vocabularies&amp;quot;)&lt;br /&gt;
* [[EPrints_3_Organisation_Hierarchy|Organisation Hierarchy]] - &#039;&#039;how to put your own organisation&#039;s Hierarchy into EPrints 3&#039;&#039;&lt;br /&gt;
* Searches&lt;br /&gt;
* [[Autocompletion and Authority Files (Romeo Autocomplete)]] - &#039;&#039;add autocomplete functionality to the Publication Title input field based on an authority file downloaded from EPrints Romeo...&#039;&#039;&lt;br /&gt;
* [[Create Export Plugins]] - &#039;&#039;create a Perl Module that will export your data...&#039;&#039;&lt;br /&gt;
* [[Login-Only Repository]] - &#039;&#039;require a username and password to access all pages (including search, browse, and the front page)...&#039;&#039;&lt;br /&gt;
* [[Change Deposit Status in Bulk]] - &#039;&#039;move a large number of deposits from inbox to archive.&#039;&#039;&lt;br /&gt;
* [[SWORD]] - &#039;&#039;how to configure the SWORD protocol on EPrints.&#039;&#039;&lt;br /&gt;
* [[Custom handlers]] - &#039;&#039;how to add a custom handler for intergration with third-party applications.&#039;&#039;&lt;br /&gt;
* [[User Deposit Agreement]] - &#039;&#039;How to add a user deposit agreement to the workflow.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= How to contribute =&lt;br /&gt;
There&#039;s a number of different ways you can contribute to the EPrints project. This section covers all the ones we can think of...&lt;br /&gt;
&lt;br /&gt;
Always make an entry on http://files.eprints.org/ for your contribution, even if you don&#039;t upload the files. This will make it the one-stop place for people to find EPrints extensions.&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Documentation Needed| Create some of the missing documentation]]&lt;br /&gt;
* [[Contribute: Plugins | Plugins]]&lt;br /&gt;
* [[Contribute: Scripts | Scripts]]&lt;br /&gt;
* [[Contribute: Themes | Themes]]&lt;br /&gt;
* [[Contribute: Translations | Translations]]&lt;br /&gt;
* [[Contribute: Other | Other neighbourly things to do]]&lt;br /&gt;
* [[Extension Packages]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Misc =&lt;br /&gt;
* [[Preservation Support]] in EPrints 3&lt;br /&gt;
* [[:Category:Languages|Language support and translations]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;33%&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Technical Reference =&lt;br /&gt;
* [[EPrints Directory Structure]] - How code and configuation files are organised.&lt;br /&gt;
* [[EPrints Glossary]] - A listing of terminology used within EPrints.&lt;br /&gt;
* [[User Menu]] - Explaining the menu options available to an EPrints user.&lt;br /&gt;
* [[Admin|Admin Menu]] - Explaining the tools available to a repository administrator.&lt;br /&gt;
* [[Metadata]] - configuring metadata fields.&lt;br /&gt;
* [[Archives/ARCHIVEID/cfg/|Repository Configuration]]&lt;br /&gt;
* [[XML Configuration]] Files&lt;br /&gt;
** [[EPScript]] - documentation for the EP3 Scripting language (for use in citations and workflow files).&lt;br /&gt;
** [[EPrints Control Format]] - the structure used to embed EPScript in an XML configuration file.&lt;br /&gt;
** [[Citation Format]]&lt;br /&gt;
** [[Workflow Format]] - the structure of the EP3 workflow files&lt;br /&gt;
** [[Phrase Format]]&lt;br /&gt;
** [[Template Format]]&lt;br /&gt;
** [[XPAGE Format]]&lt;br /&gt;
* [[XML Export Format]]&lt;br /&gt;
* EPrints data structure &lt;br /&gt;
** of the software&lt;br /&gt;
** of the database (relating the dataobjects to each other using eprints fields)&lt;br /&gt;
* [[Data Object]]s and data sets&lt;br /&gt;
** The [[EPrint Object]]&lt;br /&gt;
** The [[User Object]]&lt;br /&gt;
** The [[Document Object]]&lt;br /&gt;
** The [[Subject Object]]&lt;br /&gt;
** The [[Saved Search Object]]&lt;br /&gt;
** The [[History Object]]&lt;br /&gt;
** The [[Access Object]]&lt;br /&gt;
** The [[Request Object]]&lt;br /&gt;
* [[:Category:Plugins|Plugins]]&lt;br /&gt;
** [[Create Export Plugins|Export]]&lt;br /&gt;
** Import &lt;br /&gt;
** [[Screen Plugins|Screen]]&lt;br /&gt;
* [[Autocompletion]]&lt;br /&gt;
** [[Understanding IDs in Workflow Forms]]&lt;br /&gt;
* [[API]]&lt;br /&gt;
* [[Dynamic Template System]]&lt;br /&gt;
&lt;br /&gt;
= The EPrints Bazaar =&lt;br /&gt;
* [[:Category:EPrints_Bazaar|The EPrints Bazaar]] (Start Here)&lt;br /&gt;
* The [[EPM Specification]]&lt;br /&gt;
* [[:Category:Bazaar_Package|Bazaar Packages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=ReCollect&amp;diff=16161</id>
		<title>ReCollect</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=ReCollect&amp;diff=16161"/>
		<updated>2023-12-01T12:44:37Z</updated>

		<summary type="html">&lt;p&gt;Ejo1f20: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Bazaar_Package]]&lt;br /&gt;
[[Category:Documentation_Needed]]&lt;br /&gt;
[[Category:EPrints_3_Plugins]]&lt;br /&gt;
&lt;br /&gt;
{{Deprecated|This plugin is not supported. The recollect plugin is 10+ years old and has not been updated to work with modern versions of EPrints (3.4+). Installing this is not recommended.}}&lt;br /&gt;
&lt;br /&gt;
ReCollect is a Bazaar package for EPrints which transforms an EPrints install into a research data repository. Fields are compliant with the DataCite and INSPIRE metadata schema. This plugin was created by the UK Data Archive led Research Data @Essex project (http://www.data-archive.ac.uk/create-manage/projects/rd-essex). Thanks to the DataPool project at the University of Southampton (http://datapool.soton.ac.uk/) for their assistance in packaging the plugin. &lt;br /&gt;
&lt;br /&gt;
ReCollect lowers the barrier for deploying a full-featured and standards compliant research data repository. The only prerequisite is a clean EPrints install. From there, a user with an administrative account can use the EPrints Bazaar option in the System Tools menu to install ReCollect with just one click. &lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
ReCollect features are too numerous to document here in their entirety, but can be summarised as follows:&lt;br /&gt;
&lt;br /&gt;
* Redesigned Abstract page to present complex data collections, consisting of many files of different types.  &lt;br /&gt;
&lt;br /&gt;
* Expanded metadata profile to describe research data, built on the DataCite, INSPIRE and Data Documentation Initiative (2.1) metadata schemas. The metadata profile used has been published by the UK Data Archive (http://www.data-archive.ac.uk/media/375386/rde_eprints_metadataprofile.pdf). &lt;br /&gt;
&lt;br /&gt;
* Many tweaks to workflow and validations. &lt;br /&gt;
&lt;br /&gt;
* Revised and expanded field labels and help phrases. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Can I install ReCollect on a pre-populated repository?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is possible to integrate ReCollect with an existing repository; however this would require edits to the code in order to switch back on features that ReCollect hides, namely the Eprint Type selection as the first stage of deposit (e.g. Article, Book, Dataset etc). This is not how ReCollect was tended to be used, so we would only recommend you do this if you are confident working with the EPrints code base.&lt;br /&gt;
&lt;br /&gt;
== Further information ==&lt;br /&gt;
&lt;br /&gt;
The following outputs of the Research Data @Essex project may be of interest to users of ReCollect:&lt;br /&gt;
&lt;br /&gt;
* Research data repository policies devised for the University of Essex pilot (http://www.data-archive.ac.uk/media/391126/rdessex_recollectpolicies.pdf)&lt;br /&gt;
&lt;br /&gt;
* User documentation created for the University of Essex pilot, aimed at helping research prepare and deposit data (http://www.data-archive.ac.uk/media/391123/rdessex_recollectuserguide.pdf)&lt;br /&gt;
&lt;br /&gt;
* The metadata profile (http://www.data-archive.ac.uk/media/375386/rde_eprints_metadataprofile.pdf) used by ReCollect and the mapping on which it is based (http://www.data-archive.ac.uk/media/375383/rde_eprints_metadatamapping.pdf)&lt;br /&gt;
&lt;br /&gt;
A full report on the development of the ReCollect plugin and the rationale behind it will be published shortly, and a link added here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Contact&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please contact Alexis Wolton with any queries regarding use of the plugin: [mailto:awolton@essex.ac.uk awolton@essex.ac.uk]&lt;/div&gt;</summary>
		<author><name>Ejo1f20</name></author>
	</entry>
</feed>