mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 12:26:37 +08:00
Add capability to pass an icon setting into auth provider registration to override the default icon with a site setting. Matches the pattern we use for the auth provider title and pretty name. With this, the SAML plugin can be updated to have a site setting to override the default "user" icon.
42 lines
681 B
Ruby
42 lines
681 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Auth::AuthProvider
|
|
include ActiveModel::Serialization
|
|
|
|
def initialize(params = {})
|
|
params.each { |key, value| public_send "#{key}=", value }
|
|
end
|
|
|
|
def self.auth_attributes
|
|
%i[
|
|
authenticator
|
|
custom_url
|
|
frame_height
|
|
frame_width
|
|
icon
|
|
icon_setting
|
|
pretty_name
|
|
pretty_name_setting
|
|
title
|
|
title_setting
|
|
]
|
|
end
|
|
|
|
attr_accessor(*auth_attributes)
|
|
|
|
def can_connect
|
|
authenticator.can_connect_existing_user?
|
|
end
|
|
|
|
def can_revoke
|
|
authenticator.can_revoke?
|
|
end
|
|
|
|
def name
|
|
authenticator.name
|
|
end
|
|
|
|
def provider_url
|
|
authenticator.provider_url
|
|
end
|
|
end
|