Sha256: 61e140031424bea9bd47837786340d9806cf3e1d3b694d3ef94cc515aa86ee1f

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

module ExvoAuth::Controllers::Rails
  def self.included(base)
    base.send :include, ExvoAuth::Controllers::Base
    base.send :include, InstanceMethods
    base.helper_method :current_user, :signed_in?
  end
    
  module InstanceMethods
    def authenticate_app_in_scope!(scope)
      authenticate_or_request_with_http_basic do |consumer_id, access_token|
        current_scopes = ExvoAuth::Autonomous::Provider.new(
          :consumer_id  => consumer_id, 
          :access_token => access_token
        ).scopes
        
        @current_consumer_id = consumer_id
        
        current_scopes.include?(scope) && request.ssl?
      end
    end

    protected
    
    def find_user_by_id(id)
      User.find(id)
    end

    def current_url
      request.url if request.get?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exvo-auth-0.7.5 lib/exvo_auth/controllers/rails.rb
exvo-auth-0.7.4 lib/exvo_auth/controllers/rails.rb
exvo-auth-0.7.3 lib/exvo_auth/controllers/rails.rb
exvo-auth-0.7.2 lib/exvo_auth/controllers/rails.rb