Module: YiffSpace::Auth

Defined in:
lib/yiffspace/auth.rb,
lib/yiffspace/auth/client.rb,
lib/yiffspace/auth/engine.rb,
lib/yiffspace/auth/helper.rb,
lib/yiffspace/auth/version.rb,
lib/yiffspace/auth/api_user.rb,
lib/yiffspace/auth/auth_info.rb,
lib/yiffspace/auth/user_info.rb,
lib/yiffspace/auth/permissions.rb,
lib/yiffspace/auth/discord_info.rb,
lib/yiffspace/auth/set_client_name.rb,
lib/yiffspace/auth/auth_info/anonymous.rb,
lib/yiffspace/auth/user_info/anonymous.rb,
app/controllers/yiff_space/auth/root_controller.rb,
app/controllers/yiff_space/auth/webhook_controller.rb,
app/controllers/yiff_space/auth/application_controller.rb

Defined Under Namespace

Modules: Helper Classes: ApiUser, ApplicationController, AuthInfo, Client, DiscordInfo, Engine, Permissions, RootController, SetClientName, UserInfo, WebhookController

Constant Summary collapse

CLIENT_NAME_ENV =
"yiffspace.auth.client_name"
DEFAULT_CLIENT_NAME =
:default
VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



34
35
36
# File 'lib/yiffspace/auth.rb', line 34

def [](name)
  @clients[name.to_sym] || raise(KeyError, "unknown auth client: #{name.inspect}")
end

.defaultObject



38
39
40
# File 'lib/yiffspace/auth.rb', line 38

def default
  @clients[DEFAULT_CLIENT_NAME] || raise("no default client configured")
end

.disable_debug_action!Object



54
55
56
# File 'lib/yiffspace/auth.rb', line 54

def disable_debug_action!
  @enable_debug_action = false
end

.enable_debug_action!Object



50
51
52
# File 'lib/yiffspace/auth.rb', line 50

def enable_debug_action!
  @enable_debug_action = true
end

.enable_debug_action?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/yiffspace/auth.rb', line 46

def enable_debug_action?
  @enable_debug_action
end

.get_by_id(id) ⇒ Object



42
43
44
# File 'lib/yiffspace/auth.rb', line 42

def get_by_id(id)
  @clients.values.find { |c| c.client_id == id } || raise(ArgumentError, "unable to find client with id: #{id}")
end

.register(name, &block) ⇒ Object



27
28
29
30
31
32
# File 'lib/yiffspace/auth.rb', line 27

def register(name, &block)
  client = Client.new(name)
  block&.call(client)
  @clients[name.to_sym] = client
  client
end