summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-09-02 13:09:19 +0200
committerChristoph Helma <helma@in-silico.ch>2010-09-02 13:09:19 +0200
commit6a560290805ff49d7d43842dd8119a2e2bb06b4a (patch)
tree5de68ff472cfd61f8e13271ba8f41fd171e4a07e
parent48d044219674a96ba0d387311612c9fb95949e05 (diff)
old user authentification removed
-rw-r--r--lib/algorithm.rb4
-rw-r--r--lib/authorization.rb24
-rw-r--r--lib/environment.rb14
-rw-r--r--lib/model.rb4
-rw-r--r--lib/opentox-ruby-api-wrapper.rb2
-rw-r--r--lib/rest_client_wrapper.rb2
-rw-r--r--lib/templates/users.yaml5
-rw-r--r--opentox-ruby-api-wrapper.gemspec2
8 files changed, 7 insertions, 50 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index d7b57af..4d9156a 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -25,7 +25,7 @@ module OpenTox
def self.create_feature_dataset(params)
LOGGER.debug File.basename(__FILE__) + ": creating feature dataset"
- resource = RestClient::Resource.new(params[:feature_generation_uri], :user => @@users[:users].keys[0], :password => @@users[:users].values[0])
+ resource = RestClient::Resource.new(params[:feature_generation_uri])
resource.post :dataset_uri => params[:dataset_uri], :feature_uri => params[:feature_uri]
end
@@ -40,7 +40,7 @@ module OpenTox
LOGGER.debug params
LOGGER.debug File.basename(__FILE__) + ": creating model"
LOGGER.debug File.join(@@config[:services]["opentox-algorithm"], "lazar")
- resource = RestClient::Resource.new(File.join(@@config[:services]["opentox-algorithm"], "lazar"), :user => @@users[:users].keys[0], :password => @@users[:users].values[0], :content_type => "application/x-yaml")
+ resource = RestClient::Resource.new(File.join(@@config[:services]["opentox-algorithm"], "lazar"), :content_type => "application/x-yaml")
@uri = resource.post(:dataset_uri => params[:dataset_uri], :prediction_feature => params[:prediction_feature], :feature_generation_uri => File.join(@@config[:services]["opentox-algorithm"], "fminer")).body.chomp
end
diff --git a/lib/authorization.rb b/lib/authorization.rb
deleted file mode 100644
index 9a1760a..0000000
--- a/lib/authorization.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-helpers do
-
- def protected!
- response['WWW-Authenticate'] = %(Basic realm="Opentox Webservice Authentication") and \
- throw(:halt, [401, "Not authorized\n"]) and \
- return unless authorized?
- end
-
- def authorized?
- @auth ||= Rack::Auth::Basic::Request.new(request.env)
- @auth.provided? && @auth.basic? && @auth.credentials && valid_user?
- end
-
- def valid_user?
- users = @@users[:users]
- return @auth.credentials == [@auth.username, users.fetch(@auth.username)] if users.has_key?(@auth.username)
- return false
- end
-
-end
-
-before do
- #protected! unless env['REQUEST_METHOD'] == "GET"
-end
diff --git a/lib/environment.rb b/lib/environment.rb
index cfc875d..c662e8b 100644
--- a/lib/environment.rb
+++ b/lib/environment.rb
@@ -54,20 +54,6 @@ else
LOGGER.level = Logger::WARN
end
-if File.exist?(user_file)
- @@users = YAML.load_file(user_file)
-else
- FileUtils.cp(File.join(File.dirname(__FILE__), 'templates/users.yaml'), user_file)
- puts "Please edit #{user_file} and restart your application."
- exit
-end
-
-begin
- 0 < @@users[:users].keys.length
-rescue
- raise "Please edit #{user_file} and restart your application. Create at least one user with password."
-end
-
# Regular expressions for parsing classification data
TRUE_REGEXP = /^(true|active|1|1.0)$/i
FALSE_REGEXP = /^(false|inactive|0|0.0)$/i
diff --git a/lib/model.rb b/lib/model.rb
index e36b538..3ecd61c 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -95,7 +95,7 @@ module OpenTox
def save
@features.uniq!
- resource = RestClient::Resource.new(@@config[:services]["opentox-model"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0])
+ resource = RestClient::Resource.new(@@config[:services]["opentox-model"])
resource.post(self.to_yaml, :content_type => "application/x-yaml").chomp.to_s
end
@@ -126,7 +126,7 @@ module OpenTox
def save
@features.uniq!
- resource = RestClient::Resource.new(@@config[:services]["opentox-model"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0])
+ resource = RestClient::Resource.new(@@config[:services]["opentox-model"])
resource.post(self.to_yaml, :content_type => "application/x-yaml").chomp.to_s
end
diff --git a/lib/opentox-ruby-api-wrapper.rb b/lib/opentox-ruby-api-wrapper.rb
index 45a3428..bae1155 100644
--- a/lib/opentox-ruby-api-wrapper.rb
+++ b/lib/opentox-ruby-api-wrapper.rb
@@ -8,6 +8,6 @@ rescue LoadError
puts "Please install Openbabel with 'rake openbabel:install' in the compound component"
end
-['owl', 'compound','dataset','algorithm','model','task','validation','utils','authorization','features', 'ot-logger', 'overwrite', 'rest_client_wrapper'].each do |lib|
+['owl', 'compound','dataset','algorithm','model','task','validation','utils','features', 'ot-logger', 'overwrite', 'rest_client_wrapper'].each do |lib|
require lib
end
diff --git a/lib/rest_client_wrapper.rb b/lib/rest_client_wrapper.rb
index 1282bee..82836d9 100644
--- a/lib/rest_client_wrapper.rb
+++ b/lib/rest_client_wrapper.rb
@@ -67,7 +67,7 @@ module OpenTox
begin
#LOGGER.debug "RestCall: "+rest_call.to_s+" "+uri.to_s+" "+headers.inspect
- resource = RestClient::Resource.new(uri,{:timeout => 60}) #, :user => @@users[:users].keys[0], :password => @@users[:users].values[0]})
+ resource = RestClient::Resource.new(uri,{:timeout => 60})
if payload
result = resource.send(rest_call, payload, headers)
elsif headers
diff --git a/lib/templates/users.yaml b/lib/templates/users.yaml
deleted file mode 100644
index 483fd7b..0000000
--- a/lib/templates/users.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# please insert users and passwords here.
-# one user and password each line. uncomment the line.
-:users:
-# username: "secretpassword"
-# exampleuser: "ih9aiTog" \ No newline at end of file
diff --git a/opentox-ruby-api-wrapper.gemspec b/opentox-ruby-api-wrapper.gemspec
index f0a0816..8217240 100644
--- a/opentox-ruby-api-wrapper.gemspec
+++ b/opentox-ruby-api-wrapper.gemspec
@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = %q{opentox-ruby-api-wrapper}
- s.version = "1.6.5"
+ s.version = "1.6.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Christoph Helma, Martin Guetlein"]