Module: Passage::OpenIDHelpers
- Includes:
- OpenID::Server
- Defined in:
- lib/passage/open_id.rb
Instance Method Summary collapse
- #openid_positive_assertion(oidreq, identity, details) ⇒ Object
- #openid_response(oidresp) ⇒ Object
- #server ⇒ Object
- #server_url ⇒ Object
Instance Method Details
#openid_positive_assertion(oidreq, identity, details) ⇒ Object
7 8 9 10 11 |
# File 'lib/passage/open_id.rb', line 7 def openid_positive_assertion(oidreq, identity, details) oidresp = oidreq.answer(true, nil, identity) add_sreg(oidreq, oidresp, identity, details) oidresp end |
#openid_response(oidresp) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/passage/open_id.rb', line 13 def openid_response(oidresp) if oidresp.needs_signing signed_response = server.signatory.sign(oidresp) end web_response = server.encode_response(oidresp) case web_response.code when HTTP_REDIRECT redirect web_response.headers['location'] else web_response.body end end |
#server ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/passage/open_id.rb', line 27 def server if @server.nil? dir = Pathname.new(".").join('db').join('openid-store') store = OpenID::Store::Filesystem.new(dir) @server = Server.new(store, server_url) end return @server end |
#server_url ⇒ Object
36 37 38 |
# File 'lib/passage/open_id.rb', line 36 def server_url "#{request.scheme}://#{request.host}:#{request.port}/" end |