Class: YiffSpace::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/yiffspace/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#discord_bot_tokenObject

Discord bot token used to look up Discord users (shared across all auth clients).



64
65
66
# File 'lib/yiffspace/auth.rb', line 64

def discord_bot_token
  @discord_bot_token
end

#logto_api_client_idObject

Logto Management API credentials (shared across all auth clients).



61
62
63
# File 'lib/yiffspace/auth.rb', line 61

def logto_api_client_id
  @logto_api_client_id
end

#logto_api_client_secretObject

Logto Management API credentials (shared across all auth clients).



61
62
63
# File 'lib/yiffspace/auth.rb', line 61

def logto_api_client_secret
  @logto_api_client_secret
end

#logto_api_resourceObject

Logto Management API credentials (shared across all auth clients).



61
62
63
# File 'lib/yiffspace/auth.rb', line 61

def logto_api_resource
  @logto_api_resource
end

Instance Method Details

#add_auth(name) ⇒ Object



73
74
75
# File 'lib/yiffspace/auth.rb', line 73

def add_auth(name, &)
  YiffSpace::Auth.register(name, &)
end

#add_default_authObject



77
78
79
# File 'lib/yiffspace/auth.rb', line 77

def add_default_auth(&)
  add_auth(Auth::DEFAULT_CLIENT_NAME, &)
end

#auth(&block) ⇒ Object



66
67
68
69
70
71
# File 'lib/yiffspace/auth.rb', line 66

def auth(&block)
  client = YiffSpace::Auth.register(Auth::DEFAULT_CLIENT_NAME) unless YiffSpace::Auth.instance_variable_get(:@clients).key?(Auth::DEFAULT_CLIENT_NAME)
  client ||= YiffSpace::Auth[Auth::DEFAULT_CLIENT_NAME]
  block&.call(client)
  client
end