diff --git a/CHANGELOG.md b/CHANGELOG.md index bdbfd038..106f5dba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Support for signed and encrypted ID Token. #305 * Update construct typehint in docblock. #364 * Fixed LogoutToken verification for single value aud claims #334 +* Added function to set useragent #370 ### Added - Support for signed and encrypted UserInfo response. #305 diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php index ba4fddef..8081134f 100644 --- a/src/OpenIDConnectClient.php +++ b/src/OpenIDConnectClient.php @@ -1367,6 +1367,7 @@ protected function fetchURL(string $url, string $post_body = null, array $header // Allows to keep the POST method even after redirect curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body); + curl_setopt($ch, CURLOPT_USERAGENT, $this->getUserAgent()); // Default content type is form encoded $content_type = 'application/x-www-form-urlencoded'; @@ -2058,4 +2059,9 @@ public function supportsAuthMethod(string $auth_method, array $token_endpoint_au return in_array($auth_method, $token_endpoint_auth_methods_supported, true); } + + protected function getUserAgent(): string + { + return "jumbojett/OpenID-Connect-PHP"; + } }