Sha256: 296ee518945199acb6400b9fd27030f30030c3b3fbac1d9c790a2708c833214f

Contents?: true

Size: 590 Bytes

Versions: 2

Compression:

Stored size: 590 Bytes

Contents

$:.push(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "marilyn-rpc"
require "rubygems"
require "eventmachine"

MarilynRPC::Service.authenticate_with do |username, password|
  username == "testuserid" && password == "secret"
end

class TestService < MarilynRPC::Service
  register :test
  authentication_required :add
  
  def time
    puts session_username
    puts session_authenticated?
    Time.now
  end
  
  def add(a, b)
    puts session_username
    puts session_authenticated?
    a + b
  end
end


EM.run {
  EM.start_server "localhost", 8000, MarilynRPC::Server
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marilyn-rpc-0.0.4 examples/authentication/server.rb
marilyn-rpc-0.0.3 examples/authentication/server.rb