Skip to content

Commit

Permalink
Merge pull request #533 from gregcorbett/missing_x509_handling
Browse files Browse the repository at this point in the history
Improve handling when no certificate is provided.
  • Loading branch information
gregcorbett authored Jan 24, 2025
2 parents 5474afb + 4a58855 commit 9bf0d4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Authentication/AuthTokens/X509AuthenticationToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ private function getDN() {
$Raw_Client_Certificate = $_SERVER['SSL_CLIENT_CERT'];
if (isset($Raw_Client_Certificate)) {
$Plain_Client_Cerfificate = openssl_x509_parse($Raw_Client_Certificate);

// $Plain_Client_Cerfificate will be an array in the presence of
// a certificate, otherwise, it will be `false`.
if (is_array($Plain_Client_Cerfificate)) {
// Then no valid certificate was provided.
return;
}

$User_DN = $Plain_Client_Cerfificate['name'];
if (isset($User_DN)) {
// Check that the dn does not contain a backslash - utf8 chars
Expand Down

0 comments on commit 9bf0d4c

Please sign in to comment.