Skip to content

Commit

Permalink
allow the oauth provider hostname to be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
atmos committed Mar 2, 2012
1 parent 8de4f42 commit def5ceb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/warden-github/proxy.rb
Expand Up @@ -2,9 +2,9 @@ module Warden
module Github module Github
module Oauth module Oauth
class Proxy class Proxy
attr_accessor :client_id, :secret, :scopes, :callback_url attr_accessor :client_id, :secret, :scopes, :oauth_domain, :callback_url
def initialize(client_id, secret, scopes, callback_url) def initialize(client_id, secret, scopes, oauth_domain, callback_url)
@client_id, @secret, @scopes, @callback_url = client_id, secret, scopes, callback_url @client_id, @secret, @scopes, @oauth_domain, @callback_url = client_id, secret, scopes, oauth_domain, callback_url
end end


def ssl_options def ssl_options
Expand All @@ -19,7 +19,7 @@ def ssl_options
def client def client
@client ||= OAuth2::Client.new(@client_id, @secret, @client ||= OAuth2::Client.new(@client_id, @secret,
:ssl => ssl_options, :ssl => ssl_options,
:site => 'https://github.com', :site => oauth_domain,
:token_url => '/login/oauth/access_token', :token_url => '/login/oauth/access_token',
:authorize_url => '/login/oauth/authorize') :authorize_url => '/login/oauth/authorize')
end end
Expand Down
1 change: 1 addition & 0 deletions lib/warden-github/strategy.rb
Expand Up @@ -43,6 +43,7 @@ def oauth_proxy
@oauth_proxy ||= Warden::Github::Oauth::Proxy.new(env['warden'].config[:github_client_id], @oauth_proxy ||= Warden::Github::Oauth::Proxy.new(env['warden'].config[:github_client_id],
env['warden'].config[:github_secret], env['warden'].config[:github_secret],
env['warden'].config[:github_scopes], env['warden'].config[:github_scopes],
env['warden'].config[:github_oauth_domain],
callback_url) callback_url)
end end


Expand Down
2 changes: 1 addition & 1 deletion lib/warden-github/version.rb
@@ -1,5 +1,5 @@
module Warden module Warden
module Github module Github
VERSION = "0.3.1" VERSION = "0.4.0"
end end
end end
1 change: 1 addition & 0 deletions spec/app.rb
Expand Up @@ -14,6 +14,7 @@ class App < Sinatra::Base
manager[:github_secret] = ENV['GITHUB_CLIENT_SECRET'] || 'ed8ff0c54067aefb808dab1ca265865405d08d6f' manager[:github_secret] = ENV['GITHUB_CLIENT_SECRET'] || 'ed8ff0c54067aefb808dab1ca265865405d08d6f'


manager[:github_scopes] = '' manager[:github_scopes] = ''
manager[:github_oauth_domain] = ENV['GITHUB_OAUTH_DOMAIN'] || 'https://github.com'
manager[:github_callback_url] = '/auth/github/callback' manager[:github_callback_url] = '/auth/github/callback'
end end


Expand Down

0 comments on commit def5ceb

Please sign in to comment.