lib/owasp_zap/auth.rb in owasp_zap-0.0.95 vs lib/owasp_zap/auth.rb in owasp_zap-0.1.0

- old
+ new

@@ -1,9 +1,10 @@ module OwaspZap class Auth attr_accessor :ctx,:base def initialize(params = {}) + import_context(params[:context_name]) if !params[:context_name].nil? @ctx = params[:context] || 1 #default context is the1 @base = params[:base] || "http://127.0.0.1:8080/JSON" end # @@ -29,9 +30,15 @@ # params: # args a hash with the following keys -> values # url: url including http:// # post_data: an already encoded string like "email%3Dfoo%2540example.org%26passwd%3Dfoobar" # TODO: offer a way to encode it, giving a hash? + def import_context(context) + set_query "{@base}/context/action/importContext/",postData: context + contexts = RestClient::get "{@base}/context/view/contextList" + puts contexts + end + def set_login_url(args) set_query "#{@base}/auth/action/setLoginUrl/",:postData=>args[:post_data] end def set_logout_url(args)