summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2013-02-07 11:55:53 +0100
committerrautenberg <rautenberg@in-silico.ch>2013-02-07 11:55:53 +0100
commitf1a6d9f9d5bc73d757e0864d998c95f10ebeecbb (patch)
treefeed5b78b486ebf8bdfde2bca160ad66974948be
parent2d094d61663c36004915b5e124ba2001364392ac (diff)
add regex filter for URL authentification
-rw-r--r--lib/authorization.rb2
-rw-r--r--lib/rest-client-wrapper.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/authorization.rb b/lib/authorization.rb
index 1fe5c51..8eefc63 100644
--- a/lib/authorization.rb
+++ b/lib/authorization.rb
@@ -12,7 +12,7 @@ module OpenTox
#Helper Class to create and send default policies out of xml templates
#@example Creating a default policy to a URI
- # aa=OpenTox::Authorization::AA.new(tok)
+ # aa=OpenTox::Authorization::Helper.new(tok)
# xml=aa.get_xml('http://uri....')
# OpenTox::Authorization.create_policy(xml,tok)
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb
index 1258339..79a65d9 100644
--- a/lib/rest-client-wrapper.rb
+++ b/lib/rest-client-wrapper.rb
@@ -45,7 +45,8 @@ module OpenTox
elsif response.code >= 400 and !URI.task?(uri)
message = response.to_s
parameters = request.args
- parameters[:headers][:subjectid] = "REMOVED" if parameters[:headers] and parameters[:headers][:subjectid]
+ parameters[:headers][:subjectid] = "REMOVED" if parameters[:headers] and parameters[:headers][:subjectid]
+ parameters[:url] = parameters[:url].gsub(/(http|https|)\:\/\/[a-zA-Z0-9\-]+\:[a-zA-Z0-9]+\@/, "REMOVED@") if parameters[:url]
message += "\nREST parameters:\n#{parameters.inspect}"
error = known_errors.collect{|e| e if e[:code] == response.code}.compact.first
Object.method(error[:method]).call message, uri # call error method