Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/perl/ndglogin.pl@3781
Revision 3780,
964 bytes
checked in by pjkersha, 13 years ago
(diff) |
Working version of NDG Security Perl client - acts as a client to Single
Sign On and Gatekeeper.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/usr/bin/env perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use CGI; |
---|
6 | #use ndgsecurity::ssoclient; |
---|
7 | use NDG::Security::Client; |
---|
8 | |
---|
9 | my $cgi = CGI->new(); |
---|
10 | my $cfgFilePath = "/var/www/cgi-bin/NDG/Security/conf/ndg-security-client.cfg"; |
---|
11 | my $session = eval {new NDG::Security::Client($cfgFilePath, $cgi)}; |
---|
12 | |
---|
13 | # Call Single Sign On handler |
---|
14 | my $redirectHdr = $session->ssoHandler(); |
---|
15 | if ($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 | } |
---|
21 | else |
---|
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.