Changeset 1185
- Timestamp:
- 03/27/04 01:41:49 (5 years ago)
- Files:
-
- trunk/_installedFiles.rb (deleted)
- trunk/sample/soap/authheader/server.rb (modified) (5 diffs)
- trunk/sample/soap/calc/httpd.rb (modified) (1 diff)
- trunk/sample/soap/exchange/httpd.rb (modified) (1 diff)
- trunk/sample/soap/sampleStruct/httpd.rb (modified) (1 diff)
- trunk/sample/wsdl/googleSearch/httpd.rb (modified) (1 diff)
- trunk/test/runner.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/sample/soap/authheader/server.rb
r1166 r1185 3 3 require 'soap/rpc/standaloneServer' 4 4 require 'soap/header/simplehandler' 5 require 'authmgr' 5 6 6 7 class AuthHeaderPortServer < SOAP::RPC::StandaloneServer … … 23 24 super 24 25 add_rpc_servant(AuthHeaderService.new, Name) 25 ServerAuthHeaderHandler.init26 26 add_rpc_request_headerhandler(ServerAuthHeaderHandler) 27 27 end … … 30 30 MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth") 31 31 32 class << self 33 def create 34 new 35 end 36 37 def init 38 @users = { 39 'NaHi' => 'passwd', 40 'HiNa' => 'wspass' 41 } 42 @sessions = {} 43 end 44 45 def login(userid, passwd) 46 userid and passwd and @users[userid] == passwd 47 end 48 49 def auth(sessionid) 50 @sessions[sessionid][0] 51 end 52 53 def create_session(userid) 54 while true 55 key = create_sessionkey 56 break unless @sessions[key] 57 end 58 @sessions[key] = [userid] 59 key 60 end 61 62 def destroy_session(sessionkey) 63 @sessions.delete(sessionkey) 64 end 65 66 private 67 68 def create_sessionkey 69 Time.now.usec.to_s 70 end 32 @authmgr = Authmgr.new 33 def self.create 34 new(@authmgr) 71 35 end 72 36 73 def initialize 37 def initialize(authmgr) 74 38 super(MyHeaderName) 39 @authmgr = authmgr 75 40 @userid = @sessionid = nil 76 41 end … … 84 49 userid = my_header["userid"] 85 50 passwd = my_header["passwd"] 86 if self.class.login(userid, passwd)51 if @authmgr.login(userid, passwd) 87 52 auth = true 88 53 elsif sessionid = my_header["sessionid"] 89 if userid = self.class.auth(sessionid)90 self.class.destroy_session(sessionid)54 if userid = @authmgr.auth(sessionid) 55 @authmgr.destroy_session(sessionid) 91 56 auth = true 92 57 end … … 94 59 raise RuntimeError.new("authentication failed") unless auth 95 60 @userid = userid 96 @sessionid = self.class.create_session(userid)61 @sessionid = @authmgr.create_session(userid) 97 62 end 98 63 end trunk/sample/soap/calc/httpd.rb
r966 r1185 2 2 3 3 require 'webrick' 4 require ' getopts'4 require 'soap/property' 5 5 6 getopts "", 'r:', 'p:8808' 6 docroot = "." 7 port = 8808 8 if opt = SOAP::Property.loadproperty("samplehttpd.conf") 9 docroot = opt["docroot"] 10 port = Integer(opt["port"]) 11 end 7 12 8 13 s = WEBrick::HTTPServer.new( 9 14 :BindAddress => "0.0.0.0", 10 :Port => $OPT_p.to_i,11 :DocumentRoot => $OPT_r || ".",15 :Port => port, 16 :DocumentRoot => docroot, 12 17 :CGIPathEnv => ENV['PATH'] 13 18 ) trunk/sample/soap/exchange/httpd.rb
r966 r1185 2 2 3 3 require 'webrick' 4 require ' getopts'4 require 'soap/property' 5 5 6 getopts "", 'r:', 'p:8808' 6 docroot = "." 7 port = 8808 8 if opt = SOAP::Property.loadproperty("samplehttpd.conf") 9 docroot = opt["docroot"] 10 port = Integer(opt["port"]) 11 end 7 12 8 13 s = WEBrick::HTTPServer.new( 9 14 :BindAddress => "0.0.0.0", 10 :Port => $OPT_p.to_i,11 :DocumentRoot => $OPT_r || ".",15 :Port => port, 16 :DocumentRoot => docroot, 12 17 :CGIPathEnv => ENV['PATH'] 13 18 ) trunk/sample/soap/sampleStruct/httpd.rb
r966 r1185 2 2 3 3 require 'webrick' 4 require ' getopts'4 require 'soap/property' 5 5 6 getopts "", 'r:', 'p:8808' 6 docroot = "." 7 port = 8808 8 if opt = SOAP::Property.loadproperty("samplehttpd.conf") 9 docroot = opt["docroot"] 10 port = Integer(opt["port"]) 11 end 7 12 8 13 s = WEBrick::HTTPServer.new( 9 14 :BindAddress => "0.0.0.0", 10 :Port => $OPT_p.to_i,11 :DocumentRoot => $OPT_r || ".",15 :Port => port, 16 :DocumentRoot => docroot, 12 17 :CGIPathEnv => ENV['PATH'] 13 18 ) trunk/sample/wsdl/googleSearch/httpd.rb
r966 r1185 2 2 3 3 require 'webrick' 4 require ' getopts'4 require 'soap/property' 5 5 6 getopts "", 'r:', 'p:8808' 6 docroot = "." 7 port = 8808 8 if opt = SOAP::Property.loadproperty("samplehttpd.conf") 9 docroot = opt["docroot"] 10 port = Integer(opt["port"]) 11 end 7 12 8 13 s = WEBrick::HTTPServer.new( 9 14 :BindAddress => "0.0.0.0", 10 :Port => $OPT_p.to_i,11 :DocumentRoot => $OPT_r || ".",15 :Port => port, 16 :DocumentRoot => docroot, 12 17 :CGIPathEnv => ENV['PATH'] 13 18 ) trunk/test/runner.rb
r1178 r1185 1 1 require 'test/unit' 2 2 3 rcsid = %w$Id: runner.rb,v 1.5 2004/01/29 12:58:08 nahi Exp $ 3 STDOUT.sync = true 4 STDERR.sync = true 5 rcsid = %w$Id: runner.rb,v 1.6 2004/03/26 16:41:49 nahi Exp $ 4 6 Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze 5 7 Release = rcsid[3].freeze 6 8 7 runner = Test::Unit::AutoRunner.new(true) 8 runner.to_run.concat(ARGV) 9 runner.to_run << File.dirname(__FILE__) if runner.to_run.empty? 10 runner.run 9 exit Test::Unit::AutoRunner.run(false, File.dirname($0))