Skip to content

Instantly share code, notes, and snippets.

@ku1ik
Created March 24, 2010 14:23
Show Gist options
  • Save ku1ik/342330 to your computer and use it in GitHub Desktop.
Save ku1ik/342330 to your computer and use it in GitHub Desktop.
class OpenIDStrategy < Warden::Strategies::Base
def authenticate!
if resp = request.env['rack.openid.response']
if resp.status == :failure || resp.status == :missing
fail! "OpenID authentication failed"
end
elsif openid_url = request.params[:openid_url]
custom!([401, { "WWW-Authenticate" => "OpenID identifier=\"#{openid_url}\"" }, []])
end
end
end
Warden::Strategies.add(:openid, OpenIDStrategy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment