Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration of ssl cert store #68

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/rack/oauth2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module OAuth2
class Client
include AttrRequired, AttrOptional
attr_required :identifier
attr_optional :secret, :private_key, :certificate, :redirect_uri, :scheme, :host, :port, :authorization_endpoint, :token_endpoint
attr_optional :secret, :private_key, :certificate, :redirect_uri, :scheme, :host, :port, :authorization_endpoint, :token_endpoint, :ssl_cert_file_or_dir, :use_system_ssl

def initialize(attributes = {})
(required_attributes + optional_attributes).each do |key|
Expand Down Expand Up @@ -70,7 +70,10 @@ def force_token_type!(token_type)

def access_token!(*args)
headers, params = {}, @grant.as_json

http_client = Rack::OAuth2.http_client
http_client.ssl_config.set_default_paths if use_system_ssl
http_client.ssl_config.add_trust_ca(ssl_cert_file_or_dir) if ssl_cert_file_or_dir

# NOTE:
# Using Array#estract_options! for backward compatibility.
Expand Down