Sha256: 85a4a5e17ed4d3640a9a39c1824ab3bfd2d62003c3330dbe32cff35202018970
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
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 end def ssl_options ca_file = "/usr/lib/ssl/certs/ca-certificates.crt" if File.exists?(ca_file) { :ca_file => ca_file } else { :ca_file => ''} end end def client @client ||= OAuth2::Client.new(@client_id, @secret, :ssl => ssl_options, :site => 'https://github.com', :authorize_path => '/login/oauth/authorize', :access_token_path => '/login/oauth/access_token') end def access_token_for(code) web_server.get_token(code, :redirect_uri => callback_url) end def authorize_url web_server.authorize_url( :scope => scopes, :redirect_uri => callback_url ) end def web_server client.auth_code end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
warden-github-0.2.1 | lib/warden-github/proxy.rb |