From f1a6d9f9d5bc73d757e0864d998c95f10ebeecbb Mon Sep 17 00:00:00 2001 From: rautenberg Date: Thu, 7 Feb 2013 11:55:53 +0100 Subject: add regex filter for URL authentification --- lib/authorization.rb | 2 +- lib/rest-client-wrapper.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3