Skip to content

Commit fe7cd9f

Browse files
committed
Be able to configure curl verify -host and peer
1 parent b8b533e commit fe7cd9f

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "coddin-web/oidc-client-laravel-wrapper",
33
"description": "A Laravel wrapper of jumbojett's OpenID Connect Client",
44
"type": "library",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"minimum-stability": "stable",
77
"prefer-stable": true,
88
"require": {

config/oidc.php

+4
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
'token_storage' => [
1818
'adaptor' => null,
1919
],
20+
'curl' => [
21+
'verify_host' => env('OIDC_CURL_VERIFY_HOST', true),
22+
'verify_peer' => env('OIDC_CURL_VERIFY_PEER', true),
23+
],
2024
];

src/Builder/OpenIDConnectClientBuilder.php

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function execute(): OpenIDConnectClient
3434
$openIDClient->setCodeChallengeMethod('S256');
3535
}
3636

37+
$openIDClient->setVerifyHost($this->configRepository->getAsBool('oidc.curl.verify_host'));
38+
$openIDClient->setVerifyPeer($this->configRepository->getAsBool('oidc.curl.verify_peer'));
39+
3740
$openIDClient->setRedirectURL(
3841
url: rtrim($appUrl, '/') . $this->configRepository->getAsString('oidc.client.redirect_url'),
3942
);

tests/Unit/Builder/OpenIDConnectClientBuilderTest.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,19 @@ public function authorization_code_flow(): void
5151
);
5252

5353
$this->configRepository
54-
->expects(self::exactly(2))
54+
->expects(self::exactly(4))
5555
->method('getAsBool')
5656
->withConsecutive(
5757
['oidc.client.use_pkce'],
5858
['oidc.client.use_pkce'],
59+
['oidc.curl.verify_host'],
60+
['oidc.curl.verify_peer'],
5961
)
6062
->willReturnOnConsecutiveCalls(
6163
false,
6264
false,
65+
true,
66+
true,
6367
);
6468

6569
$openIdConnectBuilder = new OpenIDConnectClientBuilder(
@@ -101,15 +105,19 @@ public function authorization_code_flow_with_PKCE(): void
101105
);
102106

103107
$this->configRepository
104-
->expects(self::exactly(2))
108+
->expects(self::exactly(4))
105109
->method('getAsBool')
106110
->withConsecutive(
107111
['oidc.client.use_pkce'],
108112
['oidc.client.use_pkce'],
113+
['oidc.curl.verify_host'],
114+
['oidc.curl.verify_peer'],
109115
)
110116
->willReturnOnConsecutiveCalls(
111117
true,
112118
true,
119+
true,
120+
true,
113121
);
114122

115123
$openIdConnectBuilder = new OpenIDConnectClientBuilder(

0 commit comments

Comments
 (0)