Method: Ramaze::Helper::Identity#openid_complete

Defined in:
lib/ramaze/helper/identity.rb

#openid_completeObject

After having authenticated at the OpenID server browsers are redirected back here and on success we set the session[:identity] and a little default flash message. Then we redirect to wherever session[:entry] points us to, which was set on openid_begin to the referrer

TODO:

- maybe using StackHelper, but this is a really minimal overlap?


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ramaze/helper/identity.rb', line 88

def openid_complete
  openid_response = openid_consumer.complete(request.params, request.url)

  case openid_response.status
  when OpenID::Consumer::FAILURE
    flash[:error] = "OpenID - Verification failed: #{openid_response.message}"
  when OpenID::Consumer::SUCCESS
    # Backwards compatibility
    session[:openid][:identity] = openid_response.identity_url
    session[:openid][:sreg] = OpenID::SReg::Response.from_success_response(openid_response)

    # Forward compatibility :)
    session[:openid_identity] = openid_response.identity_url
    session[:openid_sreg] = OpenID::SReg::Response.from_success_response(openid_response)

    flash[:success] = 'OpenID - Verification done.'
  end

  session.delete(:_openid_consumer_service)

  raw_redirect session[:openid][:entry]
end