source: TI12-security/trunk/perl/ndglogin.pl @ 3775

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/perl/ndglogin.pl@3775
Revision 3775, 920 bytes checked in by pjkersha, 12 years ago (diff)

Working Perl NDG Single Sign On client.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5use CGI;
6#use ndgsecurity::ssoclient;
7use NDG::Security::Client;
8
9my $cgi = CGI->new();
10#my $session = ndgsecurity::ssoclient->new($cgi);
11my $session = eval {new NDG::Security::Client($cgi)};
12
13# Call Single Sign On handler
14my $redirectHdr = $session->ssoHandler();
15if ($redirectHdr)
16{
17    # A redirect header has created indicating the handler has received a response from
18    # a Single Sign Service
19    print $redirectHdr;
20}
21else
22{
23    # Create a form based on the WAYF address and encoded return to address formulated by
24    # ssoHandler
25    print $cgi->header('text/html');
26    print $cgi->start_html('NDG Login'),
27    $cgi->h1('NDG Login'),
28    $cgi->start_form(-action=>$session->{wayfURI}),
29    $cgi->hidden('r', $session->{b64encReturnToURL}), $cgi->br,
30    $cgi->submit('NDG Login'),
31    $cgi->end_form, $cgi->p,
32    $cgi->hr;
33   
34    print $cgi->end_html;
35}
36   
Note: See TracBrowser for help on using the repository browser.