Created
September 17, 2009 05:27
-
-
Save baroquebobcat/188360 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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