Skip to content

Commit 19f6366

Browse files
authored
Merge pull request #102 from thatch-health/mtls-basic
Add support for endpoints requiring mTLS with HTTP Basic Authentication
2 parents 3d4107c + cc39f8c commit 19f6366

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## [Unreleased]
22

3+
- add support for endpoints requiring mTLS with HTTP Basic Authentication
4+
35
## [2.2.0] - 2022-10-11
46

57
### Changed

lib/rack/oauth2/client.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ def authenticated_context_from(*args)
182182
)
183183
http_client.ssl.client_key = private_key
184184
http_client.ssl.client_cert = certificate
185+
when :mtls_basic
186+
http_client.ssl.client_key = private_key
187+
http_client.ssl.client_cert = certificate
188+
cred = Base64.strict_encode64 [
189+
Util.www_form_url_encode(identifier),
190+
Util.www_form_url_encode(secret)
191+
].join(':')
192+
headers.merge!(
193+
'Authorization' => "Basic #{cred}"
194+
)
185195
else
186196
params.merge!(
187197
client_id: identifier,

0 commit comments

Comments
 (0)