mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-05 20:52:48 -05:00
- Implement Atproto::ClientConfig for managing OAuth client configuration. - Create Atproto::Http module for handling HTTP requests with SSRF protection. - Develop Atproto::Identity class to resolve handles to DIDs and validate DID documents. - Introduce Atproto::Jws for generating and signing JWTs for OAuth. - Create Atproto::OauthClient to manage the OAuth authorization flow with Bluesky. - Add OmniAuth strategy for Bluesky sign-in, allowing users to authenticate using their Bluesky handle. - Update views to include Bluesky sign-in options and handle connections. - Modify routes to expose OAuth client metadata. - Allow members to sign in without an email address when using Bluesky. - Add tests for Bluesky authorization and sign-in processes.
20 lines
662 B
Ruby
20 lines
662 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Authentication < ApplicationRecord
|
|
belongs_to :member
|
|
|
|
# Providers a member can sign in or sign up with, and whether each is set up
|
|
# here. To add another, register it with OmniAuth, add it to Member's
|
|
# omniauth_providers, and give it a partial in app/views/authentications/sign_in/.
|
|
SIGN_IN_PROVIDERS = {
|
|
'bluesky' => -> { Atproto::ClientConfig.enabled? }
|
|
}.freeze
|
|
|
|
# Providers that identify someone without telling us an email address.
|
|
EMAIL_OPTIONAL_PROVIDERS = %w(bluesky).freeze
|
|
|
|
def self.enabled_sign_in_providers
|
|
SIGN_IN_PROVIDERS.select { |_provider, enabled| enabled.call }.keys
|
|
end
|
|
end
|