Skip to content

Commit

Permalink
Merge pull request #76 from nov/feature/mtls_on_userinfo
Browse files Browse the repository at this point in the history
mTLS access token
  • Loading branch information
nov authored Oct 10, 2022
2 parents 1620778 + ac71875 commit 6682dd7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/openid_connect/access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def userinfo!(params = {})
ResponseObject::UserInfo.new hash
end

def to_mtls(attributes = {})
(required_attributes + optional_attributes).each do |key|
attributes[key] = self.send(key)
end
MTLS.new attributes
end

private

def resource_request
Expand All @@ -33,4 +40,6 @@ def resource_request
end
end
end
end
end

require 'openid_connect/access_token/mtls'
9 changes: 9 additions & 0 deletions lib/openid_connect/access_token/mtls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module OpenIDConnect
class AccessToken::MTLS < AccessToken
def initialize(attributes = {})
super
http_client.ssl.client_key = attributes[:private_key] || client.private_key
http_client.ssl.client_cert = attributes[:certificate] || client.certificate
end
end
end

0 comments on commit 6682dd7

Please sign in to comment.