mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
major refactor of auth, break up the gigantic omniauth controller into sub classes for way better extensibitily
This commit is contained in:
24
lib/auth/authenticator.rb
Normal file
24
lib/auth/authenticator.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# this class is used by the user and omniauth controllers, it controls how
|
||||
# an authentication system interacts with our database
|
||||
|
||||
module Auth; end
|
||||
|
||||
require 'auth/result'
|
||||
|
||||
class Auth::Authenticator
|
||||
def after_authenticate(auth_options)
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
# can be used to hook in afete the authentication process
|
||||
# to ensure records exist for the provider in the db
|
||||
# this MUST be implemented for authenticators that do not
|
||||
# trust email
|
||||
def after_create_account(user, auth)
|
||||
# not required
|
||||
end
|
||||
|
||||
def lookup_user(user_info, email)
|
||||
user_info.try(:user) || User.where(email: email).first
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user