Skip to content

Commit

Permalink
Changing the Server storage from memory to filesystem, and adding an …
Browse files Browse the repository at this point in the history
…option to the server invocation to specify a path for the openid server records
  • Loading branch information
roman committed Mar 19, 2009
1 parent a3078dd commit d220dd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bin/rots
Expand Up @@ -11,6 +11,7 @@ server_options = {
:debugger => false,
:port => 1123,
:verbose => true,
:storage => './tmp/rots',
:config => <<-DEFAULT_CONFIG
# Default configuration file
identity: john.doe
Expand All @@ -35,6 +36,11 @@ opts = OptionParser.new do |opts|
server_options[:port] = port
end

opts.on("-s", "--storage PATH",
"use PATH as the OpenID Server storage path (default: ./tmp/rots)") do |storage_path|
server_options[:storage] = storage_path
end

opts.on("-c", "--config FILE.yaml",
"server configuration YAML file") do |config_path|
abort "\x1B[31mConfiguration file #{config_path} not found\x1B[0m" unless File.exists?(config_path)
Expand Down
3 changes: 2 additions & 1 deletion lib/ruby_openid_test_server/server_app.rb
Expand Up @@ -48,7 +48,8 @@ def on_openid_request(env)

def create_wrappers(env)
@request = Rack::Request.new(env)
@server = OpenID::Server::Server.new(OpenID::Store::Memory.new, @request.host)
@server = OpenID::Server::Server.new(
OpenID::Store::Filesystem.new(@server_options[:storage]), @request.host)
@openid_request = @server.decode_request(@request.params)
@openid_sreg_request = OpenID::SReg::Request.from_openid_request(@openid_request) unless @openid_request.nil?
end
Expand Down

0 comments on commit d220dd0

Please sign in to comment.