Changeset 3781 for TI12-security/trunk


Ignore:
Timestamp:
14/04/08 11:44:19 (12 years ago)
Author:
pjkersha
Message:

Added catch for NDG::Security::Client object creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/perl/ndgaccess.pl

    r3780 r3781  
    1414my $cfgFilePath = "/var/www/cgi-bin/NDG/Security/conf/ndg-security-client.cfg"; 
    1515my $session = eval {new NDG::Security::Client($cfgFilePath, $cgi)}; 
    16  
    17 # Call Single Sign On handler 
    18 my $redirectHdr = $session->ssoHandler(); 
    19 if ($redirectHdr) 
     16if ($@) 
    2017{ 
    21     # A redirect header has been created indicating  
    22     # 1) the handler has received a response from a Single Sign Service 
    23     # or 
    24     # 2) User is not logged in - redirecting to WAYF 
    25     print $redirectHdr; 
    26 } 
    27 else 
    28 { 
    29     # Check access for this page 
    30     my $dir = "/var/www/cgi-bin/"; 
    31     my $msg; 
    32      
    33     my $accessDecision = $session->pep($dir); 
    34      
    3518    print $cgi->header('text/html'); 
    3619    print $cgi->start_html('NDG Secured Resource'), 
    3720    $cgi->h1('NDG Secured Resource'), 
    38     $accessDecision->{msg}, $cgi->p, 
     21    "An error occured initialising the security configuration", $cgi->p, 
    3922    $cgi->hr; 
    4023     
    4124    print $cgi->end_html; 
    4225} 
    43      
     26else 
     27{ 
     28    # Call Single Sign On handler 
     29    my $redirectHdr = $session->ssoHandler(); 
     30    if ($redirectHdr) 
     31    { 
     32        # A redirect header has been created indicating  
     33        # 1) the handler has received a response from a Single Sign Service 
     34        # or 
     35        # 2) User is not logged in - redirecting to WAYF 
     36        print $redirectHdr; 
     37    } 
     38    else 
     39    { 
     40        # Check access for this page 
     41        my $dir = "/var/www/cgi-bin/"; 
     42        my $msg; 
     43         
     44        my $accessDecision = $session->pep($dir); 
     45         
     46        print $cgi->header('text/html'); 
     47        print $cgi->start_html('NDG Secured Resource'), 
     48        $cgi->h1('NDG Secured Resource'), 
     49        $accessDecision->{msg}, $cgi->p, 
     50        $cgi->hr; 
     51         
     52        print $cgi->end_html; 
     53    } 
     54} 
Note: See TracChangeset for help on using the changeset viewer.