# File lib/oauth/controllers/provider_controller.rb, line 5 5: def self.included(controller) 6: controller.class_eval do 7: before_filter :login_required, :only => [:authorize,:revoke] 8: before_filter :login_or_oauth_required, :only => [:test_request] 9: before_filter :oauth_required, :only => [:invalidate,:capabilities] 10: before_filter :verify_oauth_consumer_signature, :only => [:request_token] 11: before_filter :verify_oauth_request_token, :only => [:access_token] 12: skip_before_filter :verify_authenticity_token, :only=>[:request_token, :access_token, :invalidate, :test_request] 13: end 14: end
# File lib/oauth/controllers/provider_controller.rb, line 25 25: def access_token 26: @token = current_token && current_token.exchange! 27: if @token 28: render :text => @token.to_query 29: else 30: render :nothing => true, :status => 401 31: end 32: end
Capabilities of current_token
# File lib/oauth/controllers/provider_controller.rb, line 90 90: def capabilities 91: if current_token.respond_to?(:capabilities) 92: @capabilities=current_token.capabilities 93: else 94: @capabilities={:invalidate=>url_for(:action=>:invalidate)} 95: end 96: 97: respond_to do |format| 98: format.json {render :json=>@capabilities} 99: format.xml {render :xml=>@capabilities} 100: end 101: end
Invalidate current token
# File lib/oauth/controllers/provider_controller.rb, line 84 84: def invalidate 85: current_token.invalidate! 86: head :status=>410 87: end
# File lib/oauth/controllers/provider_controller.rb, line 16 16: def request_token 17: @token = current_client_application.create_request_token 18: if @token 19: render :text => @token.to_query 20: else 21: render :nothing => true, :status => 401 22: end 23: end
# File lib/oauth/controllers/provider_controller.rb, line 74 74: def revoke 75: @token = current_user.tokens.find_by_token params[:token] 76: if @token 77: @token.invalidate! 78: flash[:notice] = "You've revoked the token for #{@token.client_application.name}" 79: end 80: redirect_to oauth_clients_url 81: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.