Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Created September 17, 2009 05:27
Show Gist options
  • Select an option

  • Save baroquebobcat/188360 to your computer and use it in GitHub Desktop.

Select an option

Save baroquebobcat/188360 to your computer and use it in GitHub Desktop.
require 'openid_provider_sinatra'
use Rack::Auth::Basic do |username,password|
'secret' == password
end
class InjectUser
def initialize app
@app=app
end
def call env
login=env['REMOTE_USER']
if login
env['rack.current_user'] = OpenStruct.new(:login=>login,:url=>"http://id.example.com/#{login}")
end
@app.call env
end
end
use InjectUser
run OpenIDProvider.new :store=>OpenID::Store::Filesystem.new(Dir.pwd + '/openid-store'),
:user_key=> 'rack.current_user'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment