Skip to content

Commit

Permalink
Add a message in CAS_AuthenticationException
Browse files Browse the repository at this point in the history
  • Loading branch information
Baldinof committed Jun 2, 2016
1 parent e3dff67 commit e683b89
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions source/CAS/AuthenticationException.php
Expand Up @@ -68,6 +68,7 @@ class CAS_AuthenticationException
public function __construct($client,$failure,$cas_url,$no_response,
$bad_response='',$cas_response='',$err_code='',$err_msg=''
) {
$messages = array();
phpCAS::traceBegin();
$lang = $client->getLangObj();
$client->printHTMLHeader($lang->getAuthenticationFailed());
Expand All @@ -76,32 +77,34 @@ public function __construct($client,$failure,$cas_url,$no_response,
htmlentities($client->getURL()),
isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:''
);
phpCAS::trace('CAS URL: '.$cas_url);
phpCAS::trace('Authentication failure: '.$failure);
phpCAS::trace($messages[] = 'CAS URL: '.$cas_url);
phpCAS::trace($messages[] = 'Authentication failure: '.$failure);
if ( $no_response ) {
phpCAS::trace('Reason: no response from the CAS server');
phpCAS::trace($messages[] = 'Reason: no response from the CAS server');
} else {
if ( $bad_response ) {
phpCAS::trace('Reason: bad response from the CAS server');
phpCAS::trace($messages[] = 'Reason: bad response from the CAS server');
} else {
switch ($client->getServerVersion()) {
case CAS_VERSION_1_0:
phpCAS::trace('Reason: CAS error');
phpCAS::trace($messages[] = 'Reason: CAS error');
break;
case CAS_VERSION_2_0:
case CAS_VERSION_3_0:
if ( empty($err_code) ) {
phpCAS::trace('Reason: no CAS error');
phpCAS::trace($messages[] = 'Reason: no CAS error');
} else {
phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
phpCAS::trace($messages[] = 'Reason: ['.$err_code.'] CAS error: '.$err_msg);
}
break;
}
}
phpCAS::trace('CAS response: '.$cas_response);
phpCAS::trace($messages[] = 'CAS response: '.$cas_response);
}
$client->printHTMLFooter();
phpCAS::traceExit();

parent::__construct(implode("\n", $messages));
}

}
Expand Down

0 comments on commit e683b89

Please sign in to comment.