Class: Auth::TwitterAuthenticator
Instance Method Summary
collapse
#after_create_account, #always_update_user_email?, #can_connect_existing_user?, #can_revoke?, #description_for_auth_hash, #description_for_user, #find_user_by_email, #find_user_by_username, #is_managed?, #match_by_email, #match_by_username, #retrieve_avatar, #retrieve_profile, #revoke
#after_create_account, #can_connect_existing_user?, #can_revoke?, #description_for_auth_hash, #description_for_user, #provides_groups?, #revoke
Instance Method Details
#after_authenticate(auth_token, existing_account: nil) ⇒ Object
22
23
24
25
26
|
# File 'lib/auth/twitter_authenticator.rb', line 22
def after_authenticate(auth_token, existing_account: nil)
auth_token[:extra] = {}
super
end
|
#enabled? ⇒ Boolean
8
9
10
|
# File 'lib/auth/twitter_authenticator.rb', line 8
def enabled?
SiteSetting.
end
|
#healthy? ⇒ Boolean
12
13
14
15
16
17
18
19
20
|
# File 'lib/auth/twitter_authenticator.rb', line 12
def healthy?
connection =
Faraday.new(url: "https://api.twitter.com") do |config|
config.basic_auth(SiteSetting., SiteSetting.)
end
connection.post("/oauth2/token").status == 200
rescue Faraday::Error
false
end
|
#name ⇒ Object
4
5
6
|
# File 'lib/auth/twitter_authenticator.rb', line 4
def name
"twitter"
end
|
#primary_email_verified?(auth_token) ⇒ Boolean
40
41
42
|
# File 'lib/auth/twitter_authenticator.rb', line 40
def primary_email_verified?(auth_token)
true
end
|
#register_middleware(omniauth) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/auth/twitter_authenticator.rb', line 28
def register_middleware(omniauth)
omniauth.provider :twitter,
setup:
lambda { |env|
strategy = env["omniauth.strategy"]
strategy.options[:consumer_key] = SiteSetting.
strategy.options[:consumer_secret] = SiteSetting.
}
end
|