Class: PrxAuth::Rails::Token
- Inherits:
-
Object
- Object
- PrxAuth::Rails::Token
- Defined in:
- lib/prx_auth/rails/token.rb
Instance Method Summary collapse
- #authorized?(resource, namespace = nil, scope = nil) ⇒ Boolean
- #globally_authorized?(namespace, scope = nil) ⇒ Boolean
-
#initialize(token_data) ⇒ Token
constructor
A new instance of Token.
- #resources(namespace = nil, scope = nil) ⇒ Object
- #scopes ⇒ Object
- #user_id ⇒ Object
Constructor Details
#initialize(token_data) ⇒ Token
Returns a new instance of Token.
4 5 6 7 |
# File 'lib/prx_auth/rails/token.rb', line 4 def initialize(token_data) @token_data = token_data @namespace = PrxAuth::Rails.configuration.namespace end |
Instance Method Details
#authorized?(resource, namespace = nil, scope = nil) ⇒ Boolean
9 10 11 12 |
# File 'lib/prx_auth/rails/token.rb', line 9 def (resource, namespace=nil, scope=nil) namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil? @token_data.(resource, namespace, scope) end |
#globally_authorized?(namespace, scope = nil) ⇒ Boolean
14 15 16 17 |
# File 'lib/prx_auth/rails/token.rb', line 14 def (namespace, scope=nil) namespace, scope = @namespace, namespace if scope.nil? @token_data.(namespace, scope) end |
#resources(namespace = nil, scope = nil) ⇒ Object
19 20 21 22 |
# File 'lib/prx_auth/rails/token.rb', line 19 def resources(namespace=nil, scope=nil) namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil? @token_data.resources(namespace, scope) end |
#scopes ⇒ Object
24 25 26 |
# File 'lib/prx_auth/rails/token.rb', line 24 def scopes @token_data.scopes end |
#user_id ⇒ Object
28 29 30 |
# File 'lib/prx_auth/rails/token.rb', line 28 def user_id @token_data.user_id end |