Skip to content

Commit

Permalink
Mongoid adaptions
Browse files Browse the repository at this point in the history
  • Loading branch information
arnklint committed Dec 27, 2011
1 parent 30c94a1 commit 55f4728
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/oauth/controllers/provider_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def access_token
end

def token
@client_application = ClientApplication.find_by_key! params[:client_id]
@client_application = ClientApplication.where(:key => params[:client_id]).first
if @client_application.secret != params[:client_secret]
oauth2_error "invalid_client"
return
Expand All @@ -54,21 +54,21 @@ def test_request

def authorize
if params[:oauth_token]
@token = ::RequestToken.find_by_token! params[:oauth_token]
@token = ::RequestToken.where(:token => params[:oauth_token]).first
oauth1_authorize
else
if request.post?
@authorizer = OAuth::Provider::Authorizer.new current_user, user_authorizes_token?, params
redirect_to @authorizer.redirect_uri
else
@client_application = ClientApplication.find_by_key! params[:client_id]
@client_application = ClientApplication.where(:key => params[:client_id]).first
render :action => "oauth2_authorize"
end
end
end

def revoke
@token = current_user.tokens.find_by_token! params[:token]
@token = current_user.tokens.where(:token => params[:token]).first
if @token
@token.invalidate!
flash[:notice] = "You've revoked the token for #{@token.client_application.name}"
Expand Down Expand Up @@ -132,7 +132,7 @@ def oauth1_authorize

# http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-4.1.1
def oauth2_token_authorization_code
@verification_code = @client_application.oauth2_verifiers.find_by_token params[:code]
@verification_code = @client_application.oauth2_verifiers.where(:token => params[:code]).first
unless @verification_code
oauth2_error
return
Expand Down

0 comments on commit 55f4728

Please sign in to comment.