Module: AppManager::Protection

Extended by:
ActiveSupport::Concern
Defined in:
lib/app_manager/protection.rb

Instance Method Summary collapse

Instance Method Details

#authorize_requestObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/app_manager/protection.rb', line 4

def authorize_request
	if request.headers['token'].present? && ENV['APP_MANAGER_ACCESS_TOKEN']
		if request.headers['token'] === ENV['APP_MANAGER_ACCESS_TOKEN']
		else
			render json: {
			error: "Invalid Token ",
			status: 401
			}, status: 401
		end
	else
		render json: {
		error: "Missing Token in request",
		status: 401
		}, status: 401
	end
end