Class: StackMob::Rack::SimpleOAuthProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/stackmob/rack/simple_oauth_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ SimpleOAuthProvider

Returns a new instance of SimpleOAuthProvider.



22
23
24
# File 'lib/stackmob/rack/simple_oauth_provider.rb', line 22

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/stackmob/rack/simple_oauth_provider.rb', line 26

def call(env)
  request = ::Rack::Request.new(env)
  signature = OAuth::Signature.build(request, :token_secret => "", :consumer_secret => StackMob.secret)
  if signature.verify          
    authorized(env)
  else
    auth_failed(env)
  end       
rescue OAuth::Signature::UnknownSignatureMethod
  auth_failed(env)
end