Permalink
Browse files

allow the oauth provider hostname to be overridden

  • Loading branch information...
1 parent 8de4f42 commit def5ceb5732d88aeb2bea7e396c1a900a47b3d2b @atmos atmos committed Mar 2, 2012
Showing with 7 additions and 5 deletions.
  1. +4 −4 lib/warden-github/proxy.rb
  2. +1 −0 lib/warden-github/strategy.rb
  3. +1 −1 lib/warden-github/version.rb
  4. +1 −0 spec/app.rb
@@ -2,9 +2,9 @@ module Warden
module Github
module Oauth
class Proxy
- attr_accessor :client_id, :secret, :scopes, :callback_url
- def initialize(client_id, secret, scopes, callback_url)
- @client_id, @secret, @scopes, @callback_url = client_id, secret, scopes, callback_url
+ attr_accessor :client_id, :secret, :scopes, :oauth_domain, :callback_url
+ def initialize(client_id, secret, scopes, oauth_domain, callback_url)
+ @client_id, @secret, @scopes, @oauth_domain, @callback_url = client_id, secret, scopes, oauth_domain, callback_url
end
def ssl_options
@@ -19,7 +19,7 @@ def ssl_options
def client
@client ||= OAuth2::Client.new(@client_id, @secret,
:ssl => ssl_options,
- :site => 'https://github.com',
+ :site => oauth_domain,
:token_url => '/login/oauth/access_token',
:authorize_url => '/login/oauth/authorize')
end
@@ -43,6 +43,7 @@ def oauth_proxy
@oauth_proxy ||= Warden::Github::Oauth::Proxy.new(env['warden'].config[:github_client_id],
env['warden'].config[:github_secret],
env['warden'].config[:github_scopes],
+ env['warden'].config[:github_oauth_domain],
callback_url)
end
@@ -1,5 +1,5 @@
module Warden
module Github
- VERSION = "0.3.1"
+ VERSION = "0.4.0"
end
end
View
@@ -14,6 +14,7 @@ class App < Sinatra::Base
manager[:github_secret] = ENV['GITHUB_CLIENT_SECRET'] || 'ed8ff0c54067aefb808dab1ca265865405d08d6f'
manager[:github_scopes] = ''
+ manager[:github_oauth_domain] = ENV['GITHUB_OAUTH_DOMAIN'] || 'https://github.com'
manager[:github_callback_url] = '/auth/github/callback'
end

0 comments on commit def5ceb

Please sign in to comment.