2013-08-23 02:20:43 -04:00
|
|
|
class Auth::PersonaAuthenticator < Auth::Authenticator
|
|
|
|
|
|
|
|
def name
|
|
|
|
"persona"
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO twitter provides all sorts of extra info, like website/bio etc.
|
|
|
|
# it may be worth considering pulling some of it in.
|
|
|
|
def after_authenticate(auth_token)
|
|
|
|
result = Auth::Result.new
|
|
|
|
|
|
|
|
result.email = email = auth_token[:info][:email]
|
|
|
|
result.email_valid = true
|
|
|
|
|
|
|
|
result.user = User.find_by_email(email)
|
|
|
|
result
|
|
|
|
end
|
2013-08-25 21:04:16 -04:00
|
|
|
|
|
|
|
def register_middleware(omniauth)
|
|
|
|
omniauth.provider :browser_id,
|
|
|
|
:name => "persona"
|
|
|
|
end
|
2013-08-23 02:20:43 -04:00
|
|
|
end
|
2013-08-25 21:04:16 -04:00
|
|
|
|
|
|
|
|