2018-07-31 11:18:50 -04:00
|
|
|
class Auth::AuthProvider
|
|
|
|
include ActiveModel::Serialization
|
|
|
|
|
|
|
|
def initialize(params = {})
|
|
|
|
params.each { |key, value| send "#{key}=", value }
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.auth_attributes
|
|
|
|
[:pretty_name, :title, :message, :frame_width, :frame_height, :authenticator,
|
|
|
|
:pretty_name_setting, :title_setting, :enabled_setting, :full_screen_login, :full_screen_login_setting,
|
2018-11-30 11:58:18 -05:00
|
|
|
:custom_url, :background_color]
|
2018-07-31 11:18:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
attr_accessor(*auth_attributes)
|
|
|
|
|
2018-11-30 11:58:18 -05:00
|
|
|
def enabled_setting=(val)
|
|
|
|
Discourse.deprecate("enabled_setting is deprecated. Please define authenticator.enabled? instead")
|
|
|
|
@enabled_setting = val
|
|
|
|
end
|
|
|
|
|
2018-12-03 10:02:31 -05:00
|
|
|
def background_color=(val)
|
|
|
|
Discourse.deprecate("background_color is no longer functional. Please use CSS instead")
|
|
|
|
end
|
2018-11-30 11:58:18 -05:00
|
|
|
|
2018-07-31 11:18:50 -04:00
|
|
|
def name
|
|
|
|
authenticator.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_connect
|
|
|
|
authenticator.can_connect_existing_user?
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_revoke
|
|
|
|
authenticator.can_revoke?
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|