Module: Sinatra::Hancock::OpenIDServer::Helpers
- Defined in:
- lib/sinatra/hancock/openid_server.rb
Instance Method Summary collapse
Instance Method Details
#render_response(oidresp) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sinatra/hancock/openid_server.rb', line 23 def render_response(oidresp) if oidresp.needs_signing signed_response = server.signatory.sign(oidresp) end web_response = server.encode_response(oidresp) case web_response.code when 302 session.delete(:hancock_server_return_to) redirect web_response.headers['location'] else web_response.body end end |
#server ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/sinatra/hancock/openid_server.rb', line 9 def server if @server.nil? server_url = absolute_url('/sso') dir = File.join(Dir.tmpdir, 'openid-store') store = OpenID::Store::Filesystem.new(dir) @server = OpenID::Server::Server.new(store, server_url) end return @server end |
#url_for_user ⇒ Object
19 20 21 |
# File 'lib/sinatra/hancock/openid_server.rb', line 19 def url_for_user absolute_url("/sso/users/#{session_user.id}") end |