Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Archive:Shibboleth authentication
(section)
Archive
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===The ''context URL''=== The script for reading the authentication details needs to be within the EPrints server, and ideally protected by a secure (<code>https</code>) connection. I called mine <code>/cgi/shibb</code> (not very imaginative, but what the heck). If you have the script behind an https connection, it probably won't be in <code>/cgi</code>... The actual code is very simple: get the EPrints session code from the EPpints cookie, and use that as the index for the data supplied by the Shibboleth authentication server. We store the user identification details in a table and not pass them via a URL as this minimises the opportunities for spoofing an authenticated user. <pre> use EPrints; use strict; my $context; my $puid; my $orgid; my $uri; my $code; my $session = new EPrints::Session; exit( 0 ) unless( defined $session ); $context = $session->param('context'); $context =~ /code=(\w+)$/; $code = $1; # $r->param('code'); if ( EPrints::Utils::is_set( $code ) ) { if ( $ENV{'REMOTE_ADDR'} =~ &&IP_NUMBER_OF_AUTHENTICATION_SERVER ) { $puid = $session->param('id' ); $orgid = $session->param('rorg'); my $sql = "REPLACE INTO auth_tickets VALUES( '". EPrints::Database::prep_value($code). # the ticket-code "', '". EPrints::Database::prep_value($puid). # puid "', '". EPrints::Database::prep_value($orgid). # orgid "', ". (time+60*5). # expire-time (5 minutes from now) " )"; my $sth = $session->{'database'}->do( $sql ); $uri = "$context"; } else { $uri = $session->get_repository->get_conf( "base_url" )."cgi/register"; } print "$uri\n"; exit; } else { my %opts = (); my @a = (); for(1..16) { push @a, sprintf( "%02X",int rand 256 ); } $opts{code} = join( "", @a ); $session->set_cookies( %opts ); $session->redirect( $session->get_repository->get_conf( "base_url" )."cgi/register" ); $session->terminate; return Apache2::Const::DONE; } print "$uri\n"; exit; </pre>
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)