discourse/lib/auth/persona_authenticator.rb

19 lines
434 B
Ruby
Raw Normal View History

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
end