Sha256: 3bb89ea56dd26024e3b8a1232118b1c82815be0c86e822bf569fdcb7866f22ce

Contents?: true

Size: 890 Bytes

Versions: 13

Compression:

Stored size: 890 Bytes

Contents

require 'rack/prx_auth'

class PrxAuth::Rails::Token
  def initialize(token_data)
    @token_data = token_data
    @namespace = PrxAuth::Rails.configuration.namespace
  end

  def authorized?(resource, namespace=nil, scope=nil)
    namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
    @token_data.authorized?(resource, namespace, scope)
  end

  def globally_authorized?(namespace, scope=nil)
    namespace, scope = @namespace, namespace if scope.nil?
    @token_data.globally_authorized?(namespace, scope)
  end

  def resources(namespace=nil, scope=nil)
    namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
    @token_data.resources(namespace, scope)
  end

  def scopes
    @token_data.scopes
  end

  def user_id
    @token_data.user_id
  end

  def authorized_account_ids(scope)
    @token_data.authorized_account_ids(scope)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
prx_auth-rails-4.1.0 lib/prx_auth/rails/token.rb
prx_auth-rails-4.0.0 lib/prx_auth/rails/token.rb
prx_auth-rails-3.0.1 lib/prx_auth/rails/token.rb
prx_auth-rails-3.0.0 lib/prx_auth/rails/token.rb
prx_auth-rails-2.1.0 lib/prx_auth/rails/token.rb
prx_auth-rails-2.0.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.8.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.7.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.6.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.5.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.4.1 lib/prx_auth/rails/token.rb
prx_auth-rails-1.4.0 lib/prx_auth/rails/token.rb
prx_auth-rails-1.3.0 lib/prx_auth/rails/token.rb