Project

General

Profile

« Previous | Next » 

Revision 9545

Added by Chris Jones over 8 years ago

Modify getCredentials() to support token-based credentials.

refs https://github.nceas.ucsb.edu/KNB/arctic-data/issues/42

View differences:

register-dataset.cgi
3798 3798
#
3799 3799
################################################################################
3800 3800
sub getCredentials {
3801
    
3801 3802
	my $userDN   = $FORM::username;
3802 3803
	my $userOrg  = $FORM::organization;
3803 3804
	my $userPass = $FORM::password;
3804 3805
	my $authBase = $properties->getProperty("auth.base");
3805 3806
	my $dname    = "uid=$userDN,o=$userOrg,$authBase";
3807
    my $token_info;
3808
    
3809
    if ( hasValidAuthToken() ) {
3810
        $token_info = getTokenInfo();
3811
        $dname = $token_info->{'sub'};
3812
        
3813
    } else {
3814
    	my $session = CGI::Session->load();
3815
    	if ( !( $session->is_empty || $session->is_expired ) ) {
3816
    		$dname    = $session->param("username");
3817
    		$userPass = $session->param("password");
3818
    	}
3819
        
3820
    }
3806 3821

  
3807
	my $session = CGI::Session->load();
3808
	if ( !( $session->is_empty || $session->is_expired ) ) {
3809
		$dname    = $session->param("username");
3810
		$userPass = $session->param("password");
3811
	}
3812

  
3813 3822
	return ( $dname, $userPass );
3814 3823
}
3815 3824

  

Also available in: Unified diff