Module: Panda::Core::OAuthProviders

Defined in:
lib/panda/core/oauth_providers.rb

Constant Summary collapse

PROVIDER_INFO =

Provider metadata for display purposes

{
  microsoft_graph: {
    name: "Microsoft",
    icon: "fa-brands fa-microsoft",
    color: "#00a4ef"
  },
  google_oauth2: {
    name: "Google",
    icon: "fa-brands fa-google",
    color: "#4285f4"
  },
  github: {
    name: "GitHub",
    icon: "fa-brands fa-github",
    color: "#333"
  },
  apple: {
    name: "Apple",
    icon: "fa-brands fa-apple",
    color: "#000000"
  }
}.freeze

Class Method Summary collapse

Class Method Details

.info(provider) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/panda/core/oauth_providers.rb', line 62

def self.info(provider)
  PROVIDER_INFO[provider.to_sym] || {
    name: provider.to_s.titleize,
    icon: "fa-solid fa-circle-user",
    color: "#6b7280"
  }
end

.setupObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/panda/core/oauth_providers.rb', line 28

def self.setup
  providers = []

  begin
    require "omniauth/strategies/github"
    providers << :github
  rescue LoadError
    # GitHub OAuth functionality not available
  end

  begin
    require "omniauth/strategies/google_oauth2"
    providers << :google_oauth2
  rescue LoadError
    # Google OAuth functionality not available
  end

  begin
    require "omniauth/strategies/microsoft_graph"
    providers << :microsoft_graph
  rescue LoadError
    # Microsoft OAuth functionality not available
  end

  begin
    require "omniauth/strategies/apple"
    providers << :apple
  rescue LoadError
    # Sign in with Apple not available (host app must add omniauth-apple)
  end

  providers
end