Sha256: 45cec00f0cc4c255464378987c9db6b23e1d946699e93561b1462925f9981673
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
module Warden module Oauthed module Oauth class Proxy 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 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 => oauth_domain, :authorize_url => '/oauth/authorize') end def api_for(code) client.auth_code.get_token(code, :redirect_uri => callback_url) end def authorize_url client.auth_code.authorize_url( :scope => scopes, :redirect_uri => callback_url ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
warden-oauthed-0.0.1 | lib/warden-oauthed/proxy.rb |