Uncaught Guzzle exception when validating CAS ticket takes too long

Created on 22 October 2024, 6 months ago

Problem/Motivation

When validating a CAS auth ticket, we have this code:

    try {
      $response = $this->httpClient->get($validate_url, $casServerConfig->getCasServerGuzzleConnectionOptions());
      $response_data = $response->getBody()->__toString();
      $this->casHelper->log(LogLevel::DEBUG, "Validation response received from CAS server: %data", ['%data' => $response_data]);
    }
    catch (RequestException $e) {
      throw new CasValidateException("Error with request to validate ticket: " . $e->getMessage());
    }

We should be catching more types of Guzzle exceptions. Here's Guzzle's exception tree (taken from their docs).

. \RuntimeException
└── TransferException (implements GuzzleException)
    ├── ConnectException (implements NetworkExceptionInterface)
    └── RequestException
        ├── BadResponseException
        │   ├── ServerException
        │   └── ClientException
        └── TooManyRedirectsException

We're missing catching a ConnectException, which will be thrown if a connection timeout with the CAS server is reached. This happened with us, as we have our connection timeout set to 10 seconds, and our CAS server was overloaded and slow to respond.

Steps to reproduce

Proposed resolution

Catch a TransferException here.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

CAS

Created by

🇺🇸United States bkosborne New Jersey, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024