rack-openid¶
$ su -c "gem install rack-openid"
Ejemplo con rack:
require 'rubygems'
require 'rack/openid'
class HolaMundo
def call(env)
if env["rack.openid.response"].nil?
return [401, {"WWW-Authenticate" => 'OpenID identifier="https://admin.fedoraproject.org/accounts/openid/id/gomix"'}, []]
end
if resp = env["rack.openid.response"]
case resp.status
when :success
return [200, {'Content-Type' => 'text/html'},["¡Hola Mundo!"] ]
when :failure
return [200, {'Content-Type' => 'text/html'},["¡Fallo!"] ]
else
return [401, {"WWW-Authenticate" => 'OpenID identifier="https://admin.fedoraproject.org/accounts/openid/id/gomix"'}, []]
end
end
end
end
use Rack::Session::Cookie
use Rack::OpenID
run HolaMundo.new