Module: JunglePath::API::Helpers::Auth

Defined in:
lib/jungle_path/api/helpers/auth.rb

Instance Method Summary collapse

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_authObject



31
32
33
# File 'lib/jungle_path/api/helpers/auth.rb', line 31

def current_auth
	@current_identity and @current_identity.authorization_filter
end

#current_identityObject



15
16
17
# File 'lib/jungle_path/api/helpers/auth.rb', line 15

def current_identity
	@current_identity
end

#current_keyObject



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_filtersObject



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_roleObject



27
28
29
# File 'lib/jungle_path/api/helpers/auth.rb', line 27

def current_role
	@current_identity and @current_identity.role
end

#current_userObject



19
20
21
# File 'lib/jungle_path/api/helpers/auth.rb', line 19

def current_user
	@current_identity and @current_identity.user
end