summaryrefslogtreecommitdiff
path: root/lib/authorization.rb
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-02-08 12:58:30 +0100
committermr <mr@mrautenberg.de>2011-02-08 12:58:30 +0100
commite4a32e37ab8708aa8ae4dbfc6069e5ea75928f3f (patch)
tree1393e22245bb56cc49bdee8bc31fd6ae4276b700 /lib/authorization.rb
parent26c0b93a02fddb60175747f7733d13e973257cd8 (diff)
manually insert code from mguetlein repository | restclientwrapper.post event with changed method call
Diffstat (limited to 'lib/authorization.rb')
-rw-r--r--lib/authorization.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/authorization.rb b/lib/authorization.rb
index 12be037..16f1ee4 100644
--- a/lib/authorization.rb
+++ b/lib/authorization.rb
@@ -192,10 +192,10 @@ module OpenTox
# return [Boolean] returns true if policy is created
def self.create_policy(policy, subjectid)
begin
-# resource = RestClient::Resource.new("#{AA_SERVER}/Pol/opensso-pol")
+ resource = RestClient::Resource.new("#{AA_SERVER}/Pol/opensso-pol")
LOGGER.debug "OpenTox::Authorization.create_policy policy: #{policy[168,43]} with token:" + subjectid.to_s + " length: " + subjectid.length.to_s
-# return true if resource.post(policy, :subjectid => subjectid, :content_type => "application/xml")
- return true if RestClientWrapper.post("#{AA_SERVER}/pol", {:subjectid => subjectid, :content_type => "application/xml"}, policy)
+ return true if resource.post(policy, :subjectid => subjectid, :content_type => "application/xml")
+ #return true if RestClientWrapper.post("#{AA_SERVER}/pol", {:subjectid => subjectid, :content_type => "application/xml"}, policy)
rescue
return false
end
@@ -306,7 +306,6 @@ module OpenTox
# if no policy exists, create a policy, return result of send policy
send_policy(uri, subjectid)
else
- LOGGER.debug "OpenTox::Authorization.check_policy URI: #{uri} has already a Policy."
# if policy exists check for POST rights
if authorize(uri, "POST", subjectid)
true
@@ -356,7 +355,6 @@ module OpenTox
def self.free_uri?(uri, request_method)
if CONFIG[:authorization][:free_uris]
CONFIG[:authorization][:free_uris].each do |request_methods,uris|
- LOGGER.info "free uris "+request_methods.inspect+" -> "+uris.inspect
if request_methods and uris and request_methods.include?(request_method.to_sym)
uris.each do |u|
return true if u.match uri
@@ -380,9 +378,6 @@ module OpenTox
return false
end
-
-
-
end
end