docbrown/app/services/authentication/providers/github.rb
Duke Greene 9a6f04bd37
api v1 endpoint for creating an organization (#19778)
* api v1 endpoint for creating an organization

* address failing specs, regenerate swagger docs

* remove old comment in destroy now that woreker call takes third argument

* refactor our services for profile images into images folder
2023-07-21 07:43:56 -04:00

47 lines
1 KiB
Ruby

module Authentication
module Providers
# GitHub authentication provider, uses omniauth-github as backend
class Github < Provider
OFFICIAL_NAME = "GitHub".freeze
SETTINGS_URL = "https://github.com/settings/applications".freeze
def self.official_name
OFFICIAL_NAME
end
def self.settings_url
SETTINGS_URL
end
def self.sign_in_path(**kwargs)
::Authentication::Paths.sign_in_path(
provider_name,
**kwargs,
)
end
def new_user_data
name = raw_info.name.presence || info.name
{
email: info.email.to_s,
github_username: info.nickname,
name: name,
remote_profile_image_url: Images::SafeRemoteProfileImageUrl.call(info.image.to_s)
}
end
def existing_user_data
{
github_username: info.nickname
}
end
protected
def cleanup_payload(auth_payload)
auth_payload
end
end
end
end