Module: JunglePath::API::Helpers::Auth
- Defined in:
- lib/jungle_path/api/helpers/auth.rb
Instance Method Summary collapse
- #authenticate(auth_provider, data_provider, no_cache = false) ⇒ Object
- #current_auth ⇒ Object
- #current_identity ⇒ Object
- #current_key ⇒ Object
- #current_query_filters ⇒ Object
- #current_role ⇒ Object
- #current_user ⇒ Object
Instance Method Details
#authenticate(auth_provider, data_provider, no_cache = false) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 6 def authenticate auth_provider, data_provider, no_cache=false puts "Auth.authenticate" #data_provider = JunglePath::Authentication::DataProvider::Default.new unless data_provider #auth_provider = JunglePath::Authentication::AuthProvider::Default.new unless auth_provider @current_identity = auth_provider.authenticate(request, data_provider, no_cache) halt 401 unless @current_identity and @current_identity.valid? request.body.rewind end |
#current_auth ⇒ Object
31 32 33 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 31 def current_auth @current_identity and @current_identity. end |
#current_identity ⇒ Object
15 16 17 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 15 def current_identity @current_identity end |
#current_key ⇒ Object
23 24 25 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 23 def current_key @current_identity and @current_identity.key end |
#current_query_filters ⇒ Object
35 36 37 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 35 def current_query_filters @current_identity and @current_identity.query_filters end |
#current_role ⇒ Object
27 28 29 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 27 def current_role @current_identity and @current_identity.role end |
#current_user ⇒ Object
19 20 21 |
# File 'lib/jungle_path/api/helpers/auth.rb', line 19 def current_user @current_identity and @current_identity.user end |