Class: Auth::AuthProvider

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serialization
Defined in:
lib/auth/auth_provider.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ AuthProvider

Returns a new instance of AuthProvider.



6
7
8
# File 'lib/auth/auth_provider.rb', line 6

def initialize(params = {})
  params.each { |key, value| public_send "#{key}=", value }
end

Class Method Details

.auth_attributesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/auth/auth_provider.rb', line 10

def self.auth_attributes
  %i[
    authenticator
    pretty_name
    title
    message
    frame_width
    frame_height
    pretty_name_setting
    title_setting
    enabled_setting
    full_screen_login
    full_screen_login_setting
    custom_url
    background_color
    icon
  ]
end

Instance Method Details

#background_color=(val) ⇒ Object



39
40
41
42
43
44
# File 'lib/auth/auth_provider.rb', line 39

def background_color=(val)
  Discourse.deprecate(
    "(#{authenticator.name}) background_color is no longer functional. Please use CSS instead",
    drop_from: "2.9.0",
  )
end

#can_connectObject



71
72
73
# File 'lib/auth/auth_provider.rb', line 71

def can_connect
  authenticator.can_connect_existing_user?
end

#can_revokeObject



75
76
77
# File 'lib/auth/auth_provider.rb', line 75

def can_revoke
  authenticator.can_revoke?
end

#enabled_setting=(val) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/auth/auth_provider.rb', line 31

def enabled_setting=(val)
  Discourse.deprecate(
    "(#{authenticator.name}) enabled_setting is deprecated. Please define authenticator.enabled? instead",
    drop_from: "2.9.0",
  )
  @enabled_setting = val
end

#full_screen_login=(val) ⇒ Object



46
47
48
49
50
51
# File 'lib/auth/auth_provider.rb', line 46

def full_screen_login=(val)
  Discourse.deprecate(
    "(#{authenticator.name}) full_screen_login is now forced. The full_screen_login parameter can be removed from the auth_provider.",
    drop_from: "2.9.0",
  )
end

#full_screen_login_setting=(val) ⇒ Object



53
54
55
56
57
58
# File 'lib/auth/auth_provider.rb', line 53

def (val)
  Discourse.deprecate(
    "(#{authenticator.name}) full_screen_login is now forced. The full_screen_login_setting parameter can be removed from the auth_provider.",
    drop_from: "2.9.0",
  )
end

#message=(val) ⇒ Object



60
61
62
63
64
65
# File 'lib/auth/auth_provider.rb', line 60

def message=(val)
  Discourse.deprecate(
    "(#{authenticator.name}) message is no longer used because all logins are full screen. It should be removed from the auth_provider",
    drop_from: "2.9.0",
  )
end

#nameObject



67
68
69
# File 'lib/auth/auth_provider.rb', line 67

def name
  authenticator.name
end