mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FEATURE: Allow users to sign in using LinkedIn OpenID Connect (#26281)
LinkedIn has grandfathered its old OAuth2 provider. This can only be used by existing apps. New apps have to use the new OIDC provider. This PR adds a linkedin_oidc provider to core. This will exist alongside the discourse-linkedin-auth plugin, which will be kept for those still using the deprecated provider.
This commit is contained in:
23
lib/validators/linkedin_oidc_credentials_validator.rb
Normal file
23
lib/validators/linkedin_oidc_credentials_validator.rb
Normal file
@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LinkedinOidcCredentialsValidator
|
||||
def initialize(opts = {})
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def valid_value?(val)
|
||||
return true if val == "f"
|
||||
return false if credentials_missing?
|
||||
true
|
||||
end
|
||||
|
||||
def error_message
|
||||
I18n.t("site_settings.errors.linkedin_oidc_credentials") if credentials_missing?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def credentials_missing?
|
||||
SiteSetting.linkedin_oidc_client_id.blank? || SiteSetting.linkedin_oidc_client_secret.blank?
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user