Created
August 6, 2008 01:28
-
-
Save benburkert/4148 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sessions < Application | |
def create | |
session.authenticate! #authenticates the user by username/password OR openid, raises an Unauthenticated if the user cannot be authenticated | |
redirect(url(:home)) | |
end | |
end | |
class Session | |
def authenticate! | |
#OpenID authentication | |
if @controller.params[:openid_url] #The user is initiating authentication, they must be redirected to the their provider | |
checkid_request = openid_consumer.begin(openid_url) #some openid gem that does the heavy lifting | |
throw(:halt, c.redirect(checkid_request.redirect_url(c.request.protocol + c.request.host, c.absolute_url(:login)))) #halt the response and just redirect them | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment